Skip to content

Commit ff37cba

Browse files
committed
Configure rubocop correctly
1 parent 97baa6a commit ff37cba

File tree

6 files changed

+80
-71
lines changed

6 files changed

+80
-71
lines changed

.rubocop.yml

Lines changed: 16 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,11 @@
1-
AllCops:
2-
TargetRubyVersion: 2.2
3-
4-
Metrics/ParameterLists:
5-
Max: 6
6-
CountKeywordArgs: true
7-
8-
Metrics/MethodLength:
9-
Max: 25
10-
CountComments: false
11-
12-
Metrics/AbcSize:
13-
Enabled: false
14-
15-
Metrics/ClassLength:
16-
Max: 300
17-
18-
Metrics/ModuleLength:
19-
Max: 300
20-
21-
Metrics/BlockLength:
22-
Max: 30
23-
24-
Metrics/CyclomaticComplexity:
25-
Max: 12
26-
27-
Metrics/PerceivedComplexity:
28-
Max: 15
29-
30-
BlockNesting:
31-
Max: 4
32-
33-
Metrics/LineLength:
34-
Enabled: false
1+
inherit_from: .rubocop_todo.yml
352

36-
AccessModifierIndentation:
37-
Enabled: false
38-
39-
Documentation:
40-
Enabled: false
3+
AllCops:
4+
TargetRubyVersion: 2.0
5+
DisabledByDefault: true
6+
Exclude:
7+
- spec/sandbox/**/*
8+
- spec/fixtures/**/*
419

4210
# Enforce Ruby 1.8-compatible hash syntax
4311
HashSyntax:
@@ -47,14 +15,6 @@ HashSyntax:
4715
SpaceInsideHashLiteralBraces:
4816
EnforcedStyle: no_space
4917

50-
# Allow dots at the end of lines
51-
DotPosition:
52-
Enabled: false
53-
54-
# Don't require magic comment at the top of every file
55-
Encoding:
56-
Enabled: false
57-
5818
# Enforce outdenting of access modifiers (i.e. public, private, protected)
5919
AccessModifierIndentation:
6020
EnforcedStyle: outdent
@@ -71,15 +31,9 @@ CaseIndentation:
7131
EnforcedStyle: end
7232
IndentOneStep: false
7333

74-
DoubleNegation:
75-
Enabled: false
76-
7734
StringLiterals:
7835
EnforcedStyle: double_quotes
7936

80-
Style/SymbolLiteral:
81-
Enabled: false
82-
8337
Lint/AssignmentInCondition:
8438
Exclude:
8539
- 'lib/thor/line_editor/readline.rb'
@@ -110,13 +64,13 @@ Lint/UnusedMethodArgument:
11064
- 'lib/thor/parser/arguments.rb'
11165
- 'lib/thor/shell/html.rb'
11266
- 'spec/actions/empty_directory_spec.rb'
67+
- 'spec/fixtures/invoke.thor'
11368

114-
Style/AccessorMethodName:
69+
Naming/AccessorMethodName:
11570
Exclude:
11671
- 'lib/thor/line_editor/basic.rb'
117-
118-
Style/Alias:
119-
Enabled: false
72+
- 'spec/fixtures/group.thor'
73+
- 'spec/sandbox/group.thor'
12074

12175
Style/ClassAndModuleChildren:
12276
Exclude:
@@ -130,7 +84,7 @@ Style/ClassVars:
13084
- 'lib/thor/util.rb'
13185
- 'spec/util_spec.rb'
13286

133-
Style/ConstantName:
87+
Naming/ConstantName:
13488
Exclude:
13589
- 'spec/line_editor_spec.rb'
13690

@@ -145,16 +99,15 @@ Style/GlobalVars:
14599
- 'spec/register_spec.rb'
146100
- 'spec/thor_spec.rb'
147101

148-
Style/IndentArray:
102+
Layout/IndentArray:
149103
EnforcedStyle: consistent
150104

151105
Style/MethodMissing:
152106
Exclude:
153107
- 'lib/thor/core_ext/hash_with_indifferent_access.rb'
154108
- 'lib/thor/runner.rb'
155-
156-
Style/MutableConstant:
157-
Enabled: false
109+
- 'spec/fixtures/script.thor'
110+
- 'spec/sandbox/script.thor'
158111

