standard 1.25.4 → 1.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -1
- data/README.md +8 -2
- data/config/base.yml +2 -14
- data/lib/standard/builds_config.rb +3 -9
- data/lib/standard/formatter.rb +69 -48
- data/lib/standard/loads_yaml_config.rb +1 -1
- data/lib/standard/lsp/routes.rb +0 -3
- data/lib/standard/lsp/standardizer.rb +2 -2
- data/lib/standard/merges_settings.rb +7 -1
- data/lib/standard/rake.rb +8 -1
- data/lib/standard/{parses_cli_option.rb → resolves_yaml_option.rb} +8 -2
- data/lib/standard/runners/help.rb +2 -1
- data/lib/standard/runners/verbose_version.rb +1 -1
- data/lib/standard/version.rb +1 -1
- metadata +4 -5
- data/lib/standard/detects_fixability.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98dc49ce80e703d0a3fb0d1d70bf4bac16c28e9dbf16988c09ebada4cb8bcd9f
|
4
|
+
data.tar.gz: 1e771a7f5eb05183f7700c590bb119eaa5cb104566b656b1945a2198099dd2f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ed743c84d1ca8fc6ed19678292463cdb98c1e82d6f698c3fce646a2bcc022dd133e0d1040216c68f5c70d6884248b1fae9a04ccace31497403ba200a0b512b5
|
7
|
+
data.tar.gz: fbef7298ac3da5a0842e087225ed5abd61ec75f8eb6a51629c6213fa196b477cef5b7a7b3b5be161434e405fb6068b9d2f5557f645f0ea145cb9ab39f444fdf0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.26.0
|
4
|
+
|
5
|
+
* Introduce `--fix-unsafely` and `rake standard:fix_unsafely` for running
|
6
|
+
unsafe corrections. Improve output about fix suggestions, as well
|
7
|
+
[#545](https://github.com/testdouble/standard/pull/545)
|
8
|
+
|
9
|
+
## 1.25.5
|
10
|
+
|
11
|
+
* Temporarily disable registration of `executeCommand` to prevent conflict with
|
12
|
+
the VS Code extension's client-side registration of the same name
|
13
|
+
[#544](https://github.com/testdouble/standard/pull/544)
|
14
|
+
|
3
15
|
## 1.25.4
|
4
16
|
|
5
17
|
* Bring the LSP Server's executeCommand capabilities in line with the spec
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -76,8 +76,8 @@ files in the current working directory:
|
|
76
76
|
```bash
|
77
77
|
$ bundle exec standardrb
|
78
78
|
standard: Use Ruby Standard Style (https://github.com/testdouble/standard)
|
79
|
-
standard: Run `standardrb --fix` to
|
80
|
-
/Users/code/cli.rb:31:23: Style/Semicolon: Do not use semicolons to terminate expressions.
|
79
|
+
standard: Run `standardrb --fix` to potentially fix one problem.
|
80
|
+
/Users/jill/code/cli.rb:31:23: Style/Semicolon: Do not use semicolons to terminate expressions.
|
81
81
|
```
|
82
82
|
|
83
83
|
You can optionally pass in a directory (or directories) using a glob pattern.
|
@@ -121,6 +121,7 @@ Here are the tasks bundled with Standard:
|
|
121
121
|
```
|
122
122
|
$ rake standard # equivalent to running `standardrb`
|
123
123
|
$ rake standard:fix # equivalent to running `standardrb --fix`
|
124
|
+
$ rake standard:fix_unsafely # equivalent to running `standardrb --fix-unsafely`
|
124
125
|
```
|
125
126
|
|
126
127
|
You may also pass command line options to Standard's Rake tasks by embedding
|
@@ -268,6 +269,11 @@ Yes! You can use `standardrb --fix` to fix most issues automatically.
|
|
268
269
|
`standardrb --fix` is built into `standardrb` for maximum convenience. Most
|
269
270
|
problems are fixable, but some errors must be fixed manually.
|
270
271
|
|
272
|
+
If you're feeling sinister, you can also use `standardrb --fix-unsafely`, which
|
273
|
+
will also perform fixes, even if they run the risk of altering program behavior.
|
274
|
+
If you read your git diffs closely and have good tests, this is often okay, but
|
275
|
+
YMMV… it's called unsafe for a reason!
|
276
|
+
|
271
277
|
## Can I override the `fix: true` config setting?
|
272
278
|
|
273
279
|
Also yes! You can use `standardrb --no-fix`. Not `fix`ing is the default
|
data/config/base.yml
CHANGED
@@ -78,7 +78,6 @@ Layout/AssignmentIndentation:
|
|
78
78
|
Layout/BeginEndAlignment:
|
79
79
|
Enabled: true
|
80
80
|
EnforcedStyleAlignWith: start_of_line
|
81
|
-
AutoCorrect: true
|
82
81
|
Severity: warning
|
83
82
|
|
84
83
|
Layout/BlockAlignment:
|
@@ -110,7 +109,6 @@ Layout/ConditionPosition:
|
|
110
109
|
Layout/DefEndAlignment:
|
111
110
|
Enabled: true
|
112
111
|
EnforcedStyleAlignWith: start_of_line
|
113
|
-
AutoCorrect: true
|
114
112
|
Severity: warning
|
115
113
|
|
116
114
|
Layout/DotPosition:
|
@@ -174,7 +172,6 @@ Layout/EmptyLinesAroundModuleBody:
|
|
174
172
|
|
175
173
|
Layout/EndAlignment:
|
176
174
|
Enabled: true
|
177
|
-
AutoCorrect: true
|
178
175
|
EnforcedStyleAlignWith: variable
|
179
176
|
Severity: warning
|
180
177
|
|
@@ -447,6 +444,8 @@ Lint/AmbiguousRegexpLiteral:
|
|
447
444
|
Lint/AssignmentInCondition:
|
448
445
|
Enabled: true
|
449
446
|
AllowSafeAssignment: true
|
447
|
+
# Intentionally disable autocorrect to force us to intentionally decide
|
448
|
+
# whether assignment is intended as opposed to comparison
|
450
449
|
AutoCorrect: false
|
451
450
|
|
452
451
|
Lint/BigDecimalNew:
|
@@ -529,7 +528,6 @@ Lint/EmptyConditionalBody:
|
|
529
528
|
|
530
529
|
Lint/EmptyEnsure:
|
531
530
|
Enabled: true
|
532
|
-
AutoCorrect: true
|
533
531
|
|
534
532
|
Lint/EmptyExpression:
|
535
533
|
Enabled: true
|
@@ -695,7 +693,6 @@ Lint/RedundantWithObject:
|
|
695
693
|
|
696
694
|
Lint/RefinementImportMethods:
|
697
695
|
Enabled: true
|
698
|
-
SafeAutoCorrect: false
|
699
696
|
|
700
697
|
Lint/RegexpAsCondition:
|
701
698
|
Enabled: true
|
@@ -1003,7 +1000,6 @@ Performance/FlatMap:
|
|
1003
1000
|
|
1004
1001
|
Performance/InefficientHashSearch:
|
1005
1002
|
Enabled: true
|
1006
|
-
Safe: false
|
1007
1003
|
|
1008
1004
|
Performance/IoReadlines:
|
1009
1005
|
Enabled: false
|
@@ -1019,7 +1015,6 @@ Performance/OpenStruct:
|
|
1019
1015
|
|
1020
1016
|
Performance/RangeInclude:
|
1021
1017
|
Enabled: true
|
1022
|
-
Safe: false
|
1023
1018
|
|
1024
1019
|
Performance/RedundantBlockCall:
|
1025
1020
|
Enabled: false
|
@@ -1096,23 +1091,18 @@ Security/Eval:
|
|
1096
1091
|
|
1097
1092
|
Security/IoMethods:
|
1098
1093
|
Enabled: false
|
1099
|
-
Safe: false
|
1100
1094
|
|
1101
1095
|
Security/JSONLoad:
|
1102
1096
|
Enabled: true
|
1103
|
-
AutoCorrect: false
|
1104
|
-
SafeAutoCorrect: false
|
1105
1097
|
|
1106
1098
|
Security/MarshalLoad:
|
1107
1099
|
Enabled: false
|
1108
1100
|
|
1109
1101
|
Security/Open:
|
1110
1102
|
Enabled: true
|
1111
|
-
Safe: false
|
1112
1103
|
|
1113
1104
|
Security/YAMLLoad:
|
1114
1105
|
Enabled: true
|
1115
|
-
SafeAutoCorrect: false
|
1116
1106
|
|
1117
1107
|
Standard/BlockSingleLineBraces:
|
1118
1108
|
Enabled: true
|
@@ -1305,7 +1295,6 @@ Style/Encoding:
|
|
1305
1295
|
|
1306
1296
|
Style/EndBlock:
|
1307
1297
|
Enabled: true
|
1308
|
-
AutoCorrect: true
|
1309
1298
|
|
1310
1299
|
Style/EndlessMethod:
|
1311
1300
|
Enabled: false
|
@@ -1443,7 +1432,6 @@ Style/LambdaCall:
|
|
1443
1432
|
|
1444
1433
|
Style/LineEndConcatenation:
|
1445
1434
|
Enabled: true
|
1446
|
-
SafeAutoCorrect: false
|
1447
1435
|
|
1448
1436
|
Style/MagicCommentFormat:
|
1449
1437
|
Enabled: false
|
@@ -7,15 +7,15 @@ module Standard
|
|
7
7
|
|
8
8
|
class BuildsConfig
|
9
9
|
def initialize
|
10
|
-
@
|
10
|
+
@resolves_yaml_option = ResolvesYamlOption.new
|
11
11
|
@loads_yaml_config = LoadsYamlConfig.new
|
12
12
|
@merges_settings = MergesSettings.new
|
13
13
|
@creates_config_store = CreatesConfigStore.new
|
14
14
|
end
|
15
15
|
|
16
16
|
def call(argv, search_path = Dir.pwd)
|
17
|
-
standard_yaml_path =
|
18
|
-
todo_yaml_path =
|
17
|
+
standard_yaml_path = @resolves_yaml_option.call(argv, search_path, "--config", ".standard.yml")
|
18
|
+
todo_yaml_path = @resolves_yaml_option.call(argv, search_path, "--todo", ".standard_todo.yml")
|
19
19
|
standard_config = @loads_yaml_config.call(standard_yaml_path, todo_yaml_path)
|
20
20
|
|
21
21
|
settings = @merges_settings.call(argv, standard_config)
|
@@ -26,11 +26,5 @@ module Standard
|
|
26
26
|
@creates_config_store.call(standard_config)
|
27
27
|
)
|
28
28
|
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def determine_yaml_file(argv, search_path, option_name, default_file)
|
33
|
-
@parses_cli_option.call(argv, option_name) || FileFinder.new.call(default_file, search_path)
|
34
|
-
end
|
35
29
|
end
|
36
30
|
end
|
data/lib/standard/formatter.rb
CHANGED
@@ -1,47 +1,41 @@
|
|
1
1
|
require "yaml"
|
2
2
|
require "rubocop"
|
3
|
-
require_relative "detects_fixability"
|
4
3
|
|
5
4
|
module Standard
|
6
5
|
class Formatter < RuboCop::Formatter::BaseFormatter
|
7
|
-
STANDARD_GREETING =
|
6
|
+
STANDARD_GREETING = <<~MSG
|
8
7
|
standard: Use Ruby Standard Style (https://github.com/testdouble/standard)
|
9
8
|
MSG
|
10
9
|
|
11
|
-
def self.fixable_error_message(command)
|
12
|
-
<<-MSG.gsub(/^ {8}/, "")
|
13
|
-
standard: Run `#{command}` to automatically fix some problems.
|
14
|
-
MSG
|
15
|
-
end
|
16
|
-
|
17
|
-
def initialize(*args)
|
18
|
-
super
|
19
|
-
@detects_fixability = DetectsFixability.new
|
20
|
-
@header_printed_already = false
|
21
|
-
@fix_suggestion_printed_already = false
|
22
|
-
@offenses_encountered = false
|
23
|
-
end
|
24
|
-
|
25
10
|
def started(_target_files)
|
11
|
+
@header_printed_already = false
|
12
|
+
@total_correction_count = 0
|
13
|
+
@total_correctable_count = 0
|
14
|
+
@total_uncorrected_count = 0
|
26
15
|
print_todo_warning
|
27
16
|
end
|
28
17
|
|
29
18
|
def file_finished(file, offenses)
|
30
|
-
|
31
|
-
|
32
|
-
return unless uncorrected_offenses.any?
|
33
|
-
|
34
|
-
@offenses_encountered = true
|
19
|
+
track_stats(offenses)
|
35
20
|
|
36
|
-
|
37
|
-
|
21
|
+
if (uncorrected_offenses = offenses.reject(&:corrected?)).any?
|
22
|
+
print_header_once
|
38
23
|
|
39
|
-
|
40
|
-
|
24
|
+
uncorrected_offenses.each do |o|
|
25
|
+
output.printf(" %s:%d:%d: %s\n", path_to(file), o.line, o.real_column, o.message.tr("\n", " "))
|
26
|
+
end
|
41
27
|
end
|
42
28
|
end
|
43
29
|
|
30
|
+
def track_stats(offenses)
|
31
|
+
corrected = offenses.count(&:corrected?)
|
32
|
+
@total_correction_count += corrected
|
33
|
+
@total_correctable_count += offenses.count(&:correctable?) - corrected
|
34
|
+
@total_uncorrected_count += offenses.count - corrected
|
35
|
+
end
|
36
|
+
|
44
37
|
def finished(_inspected_files)
|
38
|
+
print_fix_suggestion
|
45
39
|
print_todo_congratulations
|
46
40
|
end
|
47
41
|
|
@@ -55,16 +49,17 @@ module Standard
|
|
55
49
|
@header_printed_already = true
|
56
50
|
end
|
57
51
|
|
58
|
-
def
|
59
|
-
if
|
60
|
-
|
61
|
-
|
52
|
+
def print_fix_suggestion
|
53
|
+
if (fix_mode = potential_fix_mode)
|
54
|
+
run_mode = determine_run_mode
|
55
|
+
|
56
|
+
command = if run_mode == :rake
|
57
|
+
"rake standard:#{fix_mode}"
|
62
58
|
else
|
63
|
-
"standardrb
|
59
|
+
"standardrb --#{fix_mode.to_s.tr("_", "-")}"
|
64
60
|
end
|
65
61
|
|
66
|
-
output.print
|
67
|
-
@fix_suggestion_printed_already = true
|
62
|
+
output.print fixable_error_message(command)
|
68
63
|
end
|
69
64
|
end
|
70
65
|
|
@@ -75,7 +70,7 @@ module Standard
|
|
75
70
|
todo_ignore_files = options[:todo_ignore_files]
|
76
71
|
return unless todo_ignore_files&.any?
|
77
72
|
|
78
|
-
output.print
|
73
|
+
output.print <<~HEADER
|
79
74
|
WARNING: this project is being migrated to standard gradually via `#{todo_file}` and is ignoring these files:
|
80
75
|
HEADER
|
81
76
|
|
@@ -85,29 +80,55 @@ module Standard
|
|
85
80
|
end
|
86
81
|
|
87
82
|
def print_todo_congratulations
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
output.print <<-HEADER.gsub(/^ {8}/, "")
|
97
|
-
Congratulations, you've successfully migrated this project to Standard! Delete `#{todo_file}` in celebration.
|
98
|
-
HEADER
|
83
|
+
if @total_uncorrected_count == 0 &&
|
84
|
+
options[:todo_file] &&
|
85
|
+
options[:todo_ignore_files]&.none?
|
86
|
+
output.print <<~HEADER
|
87
|
+
Congratulations, you've successfully migrated this project to Standard! Delete `#{options[:todo_file]}` in celebration.
|
88
|
+
HEADER
|
89
|
+
end
|
99
90
|
end
|
100
91
|
|
101
92
|
def path_to(file)
|
102
93
|
Pathname.new(file).relative_path_from(Pathname.new(Dir.pwd))
|
103
94
|
end
|
104
95
|
|
105
|
-
def
|
106
|
-
|
96
|
+
def potential_fix_mode
|
97
|
+
return nil unless @total_correctable_count > 0
|
98
|
+
|
99
|
+
if !options[:autocorrect]
|
100
|
+
:fix
|
101
|
+
elsif options[:autocorrect] && options[:safe_autocorrect]
|
102
|
+
:fix_unsafely
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def determine_run_mode
|
107
|
+
if File.split($PROGRAM_NAME).last == "rake"
|
108
|
+
:rake
|
109
|
+
else
|
110
|
+
:cli
|
111
|
+
end
|
107
112
|
end
|
108
113
|
|
109
|
-
def
|
110
|
-
|
114
|
+
def fixable_error_message(command)
|
115
|
+
sales_pitch = if !options[:autocorrect]
|
116
|
+
if @total_correctable_count > 1
|
117
|
+
"fix up to #{@total_correctable_count} problems"
|
118
|
+
else
|
119
|
+
"potentially fix one problem"
|
120
|
+
end
|
121
|
+
elsif options[:autocorrect] && options[:safe_autocorrect]
|
122
|
+
if @total_correctable_count > 1
|
123
|
+
"DANGEROUSLY fix #{@total_correctable_count} problems"
|
124
|
+
else
|
125
|
+
"DANGEROUSLY fix one problem"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
<<~MSG
|
130
|
+
standard: Run `#{command}` to #{sales_pitch}.
|
131
|
+
MSG
|
111
132
|
end
|
112
133
|
end
|
113
134
|
end
|
data/lib/standard/lsp/routes.rb
CHANGED
@@ -28,9 +28,6 @@ module Standard
|
|
28
28
|
capabilities: Proto::Interface::ServerCapabilities.new(
|
29
29
|
document_formatting_provider: true,
|
30
30
|
diagnostic_provider: true,
|
31
|
-
execute_command_provider: Proto::Interface::ExecuteCommandOptions.new(
|
32
|
-
commands: ["standardRuby.formatAutoFixes"]
|
33
|
-
),
|
34
31
|
text_document_sync: Proto::Interface::TextDocumentSyncOptions.new(
|
35
32
|
change: Proto::Constant::TextDocumentSyncKind::FULL,
|
36
33
|
open_close: true
|
@@ -49,9 +49,9 @@ module Standard
|
|
49
49
|
}
|
50
50
|
def fork_config(path, text, format:)
|
51
51
|
options = if format
|
52
|
-
{stdin: text, autocorrect: true,
|
52
|
+
{stdin: text, autocorrect: true, safe_autocorrect: true, formatters: []}
|
53
53
|
else
|
54
|
-
{stdin: text, autocorrect: false, formatters: [["json"]], format: "json"}
|
54
|
+
{stdin: text, autocorrect: false, safe_autocorrect: false, formatters: [["json"]], format: "json"}
|
55
55
|
end
|
56
56
|
Standard::Config.new(@config.runner, [path], BASE_OPTIONS.merge(options), @config.rubocop_config_store)
|
57
57
|
end
|
@@ -20,7 +20,7 @@ module Standard
|
|
20
20
|
|
21
21
|
def separate_argv(argv)
|
22
22
|
argv.partition do |flag|
|
23
|
-
["--generate-todo", "--fix", "--no-fix", "--version", "-v", "--verbose-version", "-V", "--help", "-h", "--lsp"].include?(flag)
|
23
|
+
["--generate-todo", "--fix", "--fix-unsafely", "--no-fix", "--version", "-v", "--verbose-version", "-V", "--help", "-h", "--lsp"].include?(flag)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -28,8 +28,13 @@ module Standard
|
|
28
28
|
argv.each_with_object({}) do |arg, cli_flags|
|
29
29
|
if arg == "--fix"
|
30
30
|
cli_flags[:autocorrect] = true
|
31
|
+
cli_flags[:safe_autocorrect] = true
|
32
|
+
elsif arg == "--fix-unsafely"
|
33
|
+
cli_flags[:autocorrect] = true
|
34
|
+
cli_flags[:safe_autocorrect] = false
|
31
35
|
elsif arg == "--no-fix"
|
32
36
|
cli_flags[:autocorrect] = false
|
37
|
+
cli_flags[:safe_autocorrect] = false
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
@@ -53,6 +58,7 @@ module Standard
|
|
53
58
|
def merge(standard_yaml, standard_cli_flags, rubocop_cli_flags)
|
54
59
|
{
|
55
60
|
autocorrect: standard_yaml[:fix],
|
61
|
+
safe_autocorrect: true,
|
56
62
|
formatters: [[standard_yaml[:format] || "Standard::Formatter", nil]],
|
57
63
|
parallel: standard_yaml[:parallel],
|
58
64
|
todo_file: standard_yaml[:todo_file],
|
data/lib/standard/rake.rb
CHANGED
@@ -18,9 +18,16 @@ task :standard do
|
|
18
18
|
fail unless exit_code == 0
|
19
19
|
end
|
20
20
|
|
21
|
-
desc "Lint and automatically
|
21
|
+
desc "Lint and automatically make safe fixes with the Standard Ruby style guide"
|
22
22
|
task :"standard:fix" do
|
23
23
|
require "standard"
|
24
24
|
exit_code = Standard::Cli.new(Standard::RakeSupport.argvify + ["--fix"]).run
|
25
25
|
fail unless exit_code == 0
|
26
26
|
end
|
27
|
+
|
28
|
+
desc "Lint and automatically make fixes (even unsafe ones!) with the Standard Ruby style guide"
|
29
|
+
task :"standard:fix_unsafely" do
|
30
|
+
require "standard"
|
31
|
+
exit_code = Standard::Cli.new(Standard::RakeSupport.argvify + ["--fix-unsafely"]).run
|
32
|
+
fail unless exit_code == 0
|
33
|
+
end
|
@@ -1,8 +1,14 @@
|
|
1
1
|
require "pathname"
|
2
2
|
|
3
3
|
module Standard
|
4
|
-
class
|
5
|
-
def call(argv, option_name)
|
4
|
+
class ResolvesYamlOption
|
5
|
+
def call(argv, search_path, option_name, default_file)
|
6
|
+
search_argv(argv, option_name) || FileFinder.new.call(default_file, search_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def search_argv(argv, option_name)
|
6
12
|
return unless (config_file = argv_value_for(argv, option_name))
|
7
13
|
|
8
14
|
resolved_config = Pathname.new(config_file)
|
@@ -9,7 +9,8 @@ module Standard
|
|
9
9
|
|
10
10
|
Options:
|
11
11
|
|
12
|
-
--fix
|
12
|
+
--fix Apply automatic fixes that we're confident won't break your code
|
13
|
+
--fix-unsafely Apply even more fixes, including some that may change code behavior
|
13
14
|
--no-fix Do not automatically fix failures
|
14
15
|
--format <name> Format output with any RuboCop formatter (e.g. "json")
|
15
16
|
--generate-todo Create a .standard_todo.yml that lists all the files that contain errors
|
data/lib/standard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -97,7 +97,6 @@ files:
|
|
97
97
|
- lib/standard/creates_config_store/configures_ignored_paths.rb
|
98
98
|
- lib/standard/creates_config_store/merges_user_config_extensions.rb
|
99
99
|
- lib/standard/creates_config_store/sets_target_ruby_version.rb
|
100
|
-
- lib/standard/detects_fixability.rb
|
101
100
|
- lib/standard/file_finder.rb
|
102
101
|
- lib/standard/formatter.rb
|
103
102
|
- lib/standard/loads_runner.rb
|
@@ -108,9 +107,9 @@ files:
|
|
108
107
|
- lib/standard/lsp/server.rb
|
109
108
|
- lib/standard/lsp/standardizer.rb
|
110
109
|
- lib/standard/merges_settings.rb
|
111
|
-
- lib/standard/parses_cli_option.rb
|
112
110
|
- lib/standard/railtie.rb
|
113
111
|
- lib/standard/rake.rb
|
112
|
+
- lib/standard/resolves_yaml_option.rb
|
114
113
|
- lib/standard/rubocop/ext.rb
|
115
114
|
- lib/standard/runners/genignore.rb
|
116
115
|
- lib/standard/runners/help.rb
|
@@ -139,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
138
|
- !ruby/object:Gem::Version
|
140
139
|
version: '0'
|
141
140
|
requirements: []
|
142
|
-
rubygems_version: 3.4.
|
141
|
+
rubygems_version: 3.4.10
|
143
142
|
signing_key:
|
144
143
|
specification_version: 4
|
145
144
|
summary: Ruby Style Guide, with linter & automatic code fixer
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Standard
|
2
|
-
class DetectsFixability
|
3
|
-
def call(offenses)
|
4
|
-
offenses.any? { |offense|
|
5
|
-
cop = cop_instance(offense.cop_name)
|
6
|
-
cop.correctable? && cop.safe_autocorrect?
|
7
|
-
}
|
8
|
-
end
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def cop_instance(cop_name)
|
13
|
-
RuboCop::Cop.const_get(cop_name.gsub("/", "::")).new
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|