manageiq-style 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30b3629a0d14ba1680e62920e1304effa28b6a8c00f1415c6496148eba75f804
4
- data.tar.gz: 61704454dacf7bca212a9ec3301f567860d5d2aec867097c1d697e799de020b4
3
+ metadata.gz: 990c9480ed907d42d8fc314a30dd34826cfe773de229db4ff9159e21df609fde
4
+ data.tar.gz: a4b0ee736be350a01d31bd0aaed575e4b9e55cfe53300b478c031fce2184f301
5
5
  SHA512:
6
- metadata.gz: d0a9486e38802b8ac853683e833dc95c26b53db3cb322633d63a558711d589b96a5e133b7d824f5f222ca17a4e1d015b372c5f094fe1a6a0d524d99068b8c443
7
- data.tar.gz: 50b4a4af2740697a2f114b7eee18ff6d9af87c6462b20a2c5675fa380fc47527d8e7bfab5f331967dab6cce794725aa1e715113478cadfdcbdfc3de210801a41
6
+ metadata.gz: 84d62a4be38cf15303b7ec1576311e242c787acfccc06a620d092f19231ba59b98efcfd43661e717cf9697af597d2c4052cf96658fe893313c687b3707024ac6
7
+ data.tar.gz: d61750885ba8c60c747e03f20839eac9151baf775bc4fd9c0c9069610303358471ddb03bd9b226915e3f06bdccc1383bd88721b3be144775c5ee046f9e6e9aee
data/.codeclimate.yml CHANGED
@@ -12,5 +12,5 @@ plugins:
12
12
  rubocop:
13
13
  enabled: true
14
14
  config: ".rubocop_cc.yml"
15
- channel: rubocop-0-82
15
+ channel: rubocop-1-56-3
16
16
  version: '2'
@@ -12,22 +12,23 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  ruby-version:
15
- - '2.5'
16
- - '2.6'
17
15
  - '2.7'
18
16
  - '3.0'
17
+ - '3.1'
18
+ - '3.2'
19
19
  env:
20
20
  CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
21
21
  steps:
22
- - uses: actions/checkout@v2
22
+ - uses: actions/checkout@v4
23
23
  - name: Set up Ruby
24
24
  uses: ruby/setup-ruby@v1
25
25
  with:
26
26
  ruby-version: ${{ matrix.ruby-version }}
27
27
  bundler-cache: true
28
+ timeout-minutes: 30
28
29
  - name: Run tests
29
30
  run: bundle exec rake
30
31
  - name: Report code coverage
31
32
  if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.0' }}
32
33
  continue-on-error: true
