rubocop-gradual 0.3.5 → 0.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: 750548fbcac00bd48721d0c3f1b0b7a43b5cf77aaafe7a81d6f58bfbe6edc2e6
4
- data.tar.gz: dfba66113c744a92a51b6c72e6bec157c12dd721cee9d8a1d033a0845b4bf0ab
3
+ metadata.gz: ac6a3f340332c7f473c366316ad037da9a345e6676a5c2fb6913d1ce3e825de8
4
+ data.tar.gz: 5ef945971fb0023f94f83abc172e61eab7edda11269487e58b8d0ccfd7d0dae4
5
5
  SHA512:
6
- metadata.gz: d713758f60a7b2ee780aeafda2fb01c6eb2f68f5a97aa521da5b1ef57a5a33bf3d3fa05b9dfb0f9d231ac3f0d107b72b7af1260eb9e76f6ae259bc3a619d1190
7
- data.tar.gz: 1e4286b97788902cfc101698cb31ae756a70c2419d824ae3b547db1eb060a2cc36e6fc6eb334007658ef3c0ffec8ba484b257770d0e025768c1bf70aef58e419
6
+ metadata.gz: 90336770a4b779826c4ab6113d4386bca9619c4b61a70b3ffdeee703b658bba46c4a4605b0b79ceb8d69587c87cd1ae1315502d08e43c85ee90492062fc08361
7
+ data.tar.gz: 720f522c4d75609e9d109cfacceef4f553c2396d071feee92f27cfdd8f6e8e2268f842d72449e0ee9ccef3250fe0c4f7df1e02e5d1a55cdc2853eacb5ad2852f
data/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.0] - 2026-06-11
11
+
12
+ ### Added
13
+
14
+ - Add `--standard` option to lint with the [Standard](https://github.com/standardrb/standard) ruleset, including `.standard.yml` and `.standard_todo.yml` support. ([@skryukov])
15
+ - Support RuboCop's `--parallel` option. Previously the flag was silently dropped before reaching the RuboCop runner. ([@skryukov])
16
+
17
+ ### Fixed
18
+
19
+ - Define `--list` (`--list-target-files`) as a native rubocop-gradual option. Previously it relied on OptionParser expanding the abbreviation to RuboCop's `--list-target-files`, which broke with RuboCop >= 1.87 where `--list` became ambiguous. ([@skryukov])
20
+
21
+ ## [0.3.6] - 2024-07-21
22
+
23
+ ### Fixed
24
+
25
+ - Don't fail `--check` when no issues and no lock file present. ([@skryukov])
26
+
10
27
  ## [0.3.5] - 2024-06-24
11
28
 
12
29
  ### Added
@@ -118,7 +135,9 @@ RuboCop::Gradual::RakeTask.new
118
135
  [@dmorgan-fa]: https://github.com/dmorgan-fa
119
136
  [@skryukov]: https://github.com/skryukov
120
137
 
121
- [Unreleased]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.5...HEAD
138
+ [Unreleased]: https://github.com/skryukov/rubocop-gradual/compare/v0.4.0...HEAD
139
+ [0.4.0]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.6...v0.4.0
140
+ [0.3.6]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.5...v0.3.6
122
141
  [0.3.5]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.4...v0.3.5
123
142
  [0.3.4]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.3...v0.3.4
124
143
  [0.3.3]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.2...v0.3.3
data/README.md CHANGED
@@ -50,6 +50,8 @@ Proposed workflow:
50
50
  -a, --autocorrect Autocorrect offenses (only when it's safe).
51
51
  -A, --autocorrect-all Autocorrect offenses (safe and unsafe).
52
52
  --gradual-file FILE Specify Gradual lock file.
53
+ --standard Lint with the Standard ruleset.
54
+ --list, --list-target-files List target files.
53
55
  -v, --version Display version.
54
56
  -h, --help Prints this help.
55
57
  ```
@@ -103,6 +105,17 @@ rubocop-gradual --commit origin/main # run `rubocop-gradual` on changed files si
103
105
  rubocop-gradual --staged --autocorrect # run `rubocop-gradual` with autocorrect on staged files
104
106
  ```
105
107
 
108
+ ## Standard support (experimental)
109
+
110
+ RuboCop Gradual can lint with the [Standard] ruleset instead of a RuboCop configuration. Add the [standard gem] to your Gemfile and pass the `--standard` option:
111
+
112
+ ```shell
113
+ rubocop-gradual --standard # run `rubocop-gradual` with the Standard ruleset
114
+ rubocop-gradual --standard -a # run `rubocop-gradual` with the Standard ruleset and autocorrect
115
+ ```
116
+
117
+ RuboCop Gradual picks up `.standard.yml` and `.standard_todo.yml` configuration files, so existing Standard setups work as is.
118
+
106
119
  ## Require mode (experimental)
107
120
 
108
121
  RuboCop Gradual can be used in "Require mode", which is a way to replace `rubocop` with `rubocop-gradual`:
@@ -158,6 +171,8 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/skryuk
158
171
  The gem is available as open source under the terms of the [MIT License].
159
172
 
160
173
  [lefthook]: https://github.com/evilmartians/lefthook
174
+ [Standard]: https://github.com/standardrb/standard
175
+ [standard gem]: https://rubygems.org/gems/standard
161
176
  [RuboCop TODO file]: https://docs.rubocop.org/rubocop/configuration.html#automatically-generated-configuration
162
177
  [Pronto]: https://github.com/prontolabs/pronto-rubocop
163
178
  [Betterer]: https://github.com/phenomnomnominal/betterer
@@ -42,7 +42,7 @@ module RuboCop
42
42
 
43
43
  def rubocop_options
44
44
  Configuration.rubocop_options
45
- .slice(:config, :debug, :display_time)
45
+ .slice(:config, :debug, :display_time, :parallel)
46
46
  .merge(formatters: [[Formatters::Base, nil]])
47
47
  end
48
48
 
@@ -5,16 +5,21 @@ module RuboCop
5
5
  # Configuration class stores Gradual and Rubocop options.
6
6
  module Configuration
7
7
  class << self
8
- attr_reader :options, :rubocop_options, :rubocop_results, :lint_paths, :target_file_paths
8
+ attr_reader :options, :rubocop_options, :rubocop_results, :lint_paths
9
9
 
10
10
  def apply(options = {}, rubocop_options = {}, lint_paths = [])
11
11
  @options = options
12
12
  @rubocop_options = rubocop_options
13
13
  @lint_paths = lint_paths
14
- @target_file_paths = rubocop_target_file_paths
14
+ @target_file_paths = nil
15
+ @standard_config_store = nil
15
16
  @rubocop_results = []
16
17
  end
17
18
 
19
+ def target_file_paths
20
+ @target_file_paths ||= rubocop_target_file_paths
21
+ end
22
+
18
23
  def command
19
24
  options.fetch(:command, :base)
20
25
  end
@@ -36,6 +41,8 @@ module RuboCop
36
41
  end
37
42
 
38
43
  def rubocop_config_store
44
+ return standard_config_store if options[:standard]
45
+
39
46
  RuboCop::ConfigStore.new.tap do |config_store|
40
47
  config_store.options_config = rubocop_options[:config] if rubocop_options[:config]
41
48
  end
@@ -43,6 +50,19 @@ module RuboCop
43
50
 
44
51
  private
45
52
 
53
+ def standard_config_store
54
+ @standard_config_store ||= begin
55
+ require_standard
56
+ Standard::BuildsConfig.new.call([]).rubocop_config_store
57
+ end
58
+ end
59
+
60
+ def require_standard
61
+ require "standard"
62
+ rescue LoadError
63
+ raise Error, "Standard is not found, please add `gem \"standard\"` to your Gemfile first."
64
+ end
65
+
46
66
  def rubocop_target_file_paths
47
67
  target_finder = RuboCop::TargetFinder.new(rubocop_config_store, rubocop_options)
48
68
  mode = if rubocop_options[:only_recognized_file_types]
@@ -23,8 +23,7 @@ module RuboCop
23
23
  private
24
24
 
25
25
  def git_installed!
26
- void = /msdos|mswin|djgpp|mingw/.match?(RbConfig::CONFIG["host_os"]) ? "NUL" : "/dev/null"
27
- git_found = `git --version >>#{void} 2>&1`
26
+ git_found = `git --version >>#{File::NULL} 2>&1`
28
27
 
29
28
  raise Error, "Git is not found, please install it first." unless git_found
30
29
  end
@@ -56,8 +56,7 @@ module RuboCop
56
56
 
57
57
  def define_gradual_options(opts)
58
58
  opts.on("-a", "--autocorrect", "Autocorrect offenses (only when it's safe).") do
59
- @rubocop_options[AUTOCORRECT_KEY] = true
60
- @rubocop_options[:"safe_#{AUTOCORRECT_KEY}"] = true
59
+ @rubocop_options[AUTOCORRECT_KEY] = @rubocop_options[:"safe_#{AUTOCORRECT_KEY}"] = true
61
60
  @options[:command] = :autocorrect
62
61
  end
63
62
  opts.on("-A", "--autocorrect-all", "Autocorrect offenses (safe and unsafe).") do
@@ -66,6 +65,8 @@ module RuboCop
66
65
  end
67
66
 
68
67
  opts.on("--gradual-file FILE", "Specify Gradual lock file.") { |path| @options[:path] = path }
68
+
69
+ opts.on("--standard", "Lint with the Standard ruleset.") { @options[:standard] = true }
69
70
  end
70
71
 
71
72
  def define_lint_paths_options(opts)
@@ -78,6 +79,8 @@ module RuboCop
78
79
  opts.on("--commit COMMIT", "Lint files changed since the commit.") do |commit|
79
80
  @lint_paths = git_lint_paths(commit)
80
81
  end
82
+
83
+ opts.on("--list", "--list-target-files", "List target files.") { @rubocop_options[:list_target_files] = true }
81
84
  end
82
85
 
83
86
  def define_info_options(opts)
@@ -35,7 +35,10 @@ module RuboCop
35
35
  private
36
36
 
37
37
  def fail_with_outdated_lock?(diff)
38
- Configuration.mode == :check && diff.state != :no_changes
38
+ return false if Configuration.mode != :check
39
+ return false if diff.state == :complete && old_results.nil?
40
+
41
+ diff.state != :no_changes
39
42
  end
40
43
 
41
44
  def sync_lock_file(diff)
@@ -29,7 +29,7 @@ module RuboCop
29
29
  private
30
30
 
31
31
  def prepare_issues(issues)
32
- issues.map { |issue| Issue.new(**issue.merge(hash: issue_hash(issue))) }
32
+ issues.map { |issue| Issue.new(**issue, hash: issue_hash(issue)) }
33
33
  end
34
34
 
35
35
  def issue_hash(issue)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Gradual
5
- VERSION = "0.3.5"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-gradual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svyatoslav Kryukov
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-06-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: benchmark
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: diff-lcs
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -137,7 +150,6 @@ metadata:
137
150
  homepage_uri: https://github.com/skryukov/rubocop-gradual
138
151
  source_code_uri: https://github.com/skryukov/rubocop-gradual
139
152
  rubygems_mfa_required: 'true'
140
- post_install_message:
141
153
  rdoc_options: []
142
154
  require_paths:
143
155
  - lib
@@ -152,8 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
164
  - !ruby/object:Gem::Version
153
165
  version: '0'
154
166
  requirements: []
155
- rubygems_version: 3.5.7
156
- signing_key:
167
+ rubygems_version: 3.6.9
157
168
  specification_version: 4
158
169
  summary: Gradual RuboCop plugin
159
170
  test_files: []