159112
Style/NumericLiteralPrefix:
160113
Exclude:
@@ -176,9 +129,6 @@ Style/TrailingUnderscoreVariable:
176129
Exclude:
177130
- 'lib/thor/group.rb'
178131

179-
Style/TrailingWhitespace:
132+
Layout/TrailingWhitespace:
180133
Exclude:
181134
- 'spec/shell/basic_spec.rb'
182-
183-
Style/AlignParameters:
184-
Enabled: false

.rubocop_todo.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2020-02-14 14:37:56 -0500 using RuboCop version 0.50.0.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 4
10+
# Cop supports --auto-correct.
11+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
12+
# SupportedStyles: outdent, indent
13+
Layout/AccessModifierIndentation:
14+
Exclude:
15+
- 'lib/thor/nested_context.rb'
16+
17+
# Offense count: 10
18+
# Cop supports --auto-correct.
19+
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
20+
# SupportedStyles: space, no_space, compact
21+
# SupportedStylesForEmptyBraces: space, no_space
22+
Layout/SpaceInsideHashLiteralBraces:
23+
Exclude:
24+
- 'lib/thor/actions/inject_into_file.rb'
25+
- 'spec/actions_spec.rb'
26+
- 'spec/command_spec.rb'
27+
28+
# Offense count: 1
29+
# Cop supports --auto-correct.
30+
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
31+
# SupportedStylesAlignWith: keyword, variable, start_of_line
32+
Lint/EndAlignment:
33+
Exclude:
34+
- 'lib/thor/error.rb'
35+
36+
# Offense count: 65
37+
# Cop supports --auto-correct.
38+
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
39+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
40+
Style/HashSyntax:
41+
Exclude:
42+
- 'lib/thor/actions/inject_into_file.rb'
43+
- 'spec/actions/inject_into_file_spec.rb'
44+
45+
# Offense count: 24
46+
# Cop supports --auto-correct.
47+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
48+
# SupportedStyles: single_quotes, double_quotes
49+
Style/StringLiterals:
50+
Exclude:
51+
- 'Gemfile'
52+
- 'lib/thor/actions.rb'
53+
- 'lib/thor/actions/inject_into_file.rb'
54+
- 'lib/thor/base.rb'
55+
- 'lib/thor/error.rb'
56+
- 'lib/thor/parser/option.rb'
57+
- 'lib/thor/shell/color.rb'
58+
- 'spec/parser/options_spec.rb'
59+
- 'spec/script_exit_status_spec.rb'

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ group :test do
1212
gem "coveralls", ">= 0.8.19"
1313
gem "rspec", ">= 3"
1414
gem "rspec-mocks", ">= 3"
15-
gem "rubocop", ">= 0.19"
15+
gem "rubocop", "~> 0.50.0"
1616
gem "simplecov", ">= 0.13"
1717
gem "webmock"
1818
end

lib/thor/error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Thor
2-
Correctable = if defined?(DidYouMean::SpellChecker) && defined?(DidYouMean::Correctable)
2+
Correctable = if defined?(DidYouMean::SpellChecker) && defined?(DidYouMean::Correctable) # rubocop:disable Naming/ConstantName
33
# In order to support versions of Ruby that don't have keyword
44
# arguments, we need our own spell checker class that doesn't take key
55
# words. Even though this code wouldn't be hit because of the check

spec/nested_context_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe Thor::NestedContext do
44
subject(:context) { described_class.new }
5-
5+
66
describe "#enter" do
77
it "is never empty within the entered block" do
88
context.enter do
@@ -17,4 +17,4 @@
1717
expect(context).not_to be_entered
1818
end
1919
end
20-
end
20+
end

spec/no_warnings_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
context "when $VERBOSE is enabled" do
44
it "prints no warnings" do
55
root = File.expand_path("..", __dir__)
6-
_, err, _ = Open3.capture3("ruby -I #{root}/lib #{root}/spec/fixtures/verbose.thor")
6+
_, err, = Open3.capture3("ruby -I #{root}/lib #{root}/spec/fixtures/verbose.thor")
77

88
expect(err).to be_empty
99
end

0 commit comments

Comments
 (0)