From ca50786a16a2c4e9dc5a4aa498b88c6864df6b45 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:00:00 +0000 Subject: [PATCH 1/3] build(deps): bump rexml from 3.3.5 to 3.3.6 Bumps [rexml](https://github.com/ruby/rexml) from 3.3.5 to 3.3.6. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.3.5...v3.3.6) --- updated-dependencies: - dependency-name: rexml dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 95b28424..810589be 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -231,7 +231,7 @@ GEM regexp_parser (2.9.2) reline (0.5.9) io-console (~> 0.5) - rexml (3.3.5) + rexml (3.3.6) strscan rollbar (3.5.2) rubocop (1.65.1) From fb76c1df0d04399277cb18cf1ff2160b9760771f Mon Sep 17 00:00:00 2001 From: stefanvacareanu7 <91726880+stefanvacareanu7@users.noreply.github.com> Date: Wed, 23 Oct 2024 08:56:00 +0300 Subject: [PATCH 2/3] Update config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e53cf360..f40d8cab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: codacy: codacy/base@12.1.3 - codacy_plugins_test: codacy/plugins-test@1.1.1 + codacy_plugins_test: codacy/plugins-test@2.0.11 workflows: version: 2 From ec9e65c4d409fc70a9ec9a43c85efc2f09cbc282 Mon Sep 17 00:00:00 2001 From: Stefan Vacareanu Date: Wed, 23 Oct 2024 11:11:49 +0300 Subject: [PATCH 3/3] update docs --- Gemfile.lock | 98 +++---- doc_generation/codacy/rubocop/generator.rb | 12 + docs/description/Layout_BlockAlignment.md | 2 +- .../Layout_FirstArrayElementIndentation.md | 3 - docs/description/Layout_LineLength.md | 28 +- docs/description/Lint_UselessAssignment.md | 5 + .../Lint_UselessNumericOperation.md | 31 ++ docs/description/Metrics_BlockLength.md | 9 +- docs/description/Metrics_ClassLength.md | 9 +- docs/description/Metrics_MethodLength.md | 9 +- docs/description/Metrics_ModuleLength.md | 9 +- docs/description/Naming_PredicateName.md | 2 +- ...rformance_BigDecimalWithNumericArgument.md | 20 +- ...Performance_BlockGivenWithExplicitBlock.md | 3 + .../RSpec_StringAsInstanceDoubleConstant.md | 14 + docs/description/Rails_ApplicationRecord.md | 4 + docs/description/Rails_CompactBlank.md | 8 +- docs/description/Rails_Date.md | 4 +- docs/description/Rails_EnumHash.md | 6 + docs/description/Rails_EnumSyntax.md | 17 ++ docs/description/Rails_EnumUniqueness.md | 12 + docs/description/Rails_PluckInWhere.md | 9 +- .../description/Rails_PluralizationGrammar.md | 4 + docs/description/Rails_RootPathnameMethods.md | 3 + docs/description/Rails_WhereEquals.md | 5 +- docs/description/Sorbet_Refinement.md | 33 +++ docs/description/Style_EmptyLiteral.md | 2 + docs/description/Style_FormatStringToken.md | 4 +- .../Style_MethodCallWithoutArgsParentheses.md | 4 +- docs/description/Style_NumericPredicate.md | 4 +- .../Style_RedundantInterpolationUnfreeze.md | 20 ++ docs/description/Style_SafeNavigation.md | 4 +- docs/description/description.json | 60 +++- docs/patterns.json | 274 ++++++++++++++++-- 34 files changed, 589 insertions(+), 142 deletions(-) create mode 100644 docs/description/Lint_UselessNumericOperation.md create mode 100644 docs/description/RSpec_StringAsInstanceDoubleConstant.md create mode 100644 docs/description/Rails_EnumSyntax.md create mode 100644 docs/description/Sorbet_Refinement.md create mode 100644 docs/description/Style_RedundantInterpolationUnfreeze.md diff --git a/Gemfile.lock b/Gemfile.lock index 56655ddb..af4c671d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -99,13 +99,13 @@ GEM docile (1.4.1) drb (2.2.1) erubi (1.13.0) - faker (3.4.2) + faker (3.5.1) i18n (>= 1.8.11, < 2) fiber-storage (1.0.0) git_diff_parser (3.2.0) globalid (1.2.1) activesupport (>= 6.1) - graphql (2.3.14) + graphql (2.3.18) base64 fiber-storage haml (6.3.0) @@ -114,15 +114,15 @@ GEM tilt i18n (1.14.6) concurrent-ruby (~> 1.0) - importmap-rails (2.0.1) + importmap-rails (2.0.3) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.7.2) - irb (1.14.0) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) - jbuilder (2.12.0) + jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) json (2.7.2) @@ -144,8 +144,8 @@ GEM minitest (5.25.1) mocha (2.4.5) ruby2_keywords (>= 0.0.5) - msgpack (1.7.2) - net-imap (0.4.14) + msgpack (1.7.3) + net-imap (0.5.0) date net-protocol net-pop (0.1.2) @@ -168,7 +168,7 @@ GEM nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) parallel (1.26.3) - parser (3.3.4.2) + parser (3.3.5.0) ast (~> 2.4.1) racc prettier (4.0.4) @@ -224,28 +224,26 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rbs (3.5.2) + rbs (3.6.1) logger rdoc (6.7.0) psych (>= 4.0.0) regexp_parser (2.9.2) - reline (0.5.9) + reline (0.5.10) io-console (~> 0.5) - rexml (3.3.6) - strscan - rollbar (3.5.2) - rubocop (1.65.1) + rexml (3.3.8) + rollbar (3.6.0) + rubocop (1.66.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.1) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) rubocop-capybara (2.21.0) rubocop (~> 1.41) @@ -254,33 +252,33 @@ GEM rubocop (>= 1.0) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) - rubocop-faker (1.1.0) + rubocop-faker (1.2.0) faker (>= 2.12.0) - rubocop (>= 0.82.0) + rubocop (>= 1.13.0) rubocop-graphql (1.5.4) rubocop (>= 1.50, < 2) rubocop-i18n (3.0.0) rubocop (~> 1.0) - rubocop-md (1.2.2) - rubocop (>= 1.0) + rubocop-md (1.2.4) + rubocop (>= 1.45) rubocop-mdsol (0.3.0) rubocop (~> 1.0) rubocop-migrations (0.1.0) rubocop (>= 0.42.0) - rubocop-minitest (0.35.1) + rubocop-minitest (0.36.0) rubocop (>= 1.61, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-performance (1.21.1) + rubocop-performance (1.22.1) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.25.1) + rubocop-rails (2.26.2) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) + rubocop (>= 1.52.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (3.0.4) + rubocop-rspec (3.1.0) rubocop (~> 1.61) rubocop-rspec_rails (2.30.0) rubocop (~> 1.61) @@ -289,7 +287,7 @@ GEM rubocop (~> 1.0) rubocop-shopify (2.15.1) rubocop (~> 1.51) - rubocop-sorbet (0.8.5) + rubocop-sorbet (0.8.6) rubocop (>= 1) rubocop-thread_safety (0.5.1) rubocop (>= 0.90.0) @@ -301,7 +299,7 @@ GEM mail (~> 2.0) version_gem (~> 1.1, >= 1.1.4) securerandom (0.3.1) - selenium-webdriver (4.23.0) + selenium-webdriver (4.25.0) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) @@ -314,7 +312,7 @@ GEM simplecov-cobertura (2.1.0) rexml simplecov (~> 0.19) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) sprockets (4.2.1) concurrent-ruby (~> 1.0) @@ -323,32 +321,31 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (2.0.4-aarch64-linux-gnu) - sqlite3 (2.0.4-aarch64-linux-musl) - sqlite3 (2.0.4-arm-linux-gnu) - sqlite3 (2.0.4-arm-linux-musl) - sqlite3 (2.0.4-arm64-darwin) - sqlite3 (2.0.4-x86-linux-gnu) - sqlite3 (2.0.4-x86-linux-musl) - sqlite3 (2.0.4-x86_64-darwin) - sqlite3 (2.0.4-x86_64-linux-gnu) - sqlite3 (2.0.4-x86_64-linux-musl) - standard (1.40.0) + sqlite3 (2.1.1-aarch64-linux-gnu) + sqlite3 (2.1.1-aarch64-linux-musl) + sqlite3 (2.1.1-arm-linux-gnu) + sqlite3 (2.1.1-arm-linux-musl) + sqlite3 (2.1.1-arm64-darwin) + sqlite3 (2.1.1-x86-linux-gnu) + sqlite3 (2.1.1-x86-linux-musl) + sqlite3 (2.1.1-x86_64-darwin) + sqlite3 (2.1.1-x86_64-linux-gnu) + sqlite3 (2.1.1-x86_64-linux-musl) + standard (1.41.1) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.65.0) + rubocop (~> 1.66.0) standard-custom (~> 1.0.0) - standard-performance (~> 1.4) + standard-performance (~> 1.5) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) - standard-performance (1.4.0) + standard-performance (1.5.0) lint_roller (~> 1.1) - rubocop-performance (~> 1.21.0) + rubocop-performance (~> 1.22.0) stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.1) - strscan (3.1.0) syntax_tree (6.2.0) prettier_print (>= 1.2.0) syntax_tree-haml (4.0.3) @@ -360,16 +357,15 @@ GEM rbs syntax_tree (>= 2.0.1) temple (0.10.3) - thor (1.3.1) + thor (1.3.2) tilt (2.4.0) timeout (0.4.1) - turbo-rails (2.0.6) + turbo-rails (2.0.11) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) useragent (0.16.10) version_gem (1.1.4) web-console (4.2.1) @@ -384,8 +380,8 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.36) - zeitwerk (2.6.17) + yard (0.9.37) + zeitwerk (2.7.1) PLATFORMS aarch64-linux diff --git a/doc_generation/codacy/rubocop/generator.rb b/doc_generation/codacy/rubocop/generator.rb index a0ba6685..1b8a408b 100755 --- a/doc_generation/codacy/rubocop/generator.rb +++ b/doc_generation/codacy/rubocop/generator.rb @@ -79,6 +79,18 @@ def self.run(baseDir = ".", file_path = "rubocop-doc.yml") fallbackTitle = cop_data[:name].split('/')[1].split(/(?=[A-Z])/).join(" ") title = descriptionObj.nil? ? fallbackTitle : get_title(descriptionObj) description = descriptionObj.nil? ? fallbackTitle : descriptionObj + max_length = 500 + + while description.length > max_length + cutoff_point = description[0...max_length].rindex(".") + if cutoff_point.nil? + puts "No period found within the limit. Truncating to max_length." + break + else + description = description[0..cutoff_point] + end + end + GenerationCommons.withoutNilValues({ patternId: cop_data[:name].gsub("/", "_"), title: title, diff --git a/docs/description/Layout_BlockAlignment.md b/docs/description/Layout_BlockAlignment.md index a2ac6dc6..2ad9a5a7 100644 --- a/docs/description/Layout_BlockAlignment.md +++ b/docs/description/Layout_BlockAlignment.md @@ -12,7 +12,7 @@ start of the line where the `do` appeared. start of the line where the expression started. `either` (which is the default) : the `end` is allowed to be in either -location. The autofixer will default to `start_of_line`. +location. The autocorrect will default to `start_of_line`. # Examples diff --git a/docs/description/Layout_FirstArrayElementIndentation.md b/docs/description/Layout_FirstArrayElementIndentation.md index d38a34ac..1e29c29f 100644 --- a/docs/description/Layout_FirstArrayElementIndentation.md +++ b/docs/description/Layout_FirstArrayElementIndentation.md @@ -46,7 +46,6 @@ but_in_a_method_call([ # defined inside a method call. # bad -# consistent array = [ :value ] @@ -64,13 +63,11 @@ and_in_a_method_call([ # brackets are indented to the same position. # bad -# align_brackets and_now_for_something = [ :completely_different ] # good -# align_brackets and_now_for_something = [ :completely_different ] diff --git a/docs/description/Layout_LineLength.md b/docs/description/Layout_LineLength.md index 4997cea2..74f05b9c 100644 --- a/docs/description/Layout_LineLength.md +++ b/docs/description/Layout_LineLength.md @@ -19,20 +19,20 @@ are recommended to further format the broken lines. * `Layout/ArrayAlignment` * `Layout/BlockAlignment` * `Layout/BlockEndNewline` -* `LayoutClosingParenthesisIndentation` -* `LayoutFirstArgumentIndentation` -* `LayoutFirstArrayElementIndentation` -* `LayoutFirstHashElementIndentation` -* `LayoutFirstParameterIndentation` -* `LayoutHashAlignment` -* `LayoutIndentationWidth` -* `LayoutMultilineArrayLineBreaks` -* `LayoutMultilineBlockLayout` -* `LayoutMultilineHashBraceLayout` -* `LayoutMultilineHashKeyLineBreaks` -* `LayoutMultilineMethodArgumentLineBreaks` -* `LayoutMultilineMethodParameterLineBreaks` -* `Layout/ParameterAlignment` +* `Layout/ClosingParenthesisIndentation` +* `Layout/FirstArgumentIndentation` +* `Layout/FirstArrayElementIndentation` +* `Layout/FirstHashElementIndentation` +* `Layout/FirstParameterIndentation` +* `Layout/HashAlignment` +* `Layout/IndentationWidth` +* `Layout/MultilineArrayLineBreaks` +* `Layout/MultilineBlockLayout` +* `Layout/MultilineHashBraceLayout` +* `Layout/MultilineHashKeyLineBreaks` +* `Layout/MultilineMethodArgumentLineBreaks` +* `Layout/MultilineMethodParameterLineBreaks` +* `Layout//ParameterAlignment` * `Style/BlockDelimiters` Together, these cops will pretty print hashes, arrays, diff --git a/docs/description/Lint_UselessAssignment.md b/docs/description/Lint_UselessAssignment.md index 13f105ab..d7fd201c 100644 --- a/docs/description/Lint_UselessAssignment.md +++ b/docs/description/Lint_UselessAssignment.md @@ -12,6 +12,11 @@ Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc. +This cop's autocorrection avoids cases like `a ||= 1` because removing assignment from +operator assignment can cause NameError if this assignment has been used to declare +a local variable. For example, replacing `a ||= 1` with `a || 1` may cause +"undefined local variable or method `a' for main:Object (NameError)". + NOTE: Given the assignment `foo = 1, bar = 2`, removing unused variables can lead to a syntax error, so this case is not autocorrected. diff --git a/docs/description/Lint_UselessNumericOperation.md b/docs/description/Lint_UselessNumericOperation.md new file mode 100644 index 00000000..70e341a9 --- /dev/null +++ b/docs/description/Lint_UselessNumericOperation.md @@ -0,0 +1,31 @@ + +Certain numeric operations have no impact, being: +Adding or subtracting 0, multiplying or dividing by 1 or raising to the power of 1. +These are probably leftover from debugging, or are mistakes. + +# Examples + +```ruby + +# bad +x + 0 +x - 0 +x * 1 +x / 1 +x ** 1 + +# good +x + +# bad +x += 0 +x -= 0 +x *= 1 +x /= 1 +x **= 1 + +# good +x = x +``` + +[Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Lint/UselessNumericOperation) \ No newline at end of file diff --git a/docs/description/Metrics_BlockLength.md b/docs/description/Metrics_BlockLength.md index 29862d6a..5d77f92b 100644 --- a/docs/description/Metrics_BlockLength.md +++ b/docs/description/Metrics_BlockLength.md @@ -5,8 +5,9 @@ The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods. You can set constructs you want to fold with `CountAsOne`. -Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct -will be counted as one line regardless of its actual size. + +Available are: 'array', 'hash', 'heredoc', and 'method_call'. +Each construct will be counted as one line regardless of its actual size. NOTE: This cop does not apply for `Struct` definitions. @@ -24,7 +25,7 @@ something do 2 ] - hash = { # +3 + hash = { # +1 key: 'value' } @@ -37,7 +38,7 @@ something do 1, 2 ) -end # 6 points +end # 4 points ``` [Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/BlockLength) \ No newline at end of file diff --git a/docs/description/Metrics_ClassLength.md b/docs/description/Metrics_ClassLength.md index 41719a56..066937f2 100644 --- a/docs/description/Metrics_ClassLength.md +++ b/docs/description/Metrics_ClassLength.md @@ -4,8 +4,9 @@ Comment lines can optionally be ignored. The maximum allowed length is configurable. You can set constructs you want to fold with `CountAsOne`. -Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct -will be counted as one line regardless of its actual size. + +Available are: 'array', 'hash', 'heredoc', and 'method_call'. +Each construct will be counted as one line regardless of its actual size. NOTE: This cop also applies for `Struct` definitions. @@ -19,7 +20,7 @@ class Foo 2 ] - HASH = { # +3 + HASH = { # +1 key: 'value' } @@ -32,7 +33,7 @@ class Foo 1, 2 ) -end # 6 points +end # 4 points ``` [Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/ClassLength) \ No newline at end of file diff --git a/docs/description/Metrics_MethodLength.md b/docs/description/Metrics_MethodLength.md index 4dbe7b88..2d0f619e 100644 --- a/docs/description/Metrics_MethodLength.md +++ b/docs/description/Metrics_MethodLength.md @@ -4,8 +4,9 @@ Comment lines can optionally be allowed. The maximum allowed length is configurable. You can set constructs you want to fold with `CountAsOne`. -Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct -will be counted as one line regardless of its actual size. + +Available are: 'array', 'hash', 'heredoc', and 'method_call'. +Each construct will be counted as one line regardless of its actual size. NOTE: The `ExcludedMethods` and `IgnoredMethods` configuration is deprecated and only kept for backwards compatibility. @@ -22,7 +23,7 @@ def m 2 ] - hash = { # +3 + hash = { # +1 key: 'value' } @@ -35,7 +36,7 @@ def m 1, 2 ) -end # 6 points +end # 4 points ``` [Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/MethodLength) \ No newline at end of file diff --git a/docs/description/Metrics_ModuleLength.md b/docs/description/Metrics_ModuleLength.md index 46eaf59f..4327fc52 100644 --- a/docs/description/Metrics_ModuleLength.md +++ b/docs/description/Metrics_ModuleLength.md @@ -4,8 +4,9 @@ Comment lines can optionally be ignored. The maximum allowed length is configurable. You can set constructs you want to fold with `CountAsOne`. -Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct -will be counted as one line regardless of its actual size. + +Available are: 'array', 'hash', 'heredoc', and 'method_call'. +Each construct will be counted as one line regardless of its actual size. # Examples @@ -17,7 +18,7 @@ module M 2 ] - HASH = { # +3 + HASH = { # +1 key: 'value' } @@ -30,7 +31,7 @@ module M 1, 2 ) -end # 6 points +end # 4 points ``` [Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/ModuleLength) \ No newline at end of file diff --git a/docs/description/Naming_PredicateName.md b/docs/description/Naming_PredicateName.md index 34e4bbfc..42b68abd 100644 --- a/docs/description/Naming_PredicateName.md +++ b/docs/description/Naming_PredicateName.md @@ -53,7 +53,7 @@ define_method(:even?) { |value| }# bad def_node_matcher(:is_even) { |value| } # good -# def_node_matcher(:even?) { |value| } +def_node_matcher(:even?) { |value| } ``` [Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Naming/PredicateName) \ No newline at end of file diff --git a/docs/description/Performance_BigDecimalWithNumericArgument.md b/docs/description/Performance_BigDecimalWithNumericArgument.md index 47b4c055..05980ed3 100644 --- a/docs/description/Performance_BigDecimalWithNumericArgument.md +++ b/docs/description/Performance_BigDecimalWithNumericArgument.md @@ -1,22 +1,28 @@ -Identifies places where numeric argument to BigDecimal should be -converted to string. Initializing from String is faster -than from Numeric for BigDecimal. +Identifies places where a float argument to BigDecimal should be converted to a string. +Initializing from String is faster than from Float for BigDecimal. + +Also identifies places where an integer string argument to BigDecimal should be converted to +an integer. Initializing from Integer is faster than from String for BigDecimal. # Examples ```ruby # bad -BigDecimal(1, 2) -4.to_d(6) BigDecimal(1.2, 3, exception: true) 4.5.to_d(6, exception: true) # good -BigDecimal('1', 2) -BigDecimal('4', 6) BigDecimal('1.2', 3, exception: true) BigDecimal('4.5', 6, exception: true) + +# bad +BigDecimal('1', 2) +BigDecimal('4', 6) + +# good +BigDecimal(1, 2) +4.to_d(6) ``` [Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Performance/BigDecimalWithNumericArgument) \ No newline at end of file diff --git a/docs/description/Performance_BlockGivenWithExplicitBlock.md b/docs/description/Performance_BlockGivenWithExplicitBlock.md index 24e7040c..77d1e78b 100644 --- a/docs/description/Performance_BlockGivenWithExplicitBlock.md +++ b/docs/description/Performance_BlockGivenWithExplicitBlock.md @@ -2,6 +2,9 @@ Identifies unnecessary use of a `block_given?` where explicit check of block argument would suffice. +NOTE: This cop produces code with significantly worse performance when a +block is being passed to the method and as such should not be enabled. + # Examples ```ruby diff --git a/docs/description/RSpec_StringAsInstanceDoubleConstant.md b/docs/description/RSpec_StringAsInstanceDoubleConstant.md new file mode 100644 index 00000000..14cc514e --- /dev/null +++ b/docs/description/RSpec_StringAsInstanceDoubleConstant.md @@ -0,0 +1,14 @@ + +Do not use a string as `instance_double` constant. + +# Examples + +```ruby +# bad +instance_double('User', name: 'John') + +# good +instance_double(User, name: 'John') +``` + +[Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/RSpec/StringAsInstanceDoubleConstant) \ No newline at end of file diff --git a/docs/description/Rails_ApplicationRecord.md b/docs/description/Rails_ApplicationRecord.md index 84febeb1..3c82d339 100644 --- a/docs/description/Rails_ApplicationRecord.md +++ b/docs/description/Rails_ApplicationRecord.md @@ -1,6 +1,10 @@ Checks that models subclass `ApplicationRecord` with Rails 5.0. +It is a common practice to define models inside migrations in order to retain forward +compatibility by avoiding loading any application code. And so migration files are excluded +by default for this cop. + # Examples ```ruby diff --git a/docs/description/Rails_CompactBlank.md b/docs/description/Rails_CompactBlank.md index 2beedc86..5fd14c33 100644 --- a/docs/description/Rails_CompactBlank.md +++ b/docs/description/Rails_CompactBlank.md @@ -8,6 +8,10 @@ Checks if collection can be blank-compacted with `compact_blank`. # bad collection.reject(&:blank?) collection.reject { |_k, v| v.blank? } +collection.select(&:present?) +collection.select { |_k, v| v.present? } +collection.filter(&:present?) +collection.filter { |_k, v| v.present? } # good collection.compact_blank @@ -15,8 +19,8 @@ collection.compact_blank # bad collection.delete_if(&:blank?) # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!` collection.delete_if { |_k, v| v.blank? } # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!` -collection.reject!(&:blank?) # Same behavior as `ActionController::Parameters#compact_blank!` -collection.reject! { |_k, v| v.blank? } # Same behavior as `ActionController::Parameters#compact_blank!` +collection.keep_if(&:present?) # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!` +collection.keep_if { |_k, v| v.present? } # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!` # good collection.compact_blank! diff --git a/docs/description/Rails_Date.md b/docs/description/Rails_Date.md index 63d2ee58..ad407315 100644 --- a/docs/description/Rails_Date.md +++ b/docs/description/Rails_Date.md @@ -8,10 +8,10 @@ Rails time zone. You must use `Time.zone.today` instead. The cop also reports warnings when you are using `to_time` method, because it doesn't know about Rails time zone either. -Two styles are supported for this cop. When `EnforcedStyle` is 'strict' +Two styles are supported for this cop. When `EnforcedStyle` is `strict` then the Date methods `today`, `current`, `yesterday`, and `tomorrow` are prohibited and the usage of both `to_time` -and 'to_time_in_current_zone' are reported as warning. +and `to_time_in_current_zone` are reported as warning. When `EnforcedStyle` is `flexible` then only `Date.today` is prohibited. diff --git a/docs/description/Rails_EnumHash.md b/docs/description/Rails_EnumHash.md index f6c5215c..9a7a0f7a 100644 --- a/docs/description/Rails_EnumHash.md +++ b/docs/description/Rails_EnumHash.md @@ -9,6 +9,12 @@ value for each key prevents this from happening. # Examples ```ruby +# bad +enum :status, [:active, :archived] + +# good +enum :status, { active: 0, archived: 1 } + # bad enum status: [:active, :archived] diff --git a/docs/description/Rails_EnumSyntax.md b/docs/description/Rails_EnumSyntax.md new file mode 100644 index 00000000..982fe87b --- /dev/null +++ b/docs/description/Rails_EnumSyntax.md @@ -0,0 +1,17 @@ + +Looks for enums written with keyword arguments syntax. + +Defining enums with keyword arguments syntax is deprecated and will be removed in Rails 8.0. +Positional arguments should be used instead: + +# Examples + +```ruby +# bad +enum status: { active: 0, archived: 1 }, _prefix: true + +# good +enum :status, { active: 0, archived: 1 }, prefix: true +``` + +[Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/EnumSyntax) \ No newline at end of file diff --git a/docs/description/Rails_EnumUniqueness.md b/docs/description/Rails_EnumUniqueness.md index d17ad7b4..6cd8de6b 100644 --- a/docs/description/Rails_EnumUniqueness.md +++ b/docs/description/Rails_EnumUniqueness.md @@ -4,6 +4,18 @@ Looks for duplicate values in enum declarations. # Examples ```ruby +# bad +enum :status, { active: 0, archived: 0 } + +# good +enum :status, { active: 0, archived: 1 } + +# bad +enum :status, [:active, :archived, :active] + +# good +enum :status, [:active, :archived] + # bad enum status: { active: 0, archived: 0 } diff --git a/docs/description/Rails_PluckInWhere.md b/docs/description/Rails_PluckInWhere.md index a24516fd..590e414c 100644 --- a/docs/description/Rails_PluckInWhere.md +++ b/docs/description/Rails_PluckInWhere.md @@ -3,11 +3,12 @@ Identifies places where `pluck` is used in `where` query methods and can be replaced with `select`. Since `pluck` is an eager method and hits the database immediately, -using `select` helps to avoid additional database queries. +using `select` helps to avoid additional database queries by running as +a subquery. -This cop has two different enforcement modes. When the `EnforcedStyle` -is `conservative` (the default) then only calls to `pluck` on a constant -(i.e. a model class) in the `where` is used as offenses. +This cop has two modes of enforcement. When the `EnforcedStyle` is set +to `conservative` (the default), only calls to `pluck` on a constant +(e.g. a model class) within `where` are considered offenses. # Examples diff --git a/docs/description/Rails_PluralizationGrammar.md b/docs/description/Rails_PluralizationGrammar.md index da81322c..d106abd6 100644 --- a/docs/description/Rails_PluralizationGrammar.md +++ b/docs/description/Rails_PluralizationGrammar.md @@ -8,10 +8,14 @@ core extensions to the numeric classes. # bad 3.day.ago 1.months.ago +5.megabyte +1.gigabytes # good 3.days.ago 1.month.ago +5.megabytes +1.gigabyte ``` [Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/PluralizationGrammar) \ No newline at end of file diff --git a/docs/description/Rails_RootPathnameMethods.md b/docs/description/Rails_RootPathnameMethods.md index 73c551e3..581ce93f 100644 --- a/docs/description/Rails_RootPathnameMethods.md +++ b/docs/description/Rails_RootPathnameMethods.md @@ -17,6 +17,8 @@ File.read(Rails.root.join('db', 'schema.rb')) File.binread(Rails.root.join('db', 'schema.rb')) File.write(Rails.root.join('db', 'schema.rb'), content) File.binwrite(Rails.root.join('db', 'schema.rb'), content) +Dir.glob(Rails.root.join('db', 'schema.rb')) +Dir[Rails.root.join('db', 'schema.rb')] # good Rails.root.join('db', 'schema.rb').open @@ -25,6 +27,7 @@ Rails.root.join('db', 'schema.rb').read Rails.root.join('db', 'schema.rb').binread Rails.root.join('db', 'schema.rb').write(content) Rails.root.join('db', 'schema.rb').binwrite(content) +Rails.root.glob("db/schema.rb") ``` [Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Rails/RootPathnameMethods) \ No newline at end of file diff --git a/docs/description/Rails_WhereEquals.md b/docs/description/Rails_WhereEquals.md index a843bcf3..efbe2c9e 100644 --- a/docs/description/Rails_WhereEquals.md +++ b/docs/description/Rails_WhereEquals.md @@ -1,12 +1,14 @@ Identifies places where manually constructed SQL -in `where` can be replaced with `where(attribute: value)`. +in `where` and `where.not` can be replaced with +`where(attribute: value)` and `where.not(attribute: value)`. # Examples ```ruby # bad User.where('name = ?', 'Gabe') +User.where.not('name = ?', 'Gabe') User.where('name = :name', name: 'Gabe') User.where('name IS NULL') User.where('name IN (?)', ['john', 'jane']) @@ -15,6 +17,7 @@ User.where('users.name = :name', name: 'Gabe') # good User.where(name: 'Gabe') +User.where.not(name: 'Gabe') User.where(name: nil) User.where(name: ['john', 'jane']) User.where(users: { name: 'Gabe' }) diff --git a/docs/description/Sorbet_Refinement.md b/docs/description/Sorbet_Refinement.md new file mode 100644 index 00000000..9af65ff0 --- /dev/null +++ b/docs/description/Sorbet_Refinement.md @@ -0,0 +1,33 @@ + +Checks for the use of Ruby Refinements library. Refinements add +complexity and incur a performance penalty that can be significant +for large code bases. Good examples are cases of unrelated +methods that happen to have the same name as these module methods. + +# Examples + +```ruby +# bad +module Foo + refine(Date) do + end +end + +# bad +module Foo + using(Date) do + end +end + +# good +module Foo + bar.refine(Date) +end + +# good +module Foo + bar.using(Date) +end +``` + +[Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Sorbet/Refinement) \ No newline at end of file diff --git a/docs/description/Style_EmptyLiteral.md b/docs/description/Style_EmptyLiteral.md index e12a7a27..b0cb09d2 100644 --- a/docs/description/Style_EmptyLiteral.md +++ b/docs/description/Style_EmptyLiteral.md @@ -7,7 +7,9 @@ would be a literal, like an empty array, hash, or string. ```ruby # bad a = Array.new +a = Array[] h = Hash.new +h = Hash[] s = String.new # good diff --git a/docs/description/Style_FormatStringToken.md b/docs/description/Style_FormatStringToken.md index 1a59c2a3..22b533d5 100644 --- a/docs/description/Style_FormatStringToken.md +++ b/docs/description/Style_FormatStringToken.md @@ -7,8 +7,8 @@ which are passed as arguments to those methods: The reason is that _unannotated_ format is very similar to encoded URLs or Date/Time formatting strings. -This cop can be customized allowed methods with `AllowedMethods`. -By default, there are no methods to allowed. +This cop's allowed methods can be customized with `AllowedMethods`. +By default, there are no allowed methods. It is allowed to contain unannotated token if the number of them is less than or equals to diff --git a/docs/description/Style_MethodCallWithoutArgsParentheses.md b/docs/description/Style_MethodCallWithoutArgsParentheses.md index e007fc14..01b8c54e 100644 --- a/docs/description/Style_MethodCallWithoutArgsParentheses.md +++ b/docs/description/Style_MethodCallWithoutArgsParentheses.md @@ -1,8 +1,8 @@ Checks for unwanted parentheses in parameterless method calls. -This cop can be customized allowed methods with `AllowedMethods`. -By default, there are no methods to allowed. +This cop's allowed methods can be customized with `AllowedMethods`. +By default, there are no allowed methods. NOTE: This cop allows the use of `it()` without arguments in blocks, as in `0.times { it() }`, following `Lint/ItWithoutArgumentsInBlock` cop. diff --git a/docs/description/Style_NumericPredicate.md b/docs/description/Style_NumericPredicate.md index c60a705c..b540c98a 100644 --- a/docs/description/Style_NumericPredicate.md +++ b/docs/description/Style_NumericPredicate.md @@ -4,8 +4,8 @@ Checks for usage of comparison operators (`==`, These can be replaced by their respective predicate methods. This cop can also be configured to do the reverse. -This cop can be customized allowed methods with `AllowedMethods`. -By default, there are no methods to allowed. +This cop's allowed methods can be customized with `AllowedMethods`. +By default, there are no allowed methods. This cop disregards `#nonzero?` as its value is truthy or falsey, but not `true` and `false`, and thus not always interchangeable with diff --git a/docs/description/Style_RedundantInterpolationUnfreeze.md b/docs/description/Style_RedundantInterpolationUnfreeze.md new file mode 100644 index 00000000..0fd1e712 --- /dev/null +++ b/docs/description/Style_RedundantInterpolationUnfreeze.md @@ -0,0 +1,20 @@ + +Before Ruby 3.0, interpolated strings followed the frozen string literal +magic comment which sometimes made it necessary to explicitly unfreeze them. +Ruby 3.0 changed interpolated strings to always be unfrozen which makes +unfreezing them redundant. + +# Examples + +```ruby +# bad ++"#{foo} bar" + +# bad +"#{foo} bar".dup + +# good +"#{foo} bar" +``` + +[Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/RedundantInterpolationUnfreeze) \ No newline at end of file diff --git a/docs/description/Style_SafeNavigation.md b/docs/description/Style_SafeNavigation.md index af5cef4e..03a01001 100644 --- a/docs/description/Style_SafeNavigation.md +++ b/docs/description/Style_SafeNavigation.md @@ -13,9 +13,9 @@ of the method is. If this is converted to safe navigation, `foo&.bar` can start returning `nil` as well as what the method returns. -The default for `MaxChainLength` is `2` +The default for `MaxChainLength` is `2`. We have limited the cop to not register an offense for method chains -that exceed this option is set. +that exceed this option's value. # Examples diff --git a/docs/description/description.json b/docs/description/description.json index 3053d90b..9247a3bf 100644 --- a/docs/description/description.json +++ b/docs/description/description.json @@ -2953,10 +2953,6 @@ "name": "AutoCorrect", "description": "AutoCorrect" }, - { - "name": "SafeAutoCorrect", - "description": "SafeAutoCorrect" - }, { "name": "Exclude", "description": "Exclude" @@ -2989,6 +2985,12 @@ } ] }, + { + "patternId": "Lint_UselessNumericOperation", + "title": "Checks for useless numeric operations.", + "description": "Checks for useless numeric operations.", + "timeToFix": 5 + }, { "patternId": "Lint_UselessRescue", "title": "Checks for useless `rescue`s.", @@ -5263,6 +5265,12 @@ } ] }, + { + "patternId": "Style_RedundantInterpolationUnfreeze", + "title": "Checks for redundant unfreezing of interpolated strings.", + "description": "Checks for redundant unfreezing of interpolated strings.", + "timeToFix": 5 + }, { "patternId": "Style_RedundantLineContinuation", "title": "Check for redundant line continuation.", @@ -7548,6 +7556,10 @@ { "name": "SafeAutoCorrect", "description": "SafeAutoCorrect" + }, + { + "name": "Exclude", + "description": "Exclude" } ] }, @@ -7835,6 +7847,22 @@ } ] }, + { + "patternId": "Rails_EnumSyntax", + "title": "Use positional arguments over keyword arguments when defining enums.", + "description": "Use positional arguments over keyword arguments when defining enums.", + "timeToFix": 5, + "parameters": [ + { + "name": "Severity", + "description": "Severity" + }, + { + "name": "Include", + "description": "Include" + } + ] + }, { "patternId": "Rails_EnumUniqueness", "title": "Avoid duplicate integers in hash-syntax `enum` declaration.", @@ -8911,8 +8939,8 @@ }, { "patternId": "Rails_WhereEquals", - "title": "Pass conditions to `where` as a hash instead of manually constructing SQL.", - "description": "Pass conditions to `where` as a hash instead of manually constructing SQL.", + "title": "Pass conditions to `where` and `where.not` as a hash instead of manually constructing SQL.", + "description": "Pass conditions to `where` and `where.not` as a hash instead of manually constructing SQL.", "timeToFix": 5, "parameters": [ { @@ -9073,6 +9101,12 @@ } ] }, + { + "patternId": "Sorbet_Refinement", + "title": "Checks for the use of Ruby Refinements library. Refinements add complexity and incur a performance penalty that can be significant for large code bases. They are also not supported by Sorbet.", + "description": "Checks for the use of Ruby Refinements library. Refinements add complexity and incur a performance penalty that can be significant for large code bases. They are also not supported by Sorbet.", + "timeToFix": 5 + }, { "patternId": "Sorbet_TypeAliasName", "title": "Type alias constant names must be in CamelCase.", @@ -9108,7 +9142,7 @@ { "patternId": "Sorbet_BuggyObsoleteStrictMemoization", "title": "Checks for the a mistaken variant of the \"obsolete memoization pattern\" that used to be required for older Sorbet versions in `#typed: strict` files.", - "description": "Checks for the a mistaken variant of the \"obsolete memoization pattern\" that used to be required for older Sorbet versions in `#typed: strict` files. The mistaken variant would overwrite the ivar with `nil` on every call, causing the memoized value to be discarded and recomputed on every call.\nThis cop will correct it to read from the ivar instead of `nil`, which will memoize it correctly.\nThe result of this correction will be the \"obsolete memoization pattern\", which can further be corrected by the `Sorbet/ObsoleteStrictMemoization` cop.\nSee `Sorbet/ObsoleteStrictMemoization` for more details.", + "description": "Checks for the a mistaken variant of the \"obsolete memoization pattern\" that used to be required for older Sorbet versions in `#typed: strict` files. The mistaken variant would overwrite the ivar with `nil` on every call, causing the memoized value to be discarded and recomputed on every call.\nThis cop will correct it to read from the ivar instead of `nil`, which will memoize it correctly.", "timeToFix": 5, "parameters": [ { @@ -11155,6 +11189,18 @@ } ] }, + { + "patternId": "RSpec_StringAsInstanceDoubleConstant", + "title": "Do not use a string as `instance_double` constant.", + "description": "Do not use a string as `instance_double` constant.", + "timeToFix": 5, + "parameters": [ + { + "name": "Safe", + "description": "Safe" + } + ] + }, { "patternId": "RSpec_StubbedMock", "title": "Checks that message expectations do not have a configured response.", diff --git a/docs/patterns.json b/docs/patterns.json index cc3c96e8..8d0865c7 100644 --- a/docs/patterns.json +++ b/docs/patterns.json @@ -1,6 +1,6 @@ { "name": "rubocop", - "version": "1.65.1", + "version": "1.66.1", "patterns": [ { "patternId": "Migration_DepartmentName", @@ -586,7 +586,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -719,7 +728,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -1210,7 +1228,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -1986,7 +2013,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -2263,7 +2299,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -2288,7 +2333,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -2849,7 +2903,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -2886,7 +2949,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -3259,7 +3331,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -3290,7 +3371,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -3333,7 +3423,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -3348,15 +3447,20 @@ "name": "AutoCorrect", "default": "contextual" }, - { - "name": "SafeAutoCorrect", - "default": "false" - }, { "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -3385,12 +3489,27 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], "enabled": false }, + { + "patternId": "Lint_UselessNumericOperation", + "level": "Warning", + "category": "ErrorProne", + "enabled": false + }, { "patternId": "Lint_UselessRescue", "level": "Warning", @@ -3448,7 +3567,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -3803,8 +3931,18 @@ { "name": "Exclude", "default": [ + "Rakefile.rb", "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] }, { @@ -4370,7 +4508,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -4643,7 +4790,7 @@ { "name": "AllowedReceivers", "default": [ - + "params" ] } ], @@ -4744,7 +4891,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -4934,8 +5090,19 @@ { "name": "Exclude", "default": [ + "spec/**/*", + "test/**/*", "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -5336,7 +5503,16 @@ "name": "Exclude", "default": [ "**/*.md", - "**/*.markdown" + "**/*.livemd", + "**/*.markdown", + "**/*.mdown", + "**/*.mdwn", + "**/*.mkd", + "**/*.mkdn", + "**/*.mkdown", + "**/*.ronn", + "**/*.scd", + "**/*.workbook" ] } ], @@ -6038,6 +6214,12 @@ ], "enabled": false }, + { + "patternId": "Style_RedundantInterpolationUnfreeze", + "level": "Info", + "category": "CodeStyle", + "enabled": false + }, { "patternId": "Style_RedundantLineContinuation", "level": "Info", @@ -8558,6 +8740,12 @@ { "name": "SafeAutoCorrect", "default": "false" + }, + { + "name": "Exclude", + "default": [ + "db/**/*.rb" + ] } ], "enabled": false @@ -8879,6 +9067,24 @@ ], "enabled": false }, + { + "patternId": "Rails_EnumSyntax", + "level": "Warning", + "category": "ErrorProne", + "parameters": [ + { + "name": "Severity", + "default": "warning" + }, + { + "name": "Include", + "default": [ + "app/models/**/*.rb" + ] + } + ], + "enabled": false + }, { "patternId": "Rails_EnumUniqueness", "level": "Warning", @@ -10283,6 +10489,12 @@ ], "enabled": false }, + { + "patternId": "Sorbet_Refinement", + "level": "Info", + "category": "CodeStyle", + "enabled": false + }, { "patternId": "Sorbet_TypeAliasName", "level": "Info", @@ -12582,6 +12794,18 @@ ], "enabled": false }, + { + "patternId": "RSpec_StringAsInstanceDoubleConstant", + "level": "Info", + "category": "CodeStyle", + "parameters": [ + { + "name": "Safe", + "default": "false" + } + ], + "enabled": false + }, { "patternId": "RSpec_StubbedMock", "level": "Info",