rubocop-gradual 0.3.6 → 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 +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +15 -0
- data/lib/rubocop/gradual/commands/base.rb +1 -1
- data/lib/rubocop/gradual/configuration.rb +22 -2
- data/lib/rubocop/gradual/git.rb +1 -2
- data/lib/rubocop/gradual/options.rb +5 -2
- data/lib/rubocop/gradual/results/file.rb +1 -1
- data/lib/rubocop/gradual/version.rb +1 -1
- metadata +17 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac6a3f340332c7f473c366316ad037da9a345e6676a5c2fb6913d1ce3e825de8
|
|
4
|
+
data.tar.gz: 5ef945971fb0023f94f83abc172e61eab7edda11269487e58b8d0ccfd7d0dae4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90336770a4b779826c4ab6113d4386bca9619c4b61a70b3ffdeee703b658bba46c4a4605b0b79ceb8d69587c87cd1ae1315502d08e43c85ee90492062fc08361
|
|
7
|
+
data.tar.gz: 720f522c4d75609e9d109cfacceef4f553c2396d071feee92f27cfdd8f6e8e2268f842d72449e0ee9ccef3250fe0c4f7df1e02e5d1a55cdc2853eacb5ad2852f
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ 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
|
+
|
|
10
21
|
## [0.3.6] - 2024-07-21
|
|
11
22
|
|
|
12
23
|
### Fixed
|
|
@@ -124,7 +135,8 @@ RuboCop::Gradual::RakeTask.new
|
|
|
124
135
|
[@dmorgan-fa]: https://github.com/dmorgan-fa
|
|
125
136
|
[@skryukov]: https://github.com/skryukov
|
|
126
137
|
|
|
127
|
-
[Unreleased]: https://github.com/skryukov/rubocop-gradual/compare/v0.
|
|
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
|
|
128
140
|
[0.3.6]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.5...v0.3.6
|
|
129
141
|
[0.3.5]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.4...v0.3.5
|
|
130
142
|
[0.3.4]: https://github.com/skryukov/rubocop-gradual/compare/v0.3.3...v0.3.4
|
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
|
|
@@ -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
|
|
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 =
|
|
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]
|
data/lib/rubocop/gradual/git.rb
CHANGED
|
@@ -23,8 +23,7 @@ module RuboCop
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
25
|
def git_installed!
|
|
26
|
-
|
|
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)
|
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.
|
|
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:
|
|
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.
|
|
156
|
-
signing_key:
|
|
167
|
+
rubygems_version: 3.6.9
|
|
157
168
|
specification_version: 4
|
|
158
169
|
summary: Gradual RuboCop plugin
|
|
159
170
|
test_files: []
|