33
- uses: paambaati/codeclimate-action@v3.0.0
34
+ uses: paambaati/codeclimate-action@v5
data/.yamllint ADDED
@@ -0,0 +1,9 @@
1
+ ignore: |-
2
+ /locale/**
3
+ /vendor/**
4
+ extends: relaxed
5
+ rules:
6
+ indentation:
7
+ indent-sequences: false
8
+ line-length:
9
+ max: 1000
data/CHANGELOG.md ADDED
@@ -0,0 +1,40 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [1.4.0] - 2023-11-22
8
+ ### Added
9
+ - Ensure .haml-lint.yml and .yamllint files [[#39](https://github.com/ManageIQ/manageiq-style/pull/39)]
10
+ - Add lookup for existing rubocop channels [[#39](https://github.com/ManageIQ/manageiq-style/pull/39)]
11
+
12
+ ### Changed
13
+ - Bump to rubocop 1.56.3 channel [[#39](https://github.com/ManageIQ/manageiq-style/pull/39)]
14
+ - Bump to Ruby 2.7 [[#37](https://github.com/ManageIQ/manageiq-style/pull/37)]
15
+
16
+ ## [1.3.3] - 2022-10-20
17
+ ## [1.3.2] - 2022-06-21
18
+ ## [1.3.1] - 2021-06-17
19
+ ## [1.3.0] - 2021-04-27
20
+ ## [1.2.0] - 2021-01-27
21
+ ## [1.1.3] - 2021-01-05
22
+ ## [1.1.2] - 2020-12-17
23
+ ## [1.1.1] - 2020-11-10
24
+ ## [1.0.1] - 2020-08-26
25
+ ## [1.0.1] - 2020-06-19
26
+ ## [1.0.0] - 2020-05-19
27
+
28
+ [Unreleased]: https://github.com/ManageIQ/more_core_extensions/compare/v1.4.0...HEAD
29
+ [1.4.0]: https://github.com/ManageIQ/more_core_extensions/compare/v1.3.3...v1.4.0
30
+ [1.3.3]: https://github.com/ManageIQ/more_core_extensions/compare/v1.3.2...v1.3.3
31
+ [1.3.2]: https://github.com/ManageIQ/more_core_extensions/compare/v1.3.1...v1.3.2
32
+ [1.3.1]: https://github.com/ManageIQ/more_core_extensions/compare/v1.3.0...v1.3.1
33
+ [1.3.0]: https://github.com/ManageIQ/more_core_extensions/compare/v1.2.0...v1.3.0
34
+ [1.2.0]: https://github.com/ManageIQ/more_core_extensions/compare/v1.1.3...v1.2.0
35
+ [1.1.3]: https://github.com/ManageIQ/more_core_extensions/compare/v1.1.2...v1.1.3
36
+ [1.1.2]: https://github.com/ManageIQ/more_core_extensions/compare/v1.1.1...v1.1.2
37
+ [1.1.1]: https://github.com/ManageIQ/more_core_extensions/compare/v1.0.1...v1.1.1
38
+ [1.0.1]: https://github.com/ManageIQ/more_core_extensions/compare/v1.0.1...v1.0.1
39
+ [1.0.1]: https://github.com/ManageIQ/more_core_extensions/compare/v1.0.0...v1.0.1
40
+ [1.0.0]: https://github.com/ManageIQ/more_core_extensions/tree/v1.0.0
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  module ManageIQ
2
4
  module Style
3
5
  class CLI
@@ -30,10 +32,14 @@ module ManageIQ
30
32
  require 'more_core_extensions/all'
31
33
 
32
34
  check_for_codeclimate_channel
35
+
33
36
  update_rubocop_yml
34
37
  write_rubocop_cc_yml
35
38
  ensure_rubocop_local_yml_exists
36
39
  update_codeclimate_yml
40
+ ensure_haml_lint_yml
41
+ update_yamllint
42
+
37
43
  update_generator
38
44
  update_gem_source
39
45
  end
@@ -41,16 +47,28 @@ module ManageIQ
41
47
  private
42
48
 
43
49
  def check_for_codeclimate_channel
44
- begin
45
- require 'open-uri'
46
- URI::HTTPS.build(
47
- :host => "raw.githubusercontent.com",
48
- :path => File.join("/codeclimate", "codeclimate-rubocop", "channel", cc_rubocop_channel, "Gemfile")
49
- ).open
50
- rescue OpenURI::HTTPError
51
- puts "RuboCop version #{rubocop_version.version} is not supported by CodeClimate."
52
- exit 1
50
+ require 'open-uri'
51
+ uri = URI.parse("https://raw.githubusercontent.com/codeclimate/codeclimate-rubocop/channel/#{cc_rubocop_channel}/Gemfile")
52
+ uri.open
53
+ rescue OpenURI::HTTPError
54
+ STDERR.puts "RuboCop version #{rubocop_version.version} is not supported by CodeClimate."
55
+ STDERR.puts
56
+ STDERR.puts "Accepted versions are:"
57
+ fetch_all_codeclimate_channels.each_slice(10) do |versions|
58
+ STDERR.puts " #{versions.join(", ")}"
53
59
  end
60
+ exit 1
61
+ end
62
+
63
+ def fetch_all_codeclimate_channels
64
+ `git ls-remote --heads https://github.com/codeclimate/codeclimate-rubocop 'channel/rubocop-*' 2>/dev/null`
65
+ .lines
66
+ .flat_map { |l| l.match(/rubocop-(.+)$/).captures }
67
+ .map { |v| v.split("-").join(".") }
68
+ .reject { |v| v == "1.70" } # This is not a real version, but the branch exists :shrug:
69
+ .sort_by { |v| v.split(".").map(&:to_i) }
70
+ rescue
71
+ []
54
72
  end
55
73
 
56
74
  def update_rubocop_yml(file = ".rubocop.yml")
@@ -63,7 +81,7 @@ module ManageIQ
63
81
  data.store_path("inherit_gem", "manageiq-style", ".rubocop_base.yml")
64
82
  data["inherit_from"] = [".rubocop_local.yml"]
65
83
 
66
- File.write(".rubocop.yml", data.to_yaml.sub("---\n", ""))
84
+ File.write(file, data.to_yaml.sub("---\n", ""))
67
85
  end
68
86
 
69
87
  def write_rubocop_cc_yml(file = ".rubocop_cc.yml")
@@ -79,7 +97,6 @@ module ManageIQ
79
97
  end
80
98
 
81
99
  def ensure_rubocop_local_yml_exists(file = ".rubocop_local.yml")
82
- require 'fileutils'
83
100
  FileUtils.touch(file)
84
101
  end
85
102
 
@@ -119,7 +136,33 @@ module ManageIQ
119
136
 
120
137
  data["version"] ||= "2"
121
138
 
122
- File.write(".codeclimate.yml", data.to_yaml.sub("---\n", ""))
139
+ File.write(file, data.to_yaml.sub("---\n", ""))
140
+ end
141
+
142
+ def ensure_haml_lint_yml(file = ".haml-lint.yml")
143
+ return if File.exist?(file)
144
+
145
+ FileUtils.ln_s(".rubocop.yml", file)
146
+ end
147
+
148
+ def update_yamllint(file = ".yamllint")
149
+ data = begin
150
+ YAML.load_file(file)
151
+ rescue Errno::ENOENT
152
+ {}
153
+ end
154
+
155
+ data["ignore"] ||= ""
156
+ data["ignore"] << "/locale/**\n" unless data["ignore"].include?("/locale/**")
157
+ data["ignore"] << "/vendor/**\n" unless data["ignore"].include?("/vendor/**")
158
+ data["ignore"].chomp!
159
+
160
+ data["extends"] = "relaxed"
161
+
162
+ data.store_path("rules", "indentation", "indent-sequences", false)
163
+ data.store_path("rules", "line-length", "max", 1000)
164
+
165
+ File.write(file, data.to_yaml.sub("---\n", ""))
123
166
  end
124
167
 
125
168
  def update_gem_source
@@ -213,7 +256,7 @@ module ManageIQ
213
256
  indent = lines.first.match(/^\s+/).to_s
214
257
 
215
258
  lines.map! { |l| l.strip.gsub(/[()]/, " ").split(" ", 3) } # Split to [prefix, gem, versions]
216
- lines.each { |parts| parts[1].tr!("'", "\"")} # Ensure double quoted gem name
259
+ lines.each { |parts| parts[1].tr!("'", "\"") } # Ensure double quoted gem name
217
260
  max_width = lines.map { |parts| parts[1].size }.max # Determine the widest gem name
218
261
  lines.each { |parts| parts[1] = parts[1].ljust(max_width, " ") } # Apply the width
219
262
  lines.map! { |parts| parts.join(" ").strip.insert(0, indent) << "\n" } # Back to strings
@@ -1,5 +1,5 @@
1
1
  module ManageIQ
2
2
  module Style
3
- VERSION = "1.3.2"
3
+ VERSION = "1.4.0".freeze
4
4
  end
5
5
  end
@@ -9,9 +9,10 @@ Gem::Specification.new do |spec|
9
9
  spec.description = spec.summary
10
10
  spec.homepage = "https://github.com/ManageIQ/manageiq-style"
11
11
  spec.license = "MIT"
12
- spec.required_ruby_version = Gem::Requirement.new(">= 2.0.0")
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
13
13
 
14
14
  spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["rubygems_mfa_required"] = "true"
15
16
  spec.metadata["source_code_uri"] = spec.homepage
16
17
 
17
18
  # Specify which files should be added to the gem when it is released.
@@ -25,7 +26,7 @@ Gem::Specification.new do |spec|
25
26
 
26
27
  spec.add_runtime_dependency "more_core_extensions"
27
28
  spec.add_runtime_dependency "optimist"
28
- spec.add_runtime_dependency "rubocop", "~> 1.13"
29
+ spec.add_runtime_dependency "rubocop", "= 1.56.3"
29
30
  spec.add_runtime_dependency "rubocop-performance"
30
31
  spec.add_runtime_dependency "rubocop-rails"
31
32
 
data/styles/base.yml CHANGED
@@ -8,7 +8,7 @@ AllCops:
8
8
  - spec/manageiq/**/*
