Skip to content

Commit ece1c4e

Browse files
authored
Code modernization via Rubocop (#2308)
* Address Lint/AmbiguousBlockAssociation * Address Lint/AmbiguousOperator * Address Lint/AmbiguousRegexpLiteral * Address Lint/EmptyWhen * Address Lint/LiteralAsCondition * Address Lint/MissingSuper * Address Lint/RedundantRequireStatement * Address Lint/RedundantSplatExpansion * Address Lint/RedundantWithObject * Address Lint/SuppressedException * Address Lint/UnderscorePrefixedVariableName * Address Lint/UnusedBlockArgument * Address Lint/UselessAssignment * Address Style/AndOr * Address Style/CommandLiteral * Address Style/CommentAnnotation * Address Style/ConditionalAssignment * Address Style/Dir * Address Style/DoubleNegation * Address Style/EachWithObject * Address Style/EmptyLiteral * Address Style/EmptyMethod * Address Style/Encoding * Address Style/EvalWithLocation * Address Style/ExpandPathArguments * Address Style/ExplicitBlockArgument * Address Style/For * Address Style/HashAsLastArrayItem * Address Style/HashEachMethods * Address Style/HashLikeCase * Address Style/HashTransformValues * Address Style/IdenticalConditionalBranches * Address Style/InverseMethods * Address Style/LineEndConcatenation * Address MethodCallWithoutArgsParentheses * Address Style/MinMax * Address Style/Next * Address Style/Not * Address Style/NumericLiteralPrefix * Address Style/NumericLiterals * Address Style/OrAssignment * Address Style/PercentLiteralDelimiters * Address Style/Proc * Address Style/RedundantAssignment * Address Style/RedundantBegin * Address Style/RedundantCapitalW * Address Style/RedundantFreeze * Address Style/RedundantInterpolation * Address Style/RedundantParentheses * Address Style/RedundantRegexpEscape * Address Style/RedundantReturn * Address Style/SafeNavigation * Address Style/SymbolProc * Address Style/TernaryParentheses * Address Style/TrailingCommaInArguments * Address Style/TrailingCommaInArrayLiteral * Address Style/TrailingUnderscoreVariable * Address Style/WhileUntilModifier * Address Style/YodaCondition * Address Style/StringLiterals * Address Layout/SpaceBeforeBlockBraces * Address Layout/SpaceAroundEqualsInParameterDefault * Address Layout/SpaceAfterComma * Address Style/HashSyntax directly * Checkpoint: Update rubocop config
1 parent 3e3a1d7 commit ece1c4e

File tree

257 files changed

+6237
-6220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+6237
-6220
lines changed

.rubocop.yml

Lines changed: 116 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2,93 +2,123 @@ require:
22
- rubocop-minitest
33

44
AllCops:
5-
NewCops: disable
5+
TargetRubyVersion: 2.7
6+
# DisabledByDefault: true
67

7-
Metrics:
8-
Enabled: false
9-
Naming:
10-
Enabled: false
11-
Layout:
12-
Enabled: false
13-
Lint/AssignmentInCondition:
14-
Enabled: false
15-
Lint/UnusedMethodArgument:
16-
Enabled: false
17-
Style/AccessorGrouping:
18-
Enabled: false
19-
Style/Alias:
20-
Enabled: false
21-
Style/ArrayJoin:
22-
Enabled: false
23-
Style/BlockDelimiters:
24-
Enabled: false
25-
Style/CharacterLiteral:
26-
Enabled: false
27-
Style/ClassAndModuleChildren:
28-
Enabled: false
29-
Style/ClassCheck:
30-
Enabled: false
31-
Style/ClassVars:
32-
Enabled: false
33-
Style/CommentedKeyword:
34-
Enabled: false
35-
Style/Documentation:
36-
Enabled: false
37-
Style/EmptyCaseCondition:
38-
Enabled: false
39-
Style/FormatString:
40-
Enabled: false
41-
Style/FormatStringToken:
42-
Enabled: false
43-
Style/FrozenStringLiteralComment:
44-
Enabled: false
45-
Style/GuardClause:
46-
Enabled: false
47-
Style/HashSyntax:
48-
Enabled: false
49-
Style/IfInsideElse:
50-
Enabled: false
51-
Style/IfUnlessModifier:
52-
Enabled: false
53-
Style/IfUnlessModifierOfIfUnless:
54-
Enabled: false
55-
Style/MultilineIfModifier:
56-
Enabled: false
57-
Style/MultilineTernaryOperator:
58-
Enabled: false
59-
Style/NestedTernaryOperator:
60-
Enabled: false
61-
Style/MutableConstant:
62-
Enabled: false
63-
Style/NumericPredicate:
64-
Enabled: false
65-
Style/ParallelAssignment:
66-
Enabled: false
67-
Style/PreferredHashMethods:
68-
Enabled: false
69-
Style/RedundantSelf:
70-
Enabled: false
71-
Style/RegexpLiteral:
72-
Enabled: false
73-
Style/Semicolon:
74-
Enabled: false
75-
Style/SignalException:
76-
Enabled: false
77-
Style/SingleLineMethods:
78-
Enabled: false
79-
Style/SoleNestedConditional:
80-
Enabled: false
81-
Style/StringConcatenation:
82-
Enabled: false
83-
Style/StringLiterals:
84-
Enabled: false
85-
Style/StringLiteralsInInterpolation:
86-
Enabled: false
87-
Style/SymbolArray:
88-
Enabled: false
89-
Style/TrailingCommaInHashLiteral:
8+
# Style/HashSyntax:
9+
# Enabled: true
10+
11+
## Custom settings according to the current codebase
12+
Lint/MissingSuper:
13+
AllowedParentClasses:
14+
- Rackup::Server
15+
16+
17+
## Won't change without breaking changes or major refactoring
18+
Style/OptionalBooleanParameter:
9019
Enabled: false
91-
Style/WordArray:
20+
21+
Style/RescueModifier:
9222
Enabled: false
93-
Style/ZeroLengthPredicate:
23+
24+
Style/StderrPuts:
9425
Enabled: false
26+
27+
28+
## It's not really necessary to address about these
29+
Style/ModuleFunction:
30+
Severity: warning
31+
32+
Style/MultipleComparison:
33+
Severity: warning
34+
35+
Style/RescueStandardError:
36+
Severity: warning
37+
38+
Style/SpecialGlobalVars:
39+
Severity: warning
40+
41+
42+
## We should address these eventually
43+
Style/CaseEquality:
44+
Exclude:
45+
- padrino-core/lib/padrino-core/filter.rb
46+
- padrino-core/lib/padrino-core/path_router/compiler.rb
47+
48+
Style/CombinableLoops:
49+
Exclude:
50+
- padrino-gen/lib/padrino-gen/padrino-tasks/mongoid.rb
51+
52+
Style/Encoding:
53+
Exclude:
54+
- padrino-admin/padrino-admin.gemspec
55+
- padrino-cache/padrino-cache.gemspec
56+
- padrino-gen/lib/padrino-gen/generators/project/config.ru
57+
- padrino-gen/padrino-gen.gemspec
58+
- padrino-helpers/padrino-helpers.gemspec
59+
- padrino-mailer/padrino-mailer.gemspec
60+
- padrino-performance/padrino-performance.gemspec
61+
- padrino-support/padrino-support.gemspec
62+
- padrino/padrino.gemspec
63+
64+
Style/EvalWithLocation:
65+
Exclude:
66+
- padrino-core/lib/padrino-core/cli/base.rb
67+
68+
Lint/SendWithMixinArgument:
69+
Exclude:
70+
- padrino-performance/lib/suites/json.rb
71+
72+
Lint/ScriptPermission:
73+
Exclude:
74+
- padrino-admin/padrino-admin.gemspec
75+
- padrino-cache/padrino-cache.gemspec
76+
- padrino-gen/lib/padrino-gen/generators/project/config.ru
77+
- padrino-gen/padrino-gen.gemspec
78+
- padrino-helpers/padrino-helpers.gemspec
79+
- padrino-mailer/padrino-mailer.gemspec
80+
- padrino-performance/padrino-performance.gemspec
81+
- padrino-support/padrino-support.gemspec
82+
- padrino/padrino.gemspec
83+
84+
Lint/RescueException:
85+
Exclude:
86+
- padrino-core/lib/padrino-core/application/routing.rb
87+
- padrino-core/lib/padrino-core/loader.rb
88+
- padrino-core/lib/padrino-core/reloader.rb
89+
90+
Lint/IneffectiveAccessModifier:
91+
Exclude:
92+
- padrino-core/lib/padrino-core/cli/base.rb
93+
- padrino-core/lib/padrino-core/cli/launcher.rb
94+
- padrino-helpers/lib/padrino-helpers/form_builder/abstract_form_builder.rb
95+
96+
Lint/ShadowedException:
97+
Exclude:
98+
- padrino-core/lib/padrino-core/cli/binstub.rb
99+
100+
Lint/UselessMethodDefinition:
101+
Exclude:
102+
- padrino-core/test/fixtures/apps/mountable_apps/rack_apps.rb
103+
104+
105+
## Tests exclusions
106+
Naming/FileName:
107+
Exclude:
108+
- '**/test/**/*'
109+
110+
Style/GlobalVars:
111+
Exclude:
112+
- '**/test/**/*'
113+
114+
Lint/RaiseException:
115+
Exclude:
116+
- '**/test/**/*'
117+
118+
Lint/EmptyFile:
119+
Exclude:
120+
- '**/test/**/*'
121+
122+
Lint/ConstantDefinitionInBlock:
123+
Exclude:
124+
- '**/test/**/*'

Gemfile

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,65 @@ require File.expand_path('padrino-core/lib/padrino-core/version.rb', __dir__)
22

33
source 'https://rubygems.org'
44

5-
if ENV["AS_VERSION"]
5+
if ENV['AS_VERSION']
66
gem 'activesupport', "~> #{ENV['AS_VERSION']}"
77
end
88

99
group :db do
10-
gem "jdbc-sqlite3", "~> 3.7.2", :platform => :jruby
11-
gem "sequel"
12-
gem "sqlite3", :platforms => [:mri]
10+
gem 'jdbc-sqlite3', '~> 3.7.2', platform: :jruby
11+
gem 'sequel'
12+
gem 'sqlite3', platforms: [:mri]
1313
end
1414

1515
group :development do
16-
if ENV["SINATRA_VERSION"]
16+
if ENV['SINATRA_VERSION']
1717
puts "=> Using Sinatra version ~> #{ENV['SINATRA_VERSION']}"
18-
gem "sinatra", "~> #{ENV['SINATRA_VERSION']}"
18+
gem 'sinatra', "~> #{ENV['SINATRA_VERSION']}"
1919
elsif ENV['SINATRA_EDGE']
20-
puts "=> Using sinatra edge"
21-
gem "sinatra", :git => "git://github.com/sinatra/sinatra.git"
20+
puts '=> Using sinatra edge'
21+
gem 'sinatra', git: 'git://github.com/sinatra/sinatra.git'
2222
end
2323

24-
gem "liquid", ">= 2.1.1"
25-
gem "slim", ">= 1.3.0"
24+
gem 'liquid', '>= 2.1.1'
25+
gem 'slim', '>= 1.3.0'
2626

2727
if ENV['HAML_ENGINE'] == 'hamlit'
28-
puts "=> Using Hamlit Haml engine"
29-
gem "hamlit"
28+
puts '=> Using Hamlit Haml engine'
29+
gem 'hamlit'
3030
else
31-
gem "haml", "~> 5"
31+
gem 'haml', '~> 5'
3232
end
3333

3434
case ENV['ERB_ENGINE']
35-
when "stdlib"
36-
puts "=> Using stdlib ERB engine"
37-
when "erubis"
38-
puts "=> Using Erubis ERB engine"
39-
gem "erubis", ">= 2.7.0"
35+
when 'stdlib'
36+
puts '=> Using stdlib ERB engine'
37+
when 'erubis'
38+
puts '=> Using Erubis ERB engine'
39+
gem 'erubis', '>= 2.7.0'
4040
else
41-
gem "erubi", ">= 1.6.1"
41+
gem 'erubi', '>= 1.6.1'
4242
end
4343

44-
gem "builder", ">= 2.1.2"
45-
gem "minitest", ">= 4.0"
46-
gem "mocha", ">= 2.0"
47-
gem "oga", ">= 2.5", "< 3"
48-
gem "rack", "~> 3"
49-
gem "rackup", "~> 2.1"
50-
gem "rack-test", "~> 2.1"
51-
gem "rake", ">= 10.5.0"
44+
gem 'builder', '>= 2.1.2'
45+
gem 'minitest', '>= 4.0'
46+
gem 'mocha', '>= 2.0'
47+
gem 'oga', '>= 2.5', '< 3'
48+
gem 'rack', '~> 3'
49+
gem 'rackup', '~> 2.1'
50+
gem 'rack-test', '~> 2.1'
51+
gem 'rake', '>= 10.5.0'
5252
gem 'rb-readline', '~> 0.4.2'
53-
gem 'rubocop', '~> 1.6', :platforms => [:mri]
54-
gem 'rubocop-minitest', '~>0.34.4', :platforms => [:mri]
55-
gem "webmock", "~> 3.19"
56-
gem "yard", ">= 0.7.2"
53+
gem 'rubocop', '~> 1.6', platforms: [:mri]
54+
gem 'rubocop-minitest', '~>0.34.4', platforms: [:mri]
55+
gem 'webmock', '~> 3.19'
56+
gem 'yard', '>= 0.7.2'
5757

5858
platforms :jruby do
59-
gem "jruby-openssl"
59+
gem 'jruby-openssl'
6060
end
6161
end
6262

6363
load File.expand_path('padrino/subgems.rb', __dir__)
6464
PADRINO_GEMS.each_key do |name|
65-
gem name, :path => File.expand_path('../' + name, __FILE__)
65+
gem name, path: File.expand_path('../' + name, __FILE__)
6666
end

0 commit comments

Comments
 (0)