Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RuboCop performance #544

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 161 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---

require: rubocop-packaging
require:
- rubocop-packaging
- rubocop-performance

AllCops:
DisabledByDefault: true
Expand All @@ -25,6 +27,164 @@ Layout/TrailingEmptyLines:
Layout/TrailingWhitespace:
Enabled: true

Performance:
Enabled: true

Performance/AncestorsInclude:
tagliala marked this conversation as resolved.
Show resolved Hide resolved
Enabled: false

Performance/ArraySemiInfiniteRangeSlice:
Enabled: false

Performance/BigDecimalWithNumericArgument:
Enabled: true

Performance/BindCall:
Enabled: true

Performance/BlockGivenWithExplicitBlock:
Enabled: true

Performance/Caller:
Enabled: true

Performance/CaseWhenSplat:
Enabled: true

Performance/Casecmp:
Enabled: false

Performance/ChainArrayAllocation:
Enabled: false

Performance/CollectionLiteralInLoop:
Enabled: true
Exclude:
- spec/**/*

Performance/CompareWithBlock:
Enabled: true

Performance/ConcurrentMonotonicTime:
Enabled: true

Performance/ConstantRegexp:
Enabled: true

Performance/Count:
Enabled: true

Performance/DeletePrefix:
Enabled: true

Performance/DeleteSuffix:
Enabled: true

Performance/Detect:
Enabled: true

Performance/DoubleStartEndWith:
Enabled: true
IncludeActiveSupportAliases: true

Performance/EndWith:
Enabled: true

Performance/FixedSize:
Enabled: true

Performance/FlatMap:
Enabled: true
EnabledForFlattenWithoutParams: false

Performance/InefficientHashSearch:
Enabled: true

Performance/IoReadlines:
Enabled: true

Performance/MapCompact:
Enabled: false

Performance/MapMethodChain:
Enabled: false

Performance/MethodObjectAsBlock:
Enabled: true

Performance/OpenStruct:
Enabled: true

Performance/RangeInclude:
Enabled: true

Performance/RedundantBlockCall:
Enabled: false

Performance/RedundantEqualityComparisonBlock:
Enabled: false

Performance/RedundantMatch:
Enabled: true

Performance/RedundantMerge:
Enabled: true
MaxKeyValuePairs: 2

Performance/RedundantSortBlock:
Enabled: true

Performance/RedundantSplitRegexpArgument:
Enabled: true

Performance/RedundantStringChars:
Enabled: true

Performance/RegexpMatch:
Enabled: true

Performance/ReverseEach:
Enabled: true

Performance/ReverseFirst:
Enabled: true

Performance/SelectMap:
Enabled: false

Performance/Size:
Enabled: true

Performance/SortReverse:
Enabled: true

Performance/Squeeze:
Enabled: true

Performance/StartWith:
Enabled: true

Performance/StringIdentifierArgument:
Enabled: true

Performance/StringInclude:
Enabled: true

Performance/StringReplacement:
Enabled: true

Performance/Sum:
Enabled: false

Performance/TimesMap:
Enabled: true

Performance/UnfreezeString:
Enabled: true

Performance/UriDefaultParser:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: true
Exclude:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ end
group :rubocop do
gem 'rubocop'
gem 'rubocop-packaging'
gem 'rubocop-performance'
end

group :rails do
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ GEM
parser (>= 3.2.1.0)
rubocop-packaging (0.5.2)
rubocop (>= 1.33, < 2.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
simplecov (0.22.0)
Expand Down Expand Up @@ -301,6 +304,7 @@ DEPENDENCIES
rspec-rails
rubocop
rubocop-packaging
rubocop-performance
simplecov
simplecov-cobertura

Expand Down
5 changes: 0 additions & 5 deletions gemfiles/rails_61/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ group :test do
gem 'pry'
end

group :rubocop do
gem 'rubocop'
gem 'rubocop-packaging'
end

group :rails do
gem 'rails', '~> 6.1.0'
gem 'rspec-rails'
Expand Down
30 changes: 0 additions & 30 deletions gemfiles/rails_61/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ GEM
zeitwerk (~> 2.3)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
base64 (0.1.1)
builder (3.2.4)
capybara (3.39.2)
addressable
Expand Down Expand Up @@ -98,9 +96,6 @@ GEM
activesupport (>= 6.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.3)
json (2.6.3-java)
language_server-protocol (3.17.0.3)
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -131,10 +126,6 @@ GEM
racc (~> 1.4)
nokogiri (1.15.4-java)
racc (~> 1.4)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand Down Expand Up @@ -176,7 +167,6 @@ GEM
method_source
rake (>= 12.2)
thor (~> 1.0)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.2)
rexml (3.2.6)
Expand All @@ -201,23 +191,6 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rubocop (1.57.1)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-packaging (0.5.2)
rubocop (>= 1.33, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
simplecov (0.22.0)
docile (~> 1.1)
Expand All @@ -241,7 +214,6 @@ GEM
timeout (0.4.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-driver (0.7.6-java)
Expand All @@ -264,8 +236,6 @@ DEPENDENCIES
rake
rspec
rspec-rails
rubocop
rubocop-packaging
simplecov
simplecov-cobertura

Expand Down
5 changes: 0 additions & 5 deletions gemfiles/rails_70/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ group :test do
gem 'pry'
end

group :rubocop do
gem 'rubocop'
gem 'rubocop-packaging'
end

group :rails do
gem 'rails', '~> 7.0.8'
gem 'rspec-rails'
Expand Down
30 changes: 0 additions & 30 deletions gemfiles/rails_70/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ GEM
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
base64 (0.1.1)
builder (3.2.4)
capybara (3.39.2)
addressable
Expand Down Expand Up @@ -104,9 +102,6 @@ GEM
activesupport (>= 6.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.3)
json (2.6.3-java)
language_server-protocol (3.17.0.3)
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -137,10 +132,6 @@ GEM
racc (~> 1.4)
nokogiri (1.15.4-java)
racc (~> 1.4)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand Down Expand Up @@ -182,7 +173,6 @@ GEM
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.2)
rexml (3.2.6)
Expand All @@ -207,23 +197,6 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rubocop (1.57.1)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-packaging (0.5.2)
rubocop (>= 1.33, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
simplecov (0.22.0)
docile (~> 1.1)
Expand All @@ -240,7 +213,6 @@ GEM
timeout (0.4.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-driver (0.7.6-java)
Expand All @@ -263,8 +235,6 @@ DEPENDENCIES
rake
rspec
rspec-rails
rubocop
rubocop-packaging
simplecov
simplecov-cobertura

Expand Down
2 changes: 1 addition & 1 deletion lib/arbre/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def initialize(assigns = {}, helpers = nil, &block)
@_current_arbre_element_buffer = [self]

super(self)
instance_eval(&block) if block_given?
instance_eval(&block) if block
end

def arbre_context
Expand Down
Loading