9
9
  - vendor/**/*
10
10
  SuggestExtensions: false
11
- TargetRubyVersion: 2.6
11
+ TargetRubyVersion: 2.7
12
12
  Layout/HashAlignment:
13
13
  EnforcedHashRocketStyle: table
14
14
  EnforcedColonStyle: table
@@ -120,7 +120,7 @@ Style/MethodCallWithArgsParentheses:
120
120
  - lib/tasks/**/*
121
121
  - spec/**/*
122
122
  Enabled: true
123
- IgnoredMethods:
123
+ AllowedMethods:
124
124
  # Ruby
125
125
  - add_dependency
126
126
  - add_development_dependency
@@ -266,6 +266,8 @@ Style/PerlBackrefs:
266
266
  Enabled: false
267
267
  Style/ParallelAssignment:
268
268
  Enabled: false
269
+ Style/QuotedSymbols:
270
+ Enabled: false # disabled because Style/StringLiterals is disabled
269
271
  Style/RedundantReturn:
270
272
  AllowMultipleReturnValues: true
271
273
  Style/RegexpLiteral:
@@ -283,7 +285,7 @@ Style/SingleLineMethods:
283
285
  Style/SpecialGlobalVars:
284
286
  AutoCorrect: false
285
287
  Style/StringLiterals:
286
- Enabled: false
288
+ Enabled: false # Also see Style/QuotedSymbols
287
289
  Style/StringLiteralsInInterpolation:
288
290
  Enabled: false
289
291
  Style/SymbolArray:
data/styles/cc_base.yml CHANGED
@@ -4,7 +4,7 @@
4
4
  #
5
5
  ---
6
6
  AllCops:
7
- TargetRubyVersion: 2.6
7
+ TargetRubyVersion: 2.7
8
8
  Bundler:
9
9
  Enabled: true
10
10
  Gemspec:
@@ -44,4 +44,3 @@ Metrics/ParameterLists:
44
44
  Enabled: true
45
45
  Metrics/PerceivedComplexity:
46
46
  Enabled: false
47
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manageiq-style
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Authors
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2023-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: more_core_extensions
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '1.13'
47
+ version: 1.56.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: '1.13'
54
+ version: 1.56.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop-performance
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -140,6 +140,8 @@ files:
140
140
  - ".rubocop_cc_base.yml"
141
141
  - ".rubocop_local.yml"
142
142
  - ".whitesource"
143
+ - ".yamllint"
144
+ - CHANGELOG.md
143
145
  - Gemfile
144
146
  - LICENSE.txt
145
147
  - README.md
@@ -159,6 +161,7 @@ licenses:
159
161
  - MIT
160
162
  metadata:
161
163
  homepage_uri: https://github.com/ManageIQ/manageiq-style
164
+ rubygems_mfa_required: 'true'
162
165
  source_code_uri: https://github.com/ManageIQ/manageiq-style
163
166
  post_install_message:
164
167
  rdoc_options: []
@@ -168,14 +171,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
171
  requirements:
169
172
  - - ">="
170
173
  - !ruby/object:Gem::Version
171
- version: 2.0.0
174
+ version: 2.7.0
172
175
  required_rubygems_version: !ruby/object:Gem::Requirement
173
176
  requirements:
174
177
  - - ">="
175
178
  - !ruby/object:Gem::Version
176
179
  version: '0'
177
180
  requirements: []
178
- rubygems_version: 3.3.5
181
+ rubygems_version: 3.2.33
179
182
  signing_key:
180
183
  specification_version: 4
181
184
  summary: Style and linting configuration for ManageIQ projects.