From 5d617fc99f98458b518eeba231e474a9e6b20316 Mon Sep 17 00:00:00 2001 From: Sam Bostock Date: Mon, 13 Feb 2023 19:34:03 -0500 Subject: [PATCH 1/2] [WIP] Explore plugin configs - RuboCop config requires only the RuboCop plugins whose gemspec is loaded - Each plugin has a corresponding file of defaults which are inherited - Labels are attached automatically to PRs touching each config file TBD: - Should we have a minimal config? Should we keep the existing config as is, and instead add an "everything.yml" config? - Should we test compatibility with _just_ RuboCop and no plugins? - What cops to enable? Maybe disallowing "pending" shouldn't apply to plugins, so we don't break consumers? --- .github/labeler.yml | 9 +- Gemfile | 9 + Gemfile.lock | 35 + rubocop.graphql.yml | 0 rubocop.minitest.yml | 2 + rubocop.performance.yml | 0 rubocop.rails.yml | 0 rubocop.rake.yml | 0 rubocop.rspec.yml | 0 rubocop.yml | 16 + test/fixtures/full_config.yml | 2629 ++++++++++++++++++++++++++++++++- 11 files changed, 2696 insertions(+), 4 deletions(-) create mode 100644 rubocop.graphql.yml create mode 100644 rubocop.minitest.yml create mode 100644 rubocop.performance.yml create mode 100644 rubocop.rails.yml create mode 100644 rubocop.rake.yml create mode 100644 rubocop.rspec.yml diff --git a/.github/labeler.yml b/.github/labeler.yml index 25597134..78d865ab 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1 +1,8 @@ -"config change": rubocop.yml +"config change": rubocop*.yml +"hq": rubocop.yml +"graphql": rubocop.graphql.yml +"minitest": rubocop.minitest.yml +"performance": rubocop.performance.yml +"rails": rubocop.rails.yml +"rake": rubocop.rake.yml +"rspec": rubocop.rspec.yml diff --git a/Gemfile b/Gemfile index ae8acf1f..c2504333 100644 --- a/Gemfile +++ b/Gemfile @@ -8,3 +8,12 @@ gem "diffy" gem "minitest" gem "pry-byebug" gem "rake" + +group :plugins do + gem "rubocop-graphql" + gem "rubocop-minitest" + gem "rubocop-performance" + gem "rubocop-rails" + gem "rubocop-rake" + gem "rubocop-rspec" +end diff --git a/Gemfile.lock b/Gemfile.lock index 03ead06d..1bb3f25c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,10 +7,18 @@ PATH GEM remote: https://rubygems.org/ specs: + activesupport (7.0.4.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) ast (2.4.2) byebug (11.1.3) coderay (1.1.3) + concurrent-ruby (1.2.0) diffy (3.4.2) + i18n (1.12.0) + concurrent-ruby (~> 1.0) json (2.6.3) method_source (1.0.0) minitest (5.17.0) @@ -23,6 +31,7 @@ GEM pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) + rack (3.0.4.1) rainbow (3.1.1) rake (13.0.6) regexp_parser (2.6.2) @@ -39,7 +48,27 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.24.1) parser (>= 3.1.1.0) + rubocop-capybara (2.17.0) + rubocop (~> 1.41) + rubocop-graphql (0.19.0) + rubocop (>= 0.87, < 2) + rubocop-minitest (0.27.0) + rubocop (>= 0.90, < 2.0) + rubocop-performance (1.16.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rails (2.17.4) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) + rubocop-rake (0.6.0) + rubocop (~> 1.0) + rubocop-rspec (2.18.1) + rubocop (~> 1.33) + rubocop-capybara (~> 2.17) ruby-progressbar (1.11.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) unicode-display_width (2.4.2) PLATFORMS @@ -50,6 +79,12 @@ DEPENDENCIES minitest pry-byebug rake + rubocop-graphql + rubocop-minitest + rubocop-performance + rubocop-rails + rubocop-rake + rubocop-rspec rubocop-shopify! BUNDLED WITH diff --git a/rubocop.graphql.yml b/rubocop.graphql.yml new file mode 100644 index 00000000..e69de29b diff --git a/rubocop.minitest.yml b/rubocop.minitest.yml new file mode 100644 index 00000000..49a0ab24 --- /dev/null +++ b/rubocop.minitest.yml @@ -0,0 +1,2 @@ +Minitest: + Enabled: true diff --git a/rubocop.performance.yml b/rubocop.performance.yml new file mode 100644 index 00000000..e69de29b diff --git a/rubocop.rails.yml b/rubocop.rails.yml new file mode 100644 index 00000000..e69de29b diff --git a/rubocop.rake.yml b/rubocop.rake.yml new file mode 100644 index 00000000..e69de29b diff --git a/rubocop.rspec.yml b/rubocop.rspec.yml new file mode 100644 index 00000000..e69de29b diff --git a/rubocop.yml b/rubocop.yml index 002a592a..0353d3ca 100644 --- a/rubocop.yml +++ b/rubocop.yml @@ -3,6 +3,22 @@ inherit_mode: - Exclude - Include +<% + # Identify installed RuboCop plugins to configure + plugin_configs = { + "rubocop-graphql" => "rubocop.graphql.yml", + "rubocop-minitest" => "rubocop.minitest.yml", + "rubocop-performance" => "rubocop.performance.yml", + "rubocop-rails" => "rubocop.rails.yml", + "rubocop-rake" => "rubocop.graphql.yml", + "rubocop-rspec" => "rubocop.rspec.yml", + }.select { |plugin_name, _| Gem.loaded_specs.include?(plugin_name) } +%> + +require: <%= plugin_configs.keys.to_json %> + +inherit_from: <%= plugin_configs.values.to_json %> + AllCops: StyleGuideBaseURL: https://shopify.github.io/ruby-style-guide/ diff --git a/test/fixtures/full_config.yml b/test/fixtures/full_config.yml index fc4690c0..03ce28e1 100644 --- a/test/fixtures/full_config.yml +++ b/test/fixtures/full_config.yml @@ -63,6 +63,11 @@ AllCops: - "/tmp/**/*" - "/vendor/**/*" - "/.git/**/*" + - "/bin/*" + - "/db/*schema.rb" + - "/log/**/*" + - "/public/**/*" + - "/storage/**/*" DefaultFormatter: progress DisplayCopNames: true DisplayStyleGuide: false @@ -92,7 +97,8 @@ AllCops: - rake rubocop-graphql: - graphql - ActiveSupportExtensionsEnabled: false + ActiveSupportExtensionsEnabled: true + TargetRailsVersion: Bundler/DuplicatedGem: Description: Checks for duplicate gem entries in Gemfile. Enabled: true @@ -1485,9 +1491,39 @@ Lint/NumberConversion: VersionAdded: '0.53' VersionChanged: '1.1' SafeAutoCorrect: false - AllowedMethods: [] + AllowedMethods: + - ago + - from_now + - second + - seconds + - minute + - minutes + - hour + - hours + - day + - days + - week + - weeks + - fortnight + - fortnights + - in_milliseconds AllowedPatterns: [] - IgnoredMethods: [] + IgnoredMethods: + - ago + - from_now + - second + - seconds + - minute + - minutes + - hour + - hours + - day + - days + - week + - weeks + - fortnight + - fortnights + - in_milliseconds IgnoredClasses: - Time - DateTime @@ -1886,6 +1922,11 @@ Metrics/BlockLength: IgnoredMethods: [] Exclude: - "/**/*.gemspec" + - "**/*_spec.rb" + - "**/spec/**/*" + inherit_mode: + merge: + - Exclude Metrics/BlockNesting: Description: Avoid excessive block nesting. StyleGuide: "#three-is-the-number-thou-shalt-count" @@ -3982,6 +4023,8 @@ Style/SymbolProc: AllowMethodsWithArguments: false AllowedMethods: - define_method + - mail + - respond_to AllowedPatterns: [] IgnoredMethods: [] AllowComments: false @@ -4170,7 +4213,2587 @@ Style/ZeroLengthPredicate: Safe: false VersionAdded: '0.37' VersionChanged: '0.39' +GraphQL: + Enabled: true + Include: + - "**/graphql/**/*" + Exclude: + - "/spec/**/*" + - "/test/**/*" +GraphQL/ArgumentDescription: + Enabled: true + VersionAdded: '0.80' + Description: Ensures all arguments have a description +GraphQL/ArgumentName: + Enabled: true + VersionAdded: '0.80' + Description: This cop checks whether argument names are snake_case +GraphQL/ArgumentUniqueness: + Enabled: true + VersionAdded: '0.80' + Description: This cop enforces arguments to be defined once per block +GraphQL/ResolverMethodLength: + Enabled: true + VersionAdded: '0.80' + Description: Checks resolver methods are not too long + Max: 10 + CountComments: false + ExcludedMethods: [] +GraphQL/FieldDefinitions: + Enabled: true + VersionAdded: '0.80' + Description: Checks consistency of field definitions + EnforcedStyle: group_definitions + SupportedStyles: + - group_definitions + - define_resolver_after_definition +GraphQL/MultipleFieldDefinitions: + Enabled: true + Description: Ensures that fields with multiple definitions are grouped together +GraphQL/FieldDescription: + Enabled: true + VersionAdded: '0.80' + Description: Ensures all fields have a description +GraphQL/FieldHashKey: + Enabled: true + VersionAdded: '0.80' + Description: Checks :hash_key option is used for appropriate fields +GraphQL/FieldMethod: + Enabled: true + VersionAdded: '0.80' + Description: Checks :method option is used for appropriate fields +GraphQL/FieldName: + Enabled: true + VersionAdded: '0.80' + Description: This cop checks whether field names are snake_case + SafeAutoCorrect: false +GraphQL/FieldUniqueness: + Enabled: true + VersionAdded: '0.80' + Description: This cop enforces fields to be defined once +GraphQL/ExtractInputType: + Enabled: true + VersionAdded: '0.80' + Description: Suggests using input type instead of many arguments + MaxArguments: 2 + Include: + - "**/graphql/mutations/**/*.rb" +GraphQL/ExtractType: + Enabled: true + VersionAdded: '0.80' + Description: Suggests extracting fields with common prefixes to the separate type + MaxFields: 2 + Prefixes: + - is + - has + - with + - avg + - min + - max +GraphQL/LegacyDsl: + Enabled: true + VersionAdded: '0.80' + Description: Checks that types are defined with class-based API +GraphQL/ObjectDescription: + Enabled: true + VersionAdded: '0.80' + Description: Ensures all types have a description + Exclude: + - "/**/*_schema.rb" + - "/**/base_*.rb" + - "/**/graphql/query_context.rb" +GraphQL/OrderedArguments: + Enabled: true + VersionAdded: '0.80' + Description: Arguments should be alphabetically sorted within groups +GraphQL/OrderedFields: + Enabled: true + VersionAdded: '0.80' + Description: Fields should be alphabetically sorted within groups +GraphQL/UnusedArgument: + Enabled: true + Description: Arguments should either be listed explicitly or **rest should be in + the resolve signature +GraphQL/UnnecessaryFieldAlias: + Enabled: true + Description: Field aliases should be different than their field names +GraphQL/UnnecessaryArgumentCamelize: + Enabled: true + Description: Camelize isn't necessary if the argument name doesn't contain underscores +GraphQL/UnnecessaryFieldCamelize: + Enabled: true + Description: Camelize isn't necessary if the field name doesn't contain underscores +Minitest: + Enabled: true + DocumentationBaseURL: https://docs.rubocop.org/rubocop-minitest + Include: + - "**/test/**/*" + - "**/*_test.rb" +Minitest/AssertEmpty: + Description: This cop enforces the test to use `assert_empty` instead of using `assert(object.empty?)`. + StyleGuide: https://minitest.rubystyle.guide#assert-empty + Enabled: true + VersionAdded: '0.2' +Minitest/AssertEmptyLiteral: + Description: This cop enforces the test to use `assert_empty` instead of using `assert_equal([], + object)`. + Enabled: true + VersionAdded: '0.5' + VersionChanged: '0.11' +Minitest/AssertEqual: + Description: This cop enforces the test to use `assert_equal` instead of using `assert(expected + == actual)`. + StyleGuide: https://minitest.rubystyle.guide#assert-equal-arguments-order + Enabled: true + VersionAdded: '0.4' +Minitest/AssertInDelta: + Description: This cop enforces the test to use `assert_in_delta` instead of using + `assert_equal` to compare floats. + StyleGuide: https://minitest.rubystyle.guide/#assert-in-delta + Enabled: pending + VersionAdded: '0.10' +Minitest/AssertIncludes: + Description: This cop enforces the test to use `assert_includes` instead of using + `assert(collection.include?(object))`. + StyleGuide: https://minitest.rubystyle.guide#assert-includes + Enabled: true + VersionAdded: '0.2' +Minitest/AssertInstanceOf: + Description: This cop enforces the test to use `assert_instance_of(Class, object)` + over `assert(object.instance_of?(Class))` + StyleGuide: https://minitest.rubystyle.guide#assert-instance-of + Enabled: true + VersionAdded: '0.4' +Minitest/AssertKindOf: + Description: This cop enforces the test to use `assert_kind_of(Class, object)` over + `assert(object.kind_of?(Class))` + StyleGuide: https://github.com/rubocop/minitest-style-guide#assert-kind-of + Enabled: pending + VersionAdded: '0.10' +Minitest/AssertMatch: + Description: This cop enforces the test to use `assert_match` instead of using `assert(matcher.match(object))`. + StyleGuide: https://minitest.rubystyle.guide#assert-match + Enabled: true + VersionAdded: '0.6' +Minitest/AssertNil: + Description: This cop enforces the test to use `assert_nil` instead of using `assert_equal(nil, + something)` or `assert(something.nil?)`. + StyleGuide: https://minitest.rubystyle.guide#assert-nil + Enabled: true + VersionAdded: '0.1' +Minitest/AssertOutput: + Description: This cop checks for opportunities to use `assert_output`. + StyleGuide: https://minitest.rubystyle.guide/#assert-output + Enabled: pending + VersionAdded: '0.10' +Minitest/AssertPathExists: + Description: This cop enforces the test to use `assert_path_exists` instead of using + `assert(File.exist?(path))`. + StyleGuide: https://minitest.rubystyle.guide/#assert-path-exists + Enabled: pending + VersionAdded: '0.10' +Minitest/AssertPredicate: + Description: This cop enforces the test to use `assert_predicate` instead of using + `assert(obj.a_predicate_method?)`. + StyleGuide: https://minitest.rubystyle.guide/#assert-predicate + Enabled: pending + VersionAdded: '0.18' +Minitest/AssertRaisesCompoundBody: + Description: This cop enforces the block body of `assert_raises { ... }` to be reduced + to only the raising code. + Enabled: pending + VersionAdded: '0.21' +Minitest/AssertRaisesWithRegexpArgument: + Description: This cop enforces checks for regular expression literals passed to + `assert_raises`. + Enabled: pending + Severity: warning + VersionAdded: '0.22' + VersionChanged: '0.26' +Minitest/AssertRespondTo: + Description: This cop enforces the test to use `assert_respond_to(object, :do_something)` + over `assert(object.respond_to?(:do_something))`. + StyleGuide: https://minitest.rubystyle.guide#assert-responds-to-method + Enabled: true + VersionAdded: '0.3' +Minitest/AssertSame: + Description: Enforces the use of `assert_same(expected, actual)` over `assert(expected.equal?(actual))`. + StyleGuide: https://minitest.rubystyle.guide#assert-same + Enabled: pending + VersionAdded: '0.26' +Minitest/AssertSilent: + Description: This cop enforces the test to use `assert_silent { ... }` instead of + using `assert_output('', '') { ... }`. + StyleGuide: https://github.com/rubocop/minitest-style-guide#assert-silent + Enabled: pending + VersionAdded: '0.10' +Minitest/AssertTruthy: + Description: This cop enforces the test to use `assert(actual)` instead of using + `assert_equal(true, actual)`. + StyleGuide: https://minitest.rubystyle.guide#assert-truthy + Enabled: true + Safe: false + VersionAdded: '0.2' + VersionChanged: '0.27' +Minitest/AssertWithExpectedArgument: + Description: This cop tries to detect when a user accidentally used `assert` when + they meant to use `assert_equal`. + Enabled: pending + Severity: warning + Safe: false + VersionAdded: '0.11' + VersionChanged: '0.26' +Minitest/AssertionInLifecycleHook: + Description: This cop checks for usage of assertions in lifecycle hooks. + Enabled: pending + VersionAdded: '0.10' +Minitest/DuplicateTestRun: + Description: This cop detects duplicate test runs caused by one test class inheriting + from another. + StyleGuide: https://minitest.rubystyle.guide/#subclassing-test-cases + Enabled: pending + VersionAdded: '0.19' +Minitest/EmptyLineBeforeAssertionMethods: + Description: Add empty line before assertion methods. + Enabled: pending + VersionAdded: '0.23' +Minitest/GlobalExpectations: + Description: This cop checks for deprecated global expectations. + StyleGuide: https://minitest.rubystyle.guide#global-expectations + Enabled: true + Severity: warning + EnforcedStyle: any + Include: + - "**/test/**/*" + - "**/*_test.rb" + - "**/spec/**/*" + - "**/*_spec.rb" + SupportedStyles: + - _ + - any + - expect + - value + VersionAdded: '0.7' + VersionChanged: '0.26' +Minitest/LiteralAsActualArgument: + Description: This cop enforces correct order of `expected` and `actual` arguments + for `assert_equal`. + StyleGuide: https://minitest.rubystyle.guide/#assert-equal-arguments-order + Enabled: pending + VersionAdded: '0.10' +Minitest/MultipleAssertions: + Description: This cop checks if test cases contain too many assertion calls. + Enabled: pending + VersionAdded: '0.10' + Max: 3 +Minitest/NoAssertions: + Description: This cop checks for at least one assertion (or flunk) in tests. + Enabled: false + VersionAdded: '0.12' +Minitest/NonPublicTestMethod: + Description: Detects non `public` (marked as `private` or `protected`) test methods. + Enabled: pending + Severity: warning + VersionAdded: '0.27' +Minitest/RefuteEmpty: + Description: This cop enforces to use `refute_empty` instead of using `refute(object.empty?)`. + StyleGuide: https://minitest.rubystyle.guide#refute-empty + Enabled: true + VersionAdded: '0.3' +Minitest/RefuteEqual: + Description: Check if your test uses `refute_equal` instead of `assert(expected + != object)` or `assert(! expected == object))`. + StyleGuide: https://minitest.rubystyle.guide#refute-equal + Enabled: true + VersionAdded: '0.3' +Minitest/RefuteFalse: + Description: Check if your test uses `refute(actual)` instead of `assert_equal(false, + actual)`. + StyleGuide: https://minitest.rubystyle.guide#refute-false + Enabled: true + Safe: false + VersionAdded: '0.3' + VersionChanged: '0.27' +Minitest/RefuteInDelta: + Description: This cop enforces the test to use `refute_in_delta` instead of using + `refute_equal` to compare floats. + StyleGuide: https://minitest.rubystyle.guide/#refute-in-delta + Enabled: pending + VersionAdded: '0.10' +Minitest/RefuteIncludes: + Description: This cop enforces the test to use `refute_includes` instead of using + `refute(collection.include?(object))`. + StyleGuide: https://minitest.rubystyle.guide#refute-includes + Enabled: true + VersionAdded: '0.3' +Minitest/RefuteInstanceOf: + Description: This cop enforces the test to use `refute_instance_of(Class, object)` + over `refute(object.instance_of?(Class))`. + StyleGuide: https://minitest.rubystyle.guide#refute-instance-of + Enabled: true + VersionAdded: '0.4' +Minitest/RefuteKindOf: + Description: This cop enforces the test to use `refute_kind_of(Class, object)` over + `refute(object.kind_of?(Class))`. + StyleGuide: https://github.com/rubocop/minitest-style-guide#refute-kind-of + Enabled: pending + VersionAdded: '0.10' +Minitest/RefuteMatch: + Description: This cop enforces the test to use `refute_match` instead of using `refute(matcher.match(object))`. + StyleGuide: https://minitest.rubystyle.guide#refute-match + Enabled: true + VersionAdded: '0.6' +Minitest/RefuteNil: + Description: This cop enforces the test to use `refute_nil` instead of using `refute_equal(nil, + something)` or `refute(something.nil?)`. + StyleGuide: https://minitest.rubystyle.guide#refute-nil + Enabled: true + VersionAdded: '0.2' +Minitest/RefutePathExists: + Description: This cop enforces the test to use `refute_path_exists` instead of using + `refute(File.exist?(path))`. + StyleGuide: https://minitest.rubystyle.guide/#refute-path-exists + Enabled: pending + VersionAdded: '0.10' +Minitest/RefutePredicate: + Description: This cop enforces the test to use `refute_predicate` instead of using + `refute(obj.a_predicate_method?)`. + StyleGuide: https://minitest.rubystyle.guide/#refute-predicate + Enabled: pending + VersionAdded: '0.18' +Minitest/RefuteRespondTo: + Description: This cop enforces the test to use `refute_respond_to(object, :do_something)` + over `refute(object.respond_to?(:do_something))`. + StyleGuide: https://minitest.rubystyle.guide#refute-respond-to + Enabled: true + VersionAdded: '0.4' +Minitest/RefuteSame: + Description: Enforces the use of `refute_same(expected, actual)` over `refute(expected.equal?(actual))`. + StyleGuide: https://minitest.rubystyle.guide#refute-same + Enabled: pending + VersionAdded: '0.26' +Minitest/SkipEnsure: + Description: Checks that `ensure` call even if `skip`. + Enabled: pending + Severity: warning + VersionAdded: '0.20' + VersionChanged: '0.26' +Minitest/SkipWithoutReason: + Description: Checks for skipped tests missing the skipping reason. + Enabled: pending + VersionAdded: '0.24' +Minitest/TestFileName: + Description: Checks if test file names start with `test_` or end with `_test.rb`. + StyleGuide: https://minitest.rubystyle.guide/#file-naming + Enabled: pending + VersionAdded: '0.26' +Minitest/TestMethodName: + Description: This cop enforces that test method names start with `test_` prefix. + Enabled: pending + VersionAdded: '0.10' +Minitest/UnreachableAssertion: + Description: This cop checks for an `assert_raises` block containing any unreachable + assertions. + Enabled: pending + Severity: warning + VersionAdded: '0.14' + VersionChanged: '0.26' +Minitest/UnspecifiedException: + Description: This cop checks for a specified error in `assert_raises`. + StyleGuide: https://minitest.rubystyle.guide#unspecified-exception + Enabled: pending + VersionAdded: '0.10' +Minitest/UselessAssertion: + Description: Detects useless assertions (assertions that either always pass or always + fail). + Enabled: pending + VersionAdded: '0.26' +Performance: + Enabled: true + DocumentationBaseURL: https://docs.rubocop.org/rubocop-performance +Performance/AncestorsInclude: + Description: Use `A <= B` instead of `A.ancestors.include?(B)`. + Reference: https://github.com/JuanitoFatas/fast-ruby#ancestorsinclude-vs--code + Enabled: pending + Safe: false + VersionAdded: '1.7' +Performance/ArraySemiInfiniteRangeSlice: + Description: Identifies places where slicing arrays with semi-infinite ranges can + be replaced by `Array#take` and `Array#drop`. + Enabled: false + Safe: false + VersionAdded: '1.9' +Performance/BigDecimalWithNumericArgument: + Description: Convert numeric literal to string and pass it to `BigDecimal`. + Enabled: pending + VersionAdded: '1.7' +Performance/BindCall: + Description: Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`. + Enabled: true + VersionAdded: '1.6' +Performance/BlockGivenWithExplicitBlock: + Description: Check block argument explicitly instead of using `block_given?`. + Enabled: pending + VersionAdded: '1.9' +Performance/Caller: + Description: Use `caller(n..n)` instead of `caller`. + Enabled: true + VersionAdded: '0.49' + VersionChanged: '1.9' +Performance/CaseWhenSplat: + Description: Reordering `when` conditions with a splat to the end of the `when` + branches can improve performance. + Enabled: false + SafeAutoCorrect: false + VersionAdded: '0.34' + VersionChanged: '1.13' +Performance/Casecmp: + Description: Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, + or `== upcase`.. + Reference: https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code + Enabled: true + Safe: false + VersionAdded: '0.36' +Performance/ChainArrayAllocation: + Description: Instead of chaining array methods that allocate new arrays, mutate + an existing array. + Reference: https://twitter.com/schneems/status/1034123879978029057 + Enabled: false + VersionAdded: '0.59' +Performance/CollectionLiteralInLoop: + Description: Extract Array and Hash literals outside of loops into local variables + or constants. + Enabled: pending + VersionAdded: '1.8' + MinSize: 1 +Performance/CompareWithBlock: + Description: Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`. + Enabled: true + VersionAdded: '0.46' +Performance/ConcurrentMonotonicTime: + Description: Use `Process.clock_gettime(Process::CLOCK_MONOTONIC)` instead of `Concurrent.monotonic_time`. + Reference: https://github.com/rails/rails/pull/43502 + Enabled: pending + VersionAdded: '1.12' +Performance/ConstantRegexp: + Description: Finds regular expressions with dynamic components that are all constants. + Enabled: pending + VersionAdded: '1.9' + VersionChanged: '1.10' +Performance/Count: + Description: Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`. + SafeAutoCorrect: false + Enabled: true + VersionAdded: '0.31' + VersionChanged: '1.8' +Performance/DeletePrefix: + Description: Use `delete_prefix` instead of `gsub`. + Enabled: true + Safe: false + SafeMultiline: true + VersionAdded: '1.6' + VersionChanged: '1.11' +Performance/DeleteSuffix: + Description: Use `delete_suffix` instead of `gsub`. + Enabled: true + Safe: false + SafeMultiline: true + VersionAdded: '1.6' + VersionChanged: '1.11' +Performance/Detect: + Description: Use `detect` instead of `select.first`, `find_all.first`, `filter.first`, + `select.last`, `find_all.last`, and `filter.last`. + Reference: https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code + SafeAutoCorrect: false + Enabled: true + VersionAdded: '0.30' + VersionChanged: '1.8' +Performance/DoubleStartEndWith: + Description: Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x, + ...) || str.{start,end}_with?(y, ...)`. + Enabled: true + VersionAdded: '0.36' + VersionChanged: '0.48' + IncludeActiveSupportAliases: false +Performance/EndWith: + Description: Use `end_with?` instead of a regex match anchored to the end of a string. + Reference: https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end + SafeAutoCorrect: false + Enabled: true + SafeMultiline: true + VersionAdded: '0.36' + VersionChanged: '1.10' +Performance/FixedSize: + Description: Do not compute the size of statically sized objects except in constants. + Enabled: true + VersionAdded: '0.35' +Performance/FlatMap: + Description: Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1)` + or `Enumerable#collect..Array#flatten(1)`. + Reference: https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code + Enabled: true + VersionAdded: '0.30' + EnabledForFlattenWithoutParams: false +Performance/InefficientHashSearch: + Description: Use `key?` or `value?` instead of `keys.include?` or `values.include?`. + Reference: https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code + Enabled: true + VersionAdded: '0.56' + Safe: false +Performance/IoReadlines: + Description: Use `IO.each_line` (`IO#each_line`) instead of `IO.readlines` (`IO#readlines`). + Reference: https://docs.gitlab.com/ee/development/performance.html#reading-from-files-and-other-data-sources + Enabled: false + VersionAdded: '1.7' +Performance/MapCompact: + Description: Use `filter_map` instead of `collection.map(&:do_something).compact`. + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '1.11' +Performance/MethodObjectAsBlock: + Description: Use block explicitly instead of block-passing a method object. + Reference: https://github.com/JuanitoFatas/fast-ruby#normal-way-to-apply-method-vs-method-code + Enabled: pending + VersionAdded: '1.9' +Performance/OpenStruct: + Description: Use `Struct` instead of `OpenStruct`. + Enabled: false + VersionAdded: '0.61' + Safe: false +Performance/RangeInclude: + Description: Use `Range#cover?` instead of `Range#include?` (or `Range#member?`). + Reference: https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code + Enabled: true + VersionAdded: '0.36' + VersionChanged: '1.7' + Safe: false +Performance/RedundantBlockCall: + Description: Use `yield` instead of `block.call`. + Reference: https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode + Enabled: true + VersionAdded: '0.36' +Performance/RedundantEqualityComparisonBlock: + Description: Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`, + or `Enumerable#none?` are compared with `===` or similar methods in block. + Reference: https://github.com/rails/rails/pull/41363 + Enabled: pending + Safe: false + VersionAdded: '1.10' +Performance/RedundantMatch: + Description: Use `=~` instead of `String#match` or `Regexp#match` in a context where + the returned `MatchData` is not needed. + Enabled: true + VersionAdded: '0.36' +Performance/RedundantMerge: + Description: Use Hash#[]=, rather than Hash#merge! with a single key-value pair. + Reference: https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code + Enabled: true + Safe: false + VersionAdded: '0.36' + VersionChanged: '1.11' + MaxKeyValuePairs: 2 +Performance/RedundantSortBlock: + Description: Use `sort` instead of `sort { |a, b| a <=> b }`. + Enabled: pending + VersionAdded: '1.7' +Performance/RedundantSplitRegexpArgument: + Description: Identifies places where `split` argument can be replaced from a deterministic + regexp to a string. + Enabled: pending + VersionAdded: '1.10' +Performance/RedundantStringChars: + Description: Checks for redundant `String#chars`. + Enabled: pending + VersionAdded: '1.7' +Performance/RegexpMatch: + Description: Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, + `Regexp#===`, or `=~` when `MatchData` is not used. + Reference: https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code- + Enabled: true + VersionAdded: '0.47' +Performance/ReverseEach: + Description: Use `reverse_each` instead of `reverse.each`. + Reference: https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code + Enabled: true + VersionAdded: '0.30' +Performance/ReverseFirst: + Description: Use `last(n).reverse` instead of `reverse.first(n)`. + Enabled: pending + VersionAdded: '1.7' +Performance/SelectMap: + Description: Use `filter_map` instead of `ary.select(&:foo).map(&:bar)`. + Enabled: false + VersionAdded: '1.11' +Performance/Size: + Description: Use `size` instead of `count` for counting the number of elements in + `Array` and `Hash`. + Reference: https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code + Enabled: true + VersionAdded: '0.30' +Performance/SortReverse: + Description: Use `sort.reverse` instead of `sort { |a, b| b <=> a }`. + Enabled: pending + VersionAdded: '1.7' +Performance/Squeeze: + Description: Use `squeeze('a')` instead of `gsub(/a+/, 'a')`. + Reference: https://github.com/JuanitoFatas/fast-ruby#remove-extra-spaces-or-other-contiguous-characters-code + Enabled: pending + VersionAdded: '1.7' +Performance/StartWith: + Description: Use `start_with?` instead of a regex match anchored to the beginning + of a string. + Reference: https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end + SafeAutoCorrect: false + Enabled: true + SafeMultiline: true + VersionAdded: '0.36' + VersionChanged: '1.10' +Performance/StringIdentifierArgument: + Description: Use symbol identifier argument instead of string identifier argument. + Enabled: pending + VersionAdded: '1.13' +Performance/StringInclude: + Description: Use `String#include?` instead of a regex match with literal-only pattern. + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '1.7' + VersionChanged: '1.12' +Performance/StringReplacement: + Description: Use `tr` instead of `gsub` when you are replacing the same number of + characters. Use `delete` instead of `gsub` when you are deleting characters. + Reference: https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code + Enabled: true + VersionAdded: '0.33' +Performance/Sum: + Description: Use `sum` instead of a custom array summation. + SafeAutoCorrect: false + Reference: https://blog.bigbinary.com/2016/11/02/ruby-2-4-introduces-enumerable-sum.html + Enabled: pending + VersionAdded: '1.8' + VersionChanged: '1.13' + OnlySumOrWithInitialValue: false +Performance/TimesMap: + Description: Checks for .times.map calls. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '0.36' + VersionChanged: '1.13' +Performance/UnfreezeString: + Description: Use unary plus to get an unfrozen string literal. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '0.50' + VersionChanged: '1.9' +Performance/UriDefaultParser: + Description: Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`. + Enabled: true + VersionAdded: '0.50' inherit_mode: merge: - Exclude - Include +Rails: + Enabled: true + DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails +Rails/ActionControllerFlashBeforeRender: + Description: Use `flash.now` instead of `flash` before `render`. + StyleGuide: https://rails.rubystyle.guide/#flash-before-render + Reference: https://api.rubyonrails.org/classes/ActionController/FlashBeforeRender.html + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.16' +Rails/ActionControllerTestCase: + Description: Use `ActionDispatch::IntegrationTest` instead of `ActionController::TestCase`. + StyleGuide: https://rails.rubystyle.guide/#integration-testing + Reference: https://api.rubyonrails.org/classes/ActionController/TestCase.html + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.14' + Include: + - "**/test/**/*.rb" +Rails/ActionFilter: + Description: Enforces consistent use of action filter methods. + Enabled: true + VersionAdded: '0.19' + EnforcedStyle: action + SupportedStyles: + - action + - filter + Include: + - app/controllers/**/*.rb + - app/mailers/**/*.rb +Rails/ActionOrder: + Description: Enforce consistent ordering of controller actions. + Enabled: pending + VersionAdded: '2.17' + ExpectedOrder: + - index + - show + - new + - edit + - create + - update + - destroy + Include: + - app/controllers/**/*.rb +Rails/ActiveRecordAliases: + Description: 'Avoid Active Record aliases: Use `update` instead of `update_attributes`. + Use `update!` instead of `update_attributes!`.' + Enabled: true + VersionAdded: '0.53' + SafeAutoCorrect: false +Rails/ActiveRecordCallbacksOrder: + Description: Order callback declarations in the order in which they will be executed. + StyleGuide: https://rails.rubystyle.guide/#callbacks-order + Enabled: pending + VersionAdded: '2.7' + Include: + - app/models/**/*.rb +Rails/ActiveRecordOverride: + Description: Check for overriding Active Record methods instead of using callbacks. + Enabled: true + VersionAdded: '0.67' + Include: + - app/models/**/*.rb +Rails/ActiveSupportAliases: + Description: 'Avoid ActiveSupport aliases of standard ruby methods: `String#starts_with?`, + `String#ends_with?`, `Array#append`, `Array#prepend`.' + Enabled: true + VersionAdded: '0.48' +Rails/ActiveSupportOnLoad: + Description: Use `ActiveSupport.on_load(...)` to patch Rails framework classes. + Enabled: pending + Reference: + - https://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html + - https://guides.rubyonrails.org/engines.html#available-load-hooks + SafeAutoCorrect: false + VersionAdded: '2.16' +Rails/AddColumnIndex: + Description: Rails migrations don't make use of a given `index` key, but also doesn't + given an error when it's used, so it makes it seem like an index might be used. + Enabled: pending + VersionAdded: '2.11' + Include: + - db/migrate/*.rb +Rails/AfterCommitOverride: + Description: Enforces that there is only one call to `after_commit` (and its aliases + - `after_create_commit`, `after_update_commit`, and `after_destroy_commit`) with + the same callback name per model. + Enabled: pending + VersionAdded: '2.8' +Rails/ApplicationController: + Description: Check that controllers subclass ApplicationController. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '2.4' + VersionChanged: '2.5' +Rails/ApplicationJob: + Description: Check that jobs subclass ApplicationJob. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '0.49' + VersionChanged: '2.5' +Rails/ApplicationMailer: + Description: Check that mailers subclass ApplicationMailer. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '2.4' + VersionChanged: '2.5' +Rails/ApplicationRecord: + Description: Check that models subclass ApplicationRecord. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '0.49' + VersionChanged: '2.5' +Rails/ArelStar: + Description: Enforces `Arel.star` instead of `"*"` for expanded columns. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '2.9' +Rails/AssertNot: + Description: Use `assert_not` instead of `assert !`. + Enabled: true + VersionAdded: '0.56' + Include: + - "**/test/**/*" +Rails/AttributeDefaultBlockValue: + Description: Pass method call in block for attribute option `default`. + Enabled: pending + VersionAdded: '2.9' + Include: + - app/models/**/* +Rails/BelongsTo: + Description: 'Use `optional: true` instead of `required: false` for `belongs_to` + relations.' + Enabled: true + VersionAdded: '0.62' +Rails/Blank: + Description: Enforces use of `blank?`. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '0.48' + VersionChanged: '2.10' + NilOrEmpty: true + NotPresent: true + UnlessPresent: true +Rails/BulkChangeTable: + Description: Check whether alter queries are combinable. + Enabled: true + VersionAdded: '0.57' + Database: + SupportedDatabases: + - mysql + - postgresql + Include: + - db/migrate/*.rb +Rails/CompactBlank: + Description: Checks if collection can be blank-compacted with `compact_blank`. + Enabled: pending + Safe: false + VersionAdded: '2.13' +Rails/ContentTag: + Description: Use `tag.something` instead of `tag(:something)`. + Reference: + - https://github.com/rubocop/rubocop-rails/issues/260 + - https://github.com/rails/rails/issues/25195 + - https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag + Enabled: true + VersionAdded: '2.6' + VersionChanged: '2.12' + Exclude: + - "/app/models/**/*.rb" + - "/config/**/*.rb" +Rails/CreateTableWithTimestamps: + Description: Checks the migration for which timestamps are not included when creating + a new table. + Enabled: true + VersionAdded: '0.52' + Include: + - db/migrate/*.rb + Exclude: + - "/db/migrate/*_create_active_storage_tables.active_storage.rb" +Rails/Date: + Description: Checks the correct usage of date aware methods, such as Date.today, + Date.current etc. + Enabled: true + VersionAdded: '0.30' + VersionChanged: '2.11' + EnforcedStyle: flexible + SupportedStyles: + - strict + - flexible + AllowToTime: true +Rails/DefaultScope: + Description: Avoid use of `default_scope`. + StyleGuide: https://rails.rubystyle.guide#avoid-default-scope + Enabled: false + VersionAdded: '2.7' +Rails/Delegate: + Description: Prefer delegate method for delegations. + Enabled: true + VersionAdded: '0.21' + VersionChanged: '0.50' + EnforceForPrefixed: true +Rails/DelegateAllowBlank: + Description: Do not use allow_blank as an option to delegate. + Enabled: true + VersionAdded: '0.44' +Rails/DeprecatedActiveModelErrorsMethods: + Description: Avoid manipulating ActiveModel errors hash directly. + Enabled: pending + Safe: false + VersionAdded: '2.14' + VersionChanged: '2.15' +Rails/DotSeparatedKeys: + Description: Enforces the use of dot-separated keys instead of `:scope` options + in `I18n` translation methods. + StyleGuide: https://rails.rubystyle.guide/#dot-separated-keys + Enabled: pending + VersionAdded: '2.15' +Rails/DuplicateAssociation: + Description: Don't repeat associations in a model. + Enabled: pending + VersionAdded: '2.14' +Rails/DuplicateScope: + Description: Multiple scopes share this same where clause. + Enabled: pending + VersionAdded: '2.14' +Rails/DurationArithmetic: + Description: Do not use duration as arithmetic operand with `Time.current`. + StyleGuide: https://rails.rubystyle.guide#duration-arithmetic + Enabled: pending + VersionAdded: '2.13' +Rails/DynamicFindBy: + Description: Use `find_by` instead of dynamic `find_by_*`. + StyleGuide: https://rails.rubystyle.guide#find_by + Enabled: true + Safe: false + VersionAdded: '0.44' + VersionChanged: '2.10' + Whitelist: + - find_by_sql + - find_by_token_for + AllowedMethods: + - find_by_sql + - find_by_token_for + AllowedReceivers: + - Gem::Specification + - page +Rails/EagerEvaluationLogMessage: + Description: Checks that blocks are used for interpolated strings passed to `Rails.logger.debug`. + Reference: https://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance + Enabled: pending + VersionAdded: '2.11' +Rails/EnumHash: + Description: Prefer hash syntax over array syntax when defining enums. + StyleGuide: https://rails.rubystyle.guide#enums + Enabled: true + VersionAdded: '2.3' + Include: + - app/models/**/*.rb +Rails/EnumUniqueness: + Description: Avoid duplicate integers in hash-syntax `enum` declaration. + Enabled: true + VersionAdded: '0.46' + Include: + - app/models/**/*.rb +Rails/EnvironmentComparison: + Description: Favor `Rails.env.production?` over `Rails.env == 'production'`. + Enabled: true + VersionAdded: '0.52' +Rails/EnvironmentVariableAccess: + Description: Do not access `ENV` directly after initialization. + Enabled: false + VersionAdded: '2.10' + VersionChanged: '2.11' + Include: + - app/**/*.rb + - lib/**/*.rb + Exclude: + - "/lib/**/*.rake" + AllowReads: false + AllowWrites: false +Rails/Exit: + Description: Favor `fail`, `break`, `return`, etc. over `exit` in application or + library code outside of Rake files to avoid exits during unit testing or running + in production. + Enabled: true + VersionAdded: '0.41' + Include: + - app/**/*.rb + - config/**/*.rb + - lib/**/*.rb + Exclude: + - "/lib/**/*.rake" +Rails/ExpandedDateRange: + Description: Checks for expanded date range. + StyleGuide: https://rails.rubystyle.guide/#date-time-range + Enabled: pending + VersionAdded: '2.11' +Rails/FilePath: + Description: Use `Rails.root.join` for file path joining. + Enabled: true + VersionAdded: '0.47' + VersionChanged: '2.4' + EnforcedStyle: slashes + SupportedStyles: + - slashes + - arguments +Rails/FindBy: + Description: Prefer find_by over where.first. + StyleGuide: https://rails.rubystyle.guide#find_by + Enabled: true + VersionAdded: '0.30' + VersionChanged: '2.11' + IgnoreWhereFirst: true + Include: + - app/models/**/*.rb +Rails/FindById: + Description: Favor the use of `find` over `where.take!`, `find_by!`, and `find_by_id!` + when you need to retrieve a single record by primary key when you expect it to + be found. + StyleGuide: https://rails.rubystyle.guide/#find + Enabled: pending + VersionAdded: '2.7' +Rails/FindEach: + Description: Prefer all.find_each over all.find. + StyleGuide: https://rails.rubystyle.guide#find-each + Enabled: true + VersionAdded: '0.30' + VersionChanged: '2.9' + Include: + - app/models/**/*.rb + AllowedMethods: + - order + - limit + - select + - lock + AllowedPatterns: [] + IgnoredMethods: + - order + - limit + - select + - lock +Rails/FreezeTime: + Description: Prefer `freeze_time` over `travel_to` with an argument of the current + time. + StyleGuide: https://rails.rubystyle.guide/#freeze-time + Enabled: pending + VersionAdded: '2.16' + SafeAutoCorrect: false +Rails/HasAndBelongsToMany: + Description: Prefer has_many :through to has_and_belongs_to_many. + StyleGuide: https://rails.rubystyle.guide#has-many-through + Enabled: true + VersionAdded: '0.12' + Include: + - app/models/**/*.rb +Rails/HasManyOrHasOneDependent: + Description: Define the dependent option to the has_many and has_one associations. + StyleGuide: https://rails.rubystyle.guide#has_many-has_one-dependent-option + Enabled: true + VersionAdded: '0.50' + Include: + - app/models/**/*.rb +Rails/HelperInstanceVariable: + Description: Do not use instance variables in helpers. + Enabled: true + VersionAdded: '2.0' + Include: + - app/helpers/**/*.rb +Rails/HttpPositionalArguments: + Description: Use keyword arguments instead of positional arguments in http method + calls. + Enabled: true + VersionAdded: '0.44' + Include: + - spec/**/* + - test/**/* +Rails/HttpStatus: + Description: Enforces use of symbolic or numeric value to define HTTP status. + Enabled: true + VersionAdded: '0.54' + VersionChanged: '2.11' + EnforcedStyle: symbolic + SupportedStyles: + - numeric + - symbolic +Rails/I18nLazyLookup: + Description: Checks for places where I18n "lazy" lookup can be used. + StyleGuide: https://rails.rubystyle.guide/#lazy-lookup + Reference: https://guides.rubyonrails.org/i18n.html#lazy-lookup + Enabled: pending + VersionAdded: '2.14' + Include: + - app/controllers/**/*.rb +Rails/I18nLocaleAssignment: + Description: Prefer the usage of `I18n.with_locale` instead of manually updating + `I18n.locale` value. + Enabled: pending + VersionAdded: '2.11' + Include: + - spec/**/*.rb + - test/**/*.rb +Rails/I18nLocaleTexts: + Description: Enforces use of I18n and locale files instead of locale specific strings. + StyleGuide: https://rails.rubystyle.guide/#locale-texts + Enabled: pending + VersionAdded: '2.14' +Rails/IgnoredColumnsAssignment: + Description: Looks for assignments of `ignored_columns` that override previous assignments. + StyleGuide: https://rails.rubystyle.guide/#append-ignored-columns + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.17' +Rails/IgnoredSkipActionFilterOption: + Description: Checks that `if` and `only` (or `except`) are not used together as + options of `skip_*` action filter. + Reference: https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options + Enabled: true + VersionAdded: '0.63' + Include: + - app/controllers/**/*.rb + - app/mailers/**/*.rb +Rails/IndexBy: + Description: Prefer `index_by` over `each_with_object`, `to_h`, or `map`. + Enabled: true + VersionAdded: '2.5' + VersionChanged: '2.8' +Rails/IndexWith: + Description: Prefer `index_with` over `each_with_object`, `to_h`, or `map`. + Enabled: true + VersionAdded: '2.5' + VersionChanged: '2.8' +Rails/Inquiry: + Description: Prefer Ruby's comparison operators over Active Support's `Array#inquiry` + and `String#inquiry`. + StyleGuide: https://rails.rubystyle.guide/#inquiry + Enabled: pending + VersionAdded: '2.7' +Rails/InverseOf: + Description: Checks for associations where the inverse cannot be determined automatically. + Enabled: true + VersionAdded: '0.52' + IgnoreScopes: false + Include: + - app/models/**/*.rb +Rails/LexicallyScopedActionFilter: + Description: Checks that methods specified in the filter's `only` or `except` options + are explicitly defined in the class. + StyleGuide: https://rails.rubystyle.guide#lexically-scoped-action-filter + Enabled: true + Safe: false + VersionAdded: '0.52' + Include: + - app/controllers/**/*.rb + - app/mailers/**/*.rb +Rails/LinkToBlank: + Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` + option passed to them.' + Reference: + - https://mathiasbynens.github.io/rel-noopener/ + - https://html.spec.whatwg.org/multipage/links.html#link-type-noopener + - https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer + Enabled: true + VersionAdded: '0.62' +Rails/MailerName: + Description: Mailer should end with `Mailer` suffix. + StyleGuide: https://rails.rubystyle.guide/#mailer-name + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.7' + Include: + - app/mailers/**/*.rb +Rails/MatchRoute: + Description: Don't use `match` to define any routes unless there is a need to map + multiple request types among [:get, :post, :patch, :put, :delete] to a single + action using the `:via` option. + StyleGuide: https://rails.rubystyle.guide/#no-match-routes + Enabled: pending + VersionAdded: '2.7' + Include: + - config/routes.rb + - config/routes/**/*.rb +Rails/MigrationClassName: + Description: The class name of the migration should match its file name. + Enabled: pending + VersionAdded: '2.14' + Include: + - db/migrate/*.rb +Rails/NegateInclude: + Description: Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`. + StyleGuide: https://rails.rubystyle.guide#exclude + Enabled: pending + Safe: false + VersionAdded: '2.7' + VersionChanged: '2.9' +Rails/NotNullColumn: + Description: Do not add a NOT NULL column without a default value. + Enabled: true + VersionAdded: '0.43' + Include: + - db/migrate/*.rb +Rails/OrderById: + Description: Do not use the `id` column for ordering. Use a timestamp column to + order chronologically. + StyleGuide: https://rails.rubystyle.guide/#order-by-id + Enabled: false + VersionAdded: '2.8' +Rails/Output: + Description: Checks for calls to puts, print, etc. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '0.15' + VersionChanged: '0.19' + Include: + - app/**/*.rb + - config/**/*.rb + - db/**/*.rb + - lib/**/*.rb +Rails/OutputSafety: + Description: The use of `html_safe` or `raw` may be a security risk. + Enabled: true + VersionAdded: '0.41' +Rails/Pick: + Description: Prefer `pick` over `pluck(...).first`. + StyleGuide: https://rails.rubystyle.guide#pick + Enabled: true + Safe: false + VersionAdded: '2.6' +Rails/Pluck: + Description: Prefer `pluck` over `map { ... }`. + StyleGuide: https://rails.rubystyle.guide#pluck + Enabled: pending + VersionAdded: '2.7' +Rails/PluckId: + Description: Use `ids` instead of `pluck(:id)` or `pluck(primary_key)`. + StyleGuide: https://rails.rubystyle.guide/#ids + Enabled: false + Safe: false + VersionAdded: '2.7' +Rails/PluckInWhere: + Description: Use `select` instead of `pluck` in `where` query methods. + Enabled: pending + Safe: false + VersionAdded: '2.7' + VersionChanged: '2.8' + EnforcedStyle: conservative + SupportedStyles: + - conservative + - aggressive +Rails/PluralizationGrammar: + Description: Checks for incorrect grammar when using methods like `3.day.ago`. + Enabled: true + VersionAdded: '0.35' +Rails/Presence: + Description: Checks code that can be written more easily using `Object#presence` + defined by Active Support. + Enabled: true + VersionAdded: '0.52' +Rails/Present: + Description: Enforces use of `present?`. + Enabled: true + VersionAdded: '0.48' + VersionChanged: '0.67' + NotNilAndNotEmpty: true + NotBlank: true + UnlessBlank: true +Rails/RakeEnvironment: + Description: Include `:environment` as a dependency for all Rake tasks. + Enabled: true + Safe: false + VersionAdded: '2.4' + VersionChanged: '2.6' + Include: + - "**/Rakefile" + - "**/*.rake" + Exclude: + - "/lib/capistrano/tasks/**/*.rake" +Rails/ReadWriteAttribute: + Description: Checks for read_attribute(:attr) and write_attribute(:attr, val). + StyleGuide: https://rails.rubystyle.guide#read-attribute + Enabled: true + VersionAdded: '0.20' + VersionChanged: '0.29' + Include: + - app/models/**/*.rb +Rails/RedundantAllowNil: + Description: Finds redundant use of `allow_nil` when `allow_blank` is set to certain + values in model validations. + Enabled: true + VersionAdded: '0.67' + Include: + - app/models/**/*.rb +Rails/RedundantForeignKey: + Description: Checks for associations where the `:foreign_key` option is redundant. + Enabled: true + VersionAdded: '2.6' +Rails/RedundantPresenceValidationOnBelongsTo: + Description: Checks for redundant presence validation on belongs_to association. + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.13' +Rails/RedundantReceiverInWithOptions: + Description: Checks for redundant receiver in `with_options`. + Enabled: true + VersionAdded: '0.52' +Rails/RedundantTravelBack: + Description: Checks for redundant `travel_back` calls. + Enabled: pending + VersionAdded: '2.12' + Include: + - spec/**/*.rb + - test/**/*.rb +Rails/ReflectionClassName: + Description: Use a string for `class_name` option value in the definition of a reflection. + Enabled: true + Safe: false + VersionAdded: '0.64' + VersionChanged: '2.10' +Rails/RefuteMethods: + Description: Use `assert_not` methods instead of `refute` methods. + Enabled: true + VersionAdded: '0.56' + EnforcedStyle: assert_not + SupportedStyles: + - assert_not + - refute + Include: + - "**/test/**/*" +Rails/RelativeDateConstant: + Description: Do not assign relative date to constants. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '0.48' + VersionChanged: '2.13' +Rails/RenderInline: + Description: Prefer using a template over inline rendering. + StyleGuide: https://rails.rubystyle.guide/#inline-rendering + Enabled: pending + VersionAdded: '2.7' +Rails/RenderPlainText: + Description: Prefer `render plain:` over `render text:`. + StyleGuide: https://rails.rubystyle.guide/#plain-text-rendering + Enabled: pending + VersionAdded: '2.7' + ContentTypeCompatibility: true +Rails/RequestReferer: + Description: Use consistent syntax for request.referer. + Enabled: true + VersionAdded: '0.41' + EnforcedStyle: referer + SupportedStyles: + - referer + - referrer +Rails/RequireDependency: + Description: Do not use `require_dependency` when running in Zeitwerk mode. `require_dependency` + is for autoloading in classic mode. + Reference: https://guides.rubyonrails.org/autoloading_and_reloading_constants.html + Enabled: false + VersionAdded: '2.10' +Rails/ReversibleMigration: + Description: Checks whether the change method of the migration file is reversible. + StyleGuide: https://rails.rubystyle.guide#reversible-migration + Reference: https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html + Enabled: true + VersionAdded: '0.47' + VersionChanged: '2.13' + Include: + - db/**/*.rb +Rails/ReversibleMigrationMethodDefinition: + Description: Checks whether the migration implements either a `change` method or + both an `up` and a `down` method. + Enabled: false + VersionAdded: '2.10' + VersionChanged: '2.13' + Include: + - db/**/*.rb +Rails/RootJoinChain: + Description: Use a single `#join` instead of chaining on `Rails.root` or `Rails.public_path`. + Enabled: pending + VersionAdded: '2.13' +Rails/RootPathnameMethods: + Description: Use `Rails.root` IO methods instead of passing it to `File`. + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.16' +Rails/RootPublicPath: + Description: Favor `Rails.public_path` over `Rails.root` with `'public'`. + Enabled: pending + VersionAdded: '2.15' +Rails/SafeNavigation: + Description: Use Ruby's safe navigation operator (`&.`) instead of `try!`. + Enabled: true + VersionAdded: '0.43' + ConvertTry: false +Rails/SafeNavigationWithBlank: + Description: Avoid `foo&.blank?` in conditionals. + Enabled: true + VersionAdded: '2.4' + SafeAutoCorrect: false +Rails/SaveBang: + Description: Identifies possible cases where Active Record save! or related should + be used. + StyleGuide: https://rails.rubystyle.guide#save-bang + Enabled: false + VersionAdded: '0.42' + VersionChanged: '0.59' + AllowImplicitReturn: true + AllowedReceivers: [] + SafeAutoCorrect: false +Rails/SchemaComment: + Description: Enforces the use of the `comment` option when adding a new table or + column to the database during a migration. + Enabled: false + VersionAdded: '2.13' +Rails/ScopeArgs: + Description: Checks the arguments of ActiveRecord scopes. + Enabled: true + VersionAdded: '0.19' + VersionChanged: '2.12' + Include: + - app/models/**/*.rb +Rails/ShortI18n: + Description: 'Use the short form of the I18n methods: `t` instead of `translate` + and `l` instead of `localize`.' + StyleGuide: https://rails.rubystyle.guide/#short-i18n + Enabled: pending + VersionAdded: '2.7' + EnforcedStyle: conservative + SupportedStyles: + - conservative + - aggressive +Rails/SkipsModelValidations: + Description: Use methods that skips model validations with caution. See reference + for more information. + Reference: https://guides.rubyonrails.org/active_record_validations.html#skipping-validations + Enabled: true + VersionAdded: '0.47' + VersionChanged: '2.7' + ForbiddenMethods: + - decrement! + - decrement_counter + - increment! + - increment_counter + - insert + - insert! + - insert_all + - insert_all! + - toggle! + - touch + - touch_all + - update_all + - update_attribute + - update_column + - update_columns + - update_counters + - upsert + - upsert_all + AllowedMethods: [] +Rails/SquishedSQLHeredocs: + Description: Checks SQL heredocs to use `.squish`. + StyleGuide: https://rails.rubystyle.guide/#squished-heredocs + Enabled: pending + VersionAdded: '2.8' + VersionChanged: '2.9' + SafeAutoCorrect: false +Rails/StripHeredoc: + Description: Enforces the use of squiggly heredoc over `strip_heredoc`. + StyleGuide: https://rails.rubystyle.guide/#prefer-squiggly-heredoc + Enabled: pending + VersionAdded: '2.15' +Rails/TableNameAssignment: + Description: Do not use `self.table_name =`. Use Inflections or `table_name_prefix` + instead. + StyleGuide: https://rails.rubystyle.guide/#keep-ar-defaults + Enabled: false + VersionAdded: '2.14' + Include: + - app/models/**/*.rb +Rails/TimeZone: + Description: Checks the correct usage of time zone aware methods. + StyleGuide: https://rails.rubystyle.guide#time + Reference: http://danilenko.org/2012/7/6/rails_timezones + Enabled: true + SafeAutoCorrect: false + VersionAdded: '0.30' + VersionChanged: '2.13' + EnforcedStyle: flexible + SupportedStyles: + - strict + - flexible + Exclude: + - "/**/*.gemspec" +Rails/TimeZoneAssignment: + Description: Prefer the usage of `Time.use_zone` instead of manually updating `Time.zone` + value. + Reference: https://thoughtbot.com/blog/its-about-time-zones + Enabled: pending + VersionAdded: '2.10' + Include: + - spec/**/*.rb + - test/**/*.rb +Rails/ToFormattedS: + Description: Checks for consistent uses of `to_fs` or `to_formatted_s`. + StyleGuide: https://rails.rubystyle.guide/#prefer-to-fs + Enabled: pending + EnforcedStyle: to_fs + SupportedStyles: + - to_fs + - to_formatted_s + VersionAdded: '2.15' +Rails/ToSWithArgument: + Description: Identifies passing any argument to `#to_s`. + Enabled: pending + Safe: false + VersionAdded: '2.16' +Rails/TopLevelHashWithIndifferentAccess: + Description: Identifies top-level `HashWithIndifferentAccess`. + Reference: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#top-level-hashwithindifferentaccess-is-soft-deprecated + Enabled: pending + VersionAdded: '2.16' +Rails/TransactionExitStatement: + Description: Avoid the usage of `return`, `break` and `throw` in transaction blocks. + Enabled: pending + VersionAdded: '2.14' +Rails/UniqBeforePluck: + Description: Prefer the use of uniq or distinct before pluck. + Enabled: true + VersionAdded: '0.40' + VersionChanged: '2.13' + EnforcedStyle: conservative + SupportedStyles: + - conservative + - aggressive + SafeAutoCorrect: false +Rails/UniqueValidationWithoutIndex: + Description: Uniqueness validation should have a unique index on the database column. + Enabled: true + VersionAdded: '2.5' + Include: + - app/models/**/*.rb +Rails/UnknownEnv: + Description: Use correct environment name. + Enabled: true + VersionAdded: '0.51' + Environments: + - development + - test + - production +Rails/UnusedIgnoredColumns: + Description: Remove a column that does not exist from `ignored_columns`. + Enabled: pending + VersionAdded: '2.11' + Include: + - app/models/**/*.rb +Rails/Validation: + Description: Use validates :attribute, hash of validations. + Enabled: true + VersionAdded: '0.9' + VersionChanged: '0.41' + Include: + - app/models/**/*.rb +Rails/WhereEquals: + Description: Pass conditions to `where` as a hash instead of manually constructing + SQL. + StyleGuide: https://rails.rubystyle.guide/#hash-conditions + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.9' + VersionChanged: '2.10' +Rails/WhereExists: + Description: Prefer `exists?(...)` over `where(...).exists?`. + Enabled: pending + SafeAutoCorrect: false + EnforcedStyle: exists + SupportedStyles: + - exists + - where + VersionAdded: '2.7' + VersionChanged: '2.10' +Rails/WhereMissing: + Description: Use `where.missing(...)` to find missing relationship records. + StyleGuide: https://rails.rubystyle.guide/#finding-missing-relationship-records + Enabled: pending + VersionAdded: '2.16' +Rails/WhereNot: + Description: Use `where.not(...)` instead of manually constructing negated SQL in + `where`. + StyleGuide: https://rails.rubystyle.guide/#hash-conditions + Enabled: pending + VersionAdded: '2.8' +Rails/WhereNotWithMultipleConditions: + Description: Do not use `where.not(...)` with multiple conditions. + Enabled: pending + VersionAdded: '2.17' +Rake: + Enabled: true + Include: + - Rakefile + - "**/*.rake" +Rake/ClassDefinitionInTask: + Description: Do not define a class or module in rake task, because it will be defined + to the top level. + Enabled: true + VersionAdded: 0.3.0 +Rake/Desc: + Description: Describe the task with `desc` method. + Enabled: true + VersionAdded: 0.1.0 +Rake/DuplicateNamespace: + Description: Do not define namespace with the same name + Enabled: true + VersionAdded: 0.5.0 +Rake/DuplicateTask: + Description: Do not define tasks with the same name + Enabled: true + VersionAdded: 0.4.0 +Rake/MethodDefinitionInTask: + Description: Do not define a method in rake task, because it will be defined to + the top level. + Enabled: true + VersionAdded: 0.2.0 +Capybara: + Enabled: true + DocumentationBaseURL: https://docs.rubocop.org/rubocop-capybara + Include: + - "**/*_spec.rb" + - "**/spec/**/*" + - "**/test/**/*" +Capybara/CurrentPathExpectation: + Description: Checks that no expectations are set on Capybara's `current_path`. + Enabled: true + VersionAdded: '1.18' + VersionChanged: '2.0' + Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/CurrentPathExpectation +Capybara/MatchStyle: + Description: Checks for usage of deprecated style methods. + Enabled: pending + VersionAdded: "<>" + Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/MatchStyle +Capybara/NegationMatcher: + Description: Enforces use of `have_no_*` or `not_to` for negated expectations. + Enabled: pending + VersionAdded: '2.14' + EnforcedStyle: not_to + SupportedStyles: + - have_no + - not_to + Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/NegationMatcher +Capybara/SpecificActions: + Description: Checks for there is a more specific actions offered by Capybara. + Enabled: pending + VersionAdded: '2.14' + Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/SpecificActions +Capybara/SpecificFinders: + Description: Checks if there is a more specific finder offered by Capybara. + Enabled: pending + VersionAdded: '2.13' + Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/SpecificFinders +Capybara/SpecificMatcher: + Description: Checks for there is a more specific matcher offered by Capybara. + Enabled: pending + VersionAdded: '2.12' + Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/SpecificMatcher +Capybara/VisibilityMatcher: + Description: Checks for boolean visibility in Capybara finders. + Enabled: true + VersionAdded: '1.39' + VersionChanged: '2.0' + Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/VisibilityMatcher +RSpec: + Enabled: true + StyleGuideBaseURL: https://rspec.rubystyle.guide + DocumentationBaseURL: https://docs.rubocop.org/rubocop-rspec + Include: &1 + - "**/*_spec.rb" + - "**/spec/**/*" + Language: &2 + inherit_mode: + merge: + - Expectations + - Helpers + - Hooks + - Subjects + ExampleGroups: + inherit_mode: + merge: + - Regular + - Skipped + - Focused + Regular: + - describe + - context + - feature + - example_group + Skipped: + - xdescribe + - xcontext + - xfeature + Focused: + - fdescribe + - fcontext + - ffeature + Examples: + inherit_mode: + merge: + - Regular + - Skipped + - Focused + - Pending + Regular: + - it + - specify + - example + - scenario + - its + Focused: + - fit + - fspecify + - fexample + - fscenario + - focus + Skipped: + - xit + - xspecify + - xexample + - xscenario + - skip + Pending: + - pending + Expectations: + - are_expected + - expect + - expect_any_instance_of + - is_expected + - should + - should_not + - should_not_receive + - should_receive + Helpers: + - let + - let! + Hooks: + - prepend_before + - before + - append_before + - around + - prepend_after + - after + - append_after + Includes: + inherit_mode: + merge: + - Examples + - Context + Examples: + - it_behaves_like + - it_should_behave_like + - include_examples + Context: + - include_context + SharedGroups: + inherit_mode: + merge: + - Examples + - Context + Examples: + - shared_examples + - shared_examples_for + Context: + - shared_context + Subjects: + - subject + - subject! +RSpec/AlignLeftLetBrace: + Description: Checks that left braces for adjacent single line lets are aligned. + Enabled: false + VersionAdded: '1.16' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace +RSpec/AlignRightLetBrace: + Description: Checks that right braces for adjacent single line lets are aligned. + Enabled: false + VersionAdded: '1.16' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace +RSpec/AnyInstance: + Description: Check that instances are not being stubbed globally. + Enabled: true + VersionAdded: '1.4' + StyleGuide: https://rspec.rubystyle.guide/#any_instance_of + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance +RSpec/AroundBlock: + Description: Checks that around blocks actually run the test. + Enabled: true + VersionAdded: '1.11' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock +RSpec/Be: + Description: Check for expectations where `be` is used without argument. + Enabled: true + VersionAdded: '1.25' + StyleGuide: https://rspec.rubystyle.guide/#be-matcher + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be +RSpec/BeEq: + Description: Check for expectations where `be(...)` can replace `eq(...)`. + Enabled: pending + Safe: false + VersionAdded: 2.9.0 + VersionChanged: '2.16' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq +RSpec/BeEql: + Description: Check for expectations where `be(...)` can replace `eql(...)`. + Enabled: true + Safe: false + VersionAdded: '1.7' + VersionChanged: '2.16' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql +RSpec/BeNil: + Description: Ensures a consistent style is used when matching `nil`. + Enabled: pending + EnforcedStyle: be_nil + SupportedStyles: + - be + - be_nil + VersionAdded: 2.9.0 + VersionChanged: 2.10.0 + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil +RSpec/BeforeAfterAll: + Description: Check that before/after(:all) isn't being used. + Enabled: true + Exclude: + - spec/spec_helper.rb + - spec/rails_helper.rb + - spec/support/**/*.rb + VersionAdded: '1.12' + StyleGuide: https://rspec.rubystyle.guide/#avoid-hooks-with-context-scope + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll +RSpec/ChangeByZero: + Description: Prefer negated matchers over `to change.by(0)`. + Enabled: pending + VersionAdded: '2.11' + VersionChanged: '2.14' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero + NegatedMatcher: +RSpec/ClassCheck: + Description: Enforces consistent use of `be_a` or `be_kind_of`. + StyleGuide: "#is-a-vs-kind-of" + Enabled: pending + VersionAdded: '2.13' + EnforcedStyle: be_a + SupportedStyles: + - be_a + - be_kind_of + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ClassCheck +RSpec/ContextMethod: + Description: "`context` should not be used for specifying methods." + Enabled: true + VersionAdded: '1.36' + StyleGuide: https://rspec.rubystyle.guide/#example-group-naming + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod +RSpec/ContextWording: + Description: Checks that `context` docstring starts with an allowed prefix. + Enabled: true + Prefixes: + - when + - with + - without + AllowedPatterns: [] + VersionAdded: '1.20' + VersionChanged: '2.13' + StyleGuide: https://rspec.rubystyle.guide/#context-descriptions + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording +RSpec/DescribeClass: + Description: Check that the first argument to the top-level describe is a constant. + Enabled: true + Exclude: + - "**/spec/features/**/*" + - "**/spec/requests/**/*" + - "**/spec/routing/**/*" + - "**/spec/system/**/*" + - "**/spec/views/**/*" + IgnoredMetadata: + type: + - channel + - controller + - helper + - job + - mailer + - model + - request + - routing + - view + - feature + - system + - mailbox + - aruba + - task + VersionAdded: '1.0' + VersionChanged: '2.7' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass +RSpec/DescribeMethod: + Description: Checks that the second argument to `describe` specifies a method. + Enabled: true + VersionAdded: '1.0' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod +RSpec/DescribeSymbol: + Description: Avoid describing symbols. + Enabled: true + VersionAdded: '1.15' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol +RSpec/DescribedClass: + Description: Checks that tests use `described_class`. + Enabled: true + SkipBlocks: false + EnforcedStyle: described_class + SupportedStyles: + - described_class + - explicit + SafeAutoCorrect: false + VersionAdded: '1.0' + VersionChanged: '1.11' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass +RSpec/DescribedClassModuleWrapping: + Description: Avoid opening modules and defining specs within them. + Enabled: false + VersionAdded: '1.37' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping +RSpec/Dialect: + Description: Enforces custom RSpec dialects. + Enabled: false + PreferredMethods: {} + VersionAdded: '1.33' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect +RSpec/DuplicatedMetadata: + Description: Avoid duplicated metadata. + Enabled: pending + VersionAdded: '2.16' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata +RSpec/EmptyExampleGroup: + Description: Checks if an example group does not include any tests. + Enabled: true + SafeAutoCorrect: false + VersionAdded: '1.7' + VersionChanged: '2.13' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup +RSpec/EmptyHook: + Description: Checks for empty before and after hooks. + Enabled: true + VersionAdded: '1.39' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook +RSpec/EmptyLineAfterExample: + Description: Checks if there is an empty line after example blocks. + Enabled: true + AllowConsecutiveOneLiners: true + VersionAdded: '1.36' + StyleGuide: https://rspec.rubystyle.guide/#empty-lines-around-examples + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample +RSpec/EmptyLineAfterExampleGroup: + Description: Checks if there is an empty line after example group blocks. + Enabled: true + VersionAdded: '1.27' + StyleGuide: https://rspec.rubystyle.guide/#empty-lines-between-describes + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup +RSpec/EmptyLineAfterFinalLet: + Description: Checks if there is an empty line after the last let block. + Enabled: true + VersionAdded: '1.14' + StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet +RSpec/EmptyLineAfterHook: + Description: Checks if there is an empty line after hook blocks. + Enabled: true + VersionAdded: '1.27' + VersionChanged: '2.13' + StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook + AllowConsecutiveOneLiners: true +RSpec/EmptyLineAfterSubject: + Description: Checks if there is an empty line after subject block. + Enabled: true + VersionAdded: '1.14' + StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject +RSpec/ExampleLength: + Description: Checks for long examples. + Enabled: true + Max: 5 + CountAsOne: [] + VersionAdded: '1.5' + VersionChanged: '2.3' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength +RSpec/ExampleWithoutDescription: + Description: Checks for examples without a description. + Enabled: true + EnforcedStyle: always_allow + SupportedStyles: + - always_allow + - single_line_only + - disallow + VersionAdded: '1.22' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription +RSpec/ExampleWording: + Description: Checks for common mistakes in example descriptions. + Enabled: true + CustomTransform: + be: is + BE: IS + have: has + HAVE: HAS + IgnoredWords: [] + DisallowedExamples: + - works + VersionAdded: '1.0' + VersionChanged: '2.13' + StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording +RSpec/ExcessiveDocstringSpacing: + Description: Checks for excessive whitespace in example descriptions. + Enabled: pending + VersionAdded: '2.5' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing +RSpec/ExpectActual: + Description: Checks for `expect(...)` calls containing literal values. + Enabled: true + Exclude: + - spec/routing/**/* + VersionAdded: '1.7' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual +RSpec/ExpectChange: + Description: Checks for consistent style of change matcher. + Enabled: true + EnforcedStyle: method_call + SupportedStyles: + - method_call + - block + SafeAutoCorrect: false + VersionAdded: '1.22' + VersionChanged: '2.5' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange +RSpec/ExpectInHook: + Description: Do not use `expect` in hooks such as `before`. + Enabled: true + VersionAdded: '1.16' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook +RSpec/ExpectOutput: + Description: Checks for opportunities to use `expect { ... }.to output`. + Enabled: true + VersionAdded: '1.10' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput +RSpec/FilePath: + Description: Checks that spec file paths are consistent and well-formed. + Enabled: true + Include: + - "**/*_spec*rb*" + - "**/spec/**/*" + CustomTransform: + RuboCop: rubocop + RSpec: rspec + IgnoreMethods: false + SpecSuffixOnly: false + VersionAdded: '1.2' + VersionChanged: '1.40' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath +RSpec/Focus: + Description: Checks if examples are focused. + Enabled: true + VersionAdded: '1.5' + VersionChanged: '2.1' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus +RSpec/HookArgument: + Description: Checks the arguments passed to `before`, `around`, and `after`. + Enabled: true + EnforcedStyle: implicit + SupportedStyles: + - implicit + - each + - example + VersionAdded: '1.7' + StyleGuide: https://rspec.rubystyle.guide/#redundant-beforeeach + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument +RSpec/HooksBeforeExamples: + Description: Checks for before/around/after hooks that come after an example. + Enabled: true + VersionAdded: '1.29' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples +RSpec/IdenticalEqualityAssertion: + Description: Checks for equality assertions with identical expressions on both sides. + Enabled: pending + VersionAdded: '2.4' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion +RSpec/ImplicitBlockExpectation: + Description: Check that implicit block expectation syntax is not used. + Enabled: true + VersionAdded: '1.35' + StyleGuide: https://rspec.rubystyle.guide/#implicit-block-expectations + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation +RSpec/ImplicitExpect: + Description: Check that a consistent implicit expectation style is used. + Enabled: true + EnforcedStyle: is_expected + SupportedStyles: + - is_expected + - should + VersionAdded: '1.8' + StyleGuide: https://rspec.rubystyle.guide/#use-expect + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect +RSpec/ImplicitSubject: + Description: Checks for usage of implicit subject (`is_expected` / `should`). + Enabled: true + EnforcedStyle: single_line_only + SupportedStyles: + - single_line_only + - single_statement_only + - disallow + - require_implicit + VersionAdded: '1.29' + VersionChanged: '2.13' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject +RSpec/InstanceSpy: + Description: Checks for `instance_double` used with `have_received`. + Enabled: true + VersionAdded: '1.12' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy +RSpec/InstanceVariable: + Description: Checks for instance variable usage in specs. + Enabled: true + AssignmentOnly: false + VersionAdded: '1.0' + VersionChanged: '1.7' + StyleGuide: https://rspec.rubystyle.guide/#instance-variables + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable +RSpec/ItBehavesLike: + Description: Checks that only one `it_behaves_like` style is used. + Enabled: true + EnforcedStyle: it_behaves_like + SupportedStyles: + - it_behaves_like + - it_should_behave_like + VersionAdded: '1.13' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike +RSpec/IteratedExpectation: + Description: Check that `all` matcher is used instead of iterating over an array. + Enabled: true + VersionAdded: '1.14' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation +RSpec/LeadingSubject: + Description: Enforce that subject is the first definition in the test. + Enabled: true + VersionAdded: '1.7' + VersionChanged: '1.14' + StyleGuide: https://rspec.rubystyle.guide/#leading-subject + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject +RSpec/LeakyConstantDeclaration: + Description: Checks that no class, module, or constant is declared. + Enabled: true + VersionAdded: '1.35' + StyleGuide: https://rspec.rubystyle.guide/#declare-constants + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration +RSpec/LetBeforeExamples: + Description: Checks for `let` definitions that come after an example. + Enabled: true + VersionAdded: '1.16' + VersionChanged: '1.22' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples +RSpec/LetSetup: + Description: Checks unreferenced `let!` calls being used for test setup. + Enabled: true + VersionAdded: '1.7' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup +RSpec/MessageChain: + Description: Check that chains of messages are not being stubbed. + Enabled: true + VersionAdded: '1.7' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain +RSpec/MessageExpectation: + Description: Checks for consistent message expectation style. + Enabled: false + EnforcedStyle: allow + SupportedStyles: + - allow + - expect + VersionAdded: '1.7' + VersionChanged: '1.8' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation +RSpec/MessageSpies: + Description: Checks that message expectations are set using spies. + Enabled: true + EnforcedStyle: have_received + SupportedStyles: + - have_received + - receive + VersionAdded: '1.9' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies +RSpec/MissingExampleGroupArgument: + Description: Checks that the first argument to an example group is not empty. + Enabled: true + VersionAdded: '1.28' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument +RSpec/MultipleDescribes: + Description: Checks for multiple top-level example groups. + Enabled: true + VersionAdded: '1.0' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes +RSpec/MultipleExpectations: + Description: Checks if examples contain too many `expect` calls. + Enabled: true + Max: 1 + VersionAdded: '1.7' + VersionChanged: '1.21' + StyleGuide: https://rspec.rubystyle.guide/#expectation-per-example + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations +RSpec/MultipleMemoizedHelpers: + Description: Checks if example groups contain too many `let` and `subject` calls. + Enabled: true + AllowSubject: true + Max: 5 + VersionAdded: '1.43' + StyleGuide: https://rspec.rubystyle.guide/#let-blocks + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers +RSpec/MultipleSubjects: + Description: Checks if an example group defines `subject` multiple times. + Enabled: true + VersionAdded: '1.16' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects +RSpec/NamedSubject: + Description: Checks for explicitly referenced test subjects. + Enabled: true + EnforcedStyle: always + SupportedStyles: + - always + - named_only + IgnoreSharedExamples: true + VersionAdded: 1.5.3 + VersionChanged: '2.15' + StyleGuide: https://rspec.rubystyle.guide/#use-subject + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject +RSpec/NestedGroups: + Description: Checks for nested example groups. + Enabled: true + Max: 3 + AllowedGroups: [] + VersionAdded: '1.7' + VersionChanged: '2.13' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups +RSpec/NoExpectationExample: + Description: Checks if an example contains any expectation. + Enabled: pending + Safe: false + VersionAdded: '2.13' + VersionChanged: '2.14' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NoExpectationExample + AllowedPatterns: + - "^expect_" + - "^assert_" +RSpec/NotToNot: + Description: Checks for consistent method usage for negating expectations. + Enabled: true + EnforcedStyle: not_to + SupportedStyles: + - not_to + - to_not + VersionAdded: '1.4' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot +RSpec/OverwritingSetup: + Description: Checks if there is a let/subject that overwrites an existing one. + Enabled: true + VersionAdded: '1.14' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup +RSpec/Pending: + Description: Checks for any pending or skipped examples. + Enabled: false + VersionAdded: '1.25' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending +RSpec/PendingWithoutReason: + Description: Checks for pending or skipped examples without reason. + Enabled: pending + VersionAdded: '2.16' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason +RSpec/PredicateMatcher: + Description: Prefer using predicate matcher over using predicate method directly. + Enabled: true + Strict: true + EnforcedStyle: inflected + AllowedExplicitMatchers: [] + SupportedStyles: + - inflected + - explicit + SafeAutoCorrect: false + VersionAdded: '1.16' + StyleGuide: https://rspec.rubystyle.guide/#predicate-matchers + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher +RSpec/ReceiveCounts: + Description: Check for `once` and `twice` receive counts matchers usage. + Enabled: true + VersionAdded: '1.26' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts +RSpec/ReceiveNever: + Description: Prefer `not_to receive(...)` over `receive(...).never`. + Enabled: true + VersionAdded: '1.28' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever +RSpec/RepeatedDescription: + Description: Check for repeated description strings in example groups. + Enabled: true + VersionAdded: '1.9' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription +RSpec/RepeatedExample: + Description: Check for repeated examples within example groups. + Enabled: true + VersionAdded: '1.10' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample +RSpec/RepeatedExampleGroupBody: + Description: Check for repeated describe and context block body. + Enabled: true + VersionAdded: '1.38' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody +RSpec/RepeatedExampleGroupDescription: + Description: Check for repeated example group descriptions. + Enabled: true + VersionAdded: '1.38' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription +RSpec/RepeatedIncludeExample: + Description: Check for repeated include of shared examples. + Enabled: true + VersionAdded: '1.44' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample +RSpec/ReturnFromStub: + Description: Checks for consistent style of stub's return setting. + Enabled: true + EnforcedStyle: and_return + SupportedStyles: + - and_return + - block + VersionAdded: '1.16' + VersionChanged: '1.22' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub +RSpec/ScatteredLet: + Description: Checks for let scattered across the example group. + Enabled: true + VersionAdded: '1.14' + VersionChanged: '1.39' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet +RSpec/ScatteredSetup: + Description: Checks for setup scattered across multiple hooks in an example group. + Enabled: true + VersionAdded: '1.10' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup +RSpec/SharedContext: + Description: Checks for proper shared_context and shared_examples usage. + Enabled: true + VersionAdded: '1.13' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext +RSpec/SharedExamples: + Description: Enforces use of string to titleize shared examples. + Enabled: true + VersionAdded: '1.25' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples +RSpec/SingleArgumentMessageChain: + Description: Checks that chains of messages contain more than one element. + Enabled: true + VersionAdded: '1.9' + VersionChanged: '1.10' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain +RSpec/SortMetadata: + Description: Sort RSpec metadata alphabetically. + Enabled: pending + VersionAdded: '2.14' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SortMetadata +RSpec/StubbedMock: + Description: Checks that message expectations do not have a configured response. + Enabled: true + VersionAdded: '1.44' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock +RSpec/SubjectDeclaration: + Description: Ensure that subject is defined using subject helper. + Enabled: pending + VersionAdded: '2.5' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration +RSpec/SubjectStub: + Description: Checks for stubbed test subjects. + Enabled: true + VersionAdded: '1.7' + VersionChanged: '2.8' + StyleGuide: https://rspec.rubystyle.guide/#dont-stub-subject + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub +RSpec/UnspecifiedException: + Description: Checks for a specified error in checking raised errors. + Enabled: true + VersionAdded: '1.30' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException +RSpec/VariableDefinition: + Description: Checks that memoized helpers names are symbols or strings. + Enabled: true + EnforcedStyle: symbols + SupportedStyles: + - symbols + - strings + VersionAdded: '1.40' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition +RSpec/VariableName: + Description: Checks that memoized helper names use the configured style. + Enabled: true + EnforcedStyle: snake_case + SupportedStyles: + - snake_case + - camelCase + AllowedPatterns: [] + VersionAdded: '1.40' + VersionChanged: '2.13' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName +RSpec/VerifiedDoubleReference: + Description: Checks for consistent verified double reference style. + Enabled: pending + SafeAutoCorrect: false + EnforcedStyle: constant + SupportedStyles: + - constant + - string + VersionAdded: 2.10.0 + VersionChanged: '2.12' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubleReference +RSpec/VerifiedDoubles: + Description: Prefer using verifying doubles over normal doubles. + Enabled: true + IgnoreNameless: true + IgnoreSymbolicNames: false + VersionAdded: 1.2.1 + VersionChanged: '1.5' + StyleGuide: https://rspec.rubystyle.guide/#doubles + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles +RSpec/VoidExpect: + Description: Checks void `expect()`. + Enabled: true + VersionAdded: '1.16' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect +RSpec/Yield: + Description: Checks for calling a block within a stub. + Enabled: true + VersionAdded: '1.32' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield +RSpec/Capybara: + Enabled: true + Include: *1 + Language: *2 +RSpec/Capybara/CurrentPathExpectation: + Description: Checks that no expectations are set on Capybara's `current_path`. + Enabled: true + VersionAdded: '1.18' + VersionChanged: '2.0' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation +RSpec/Capybara/FeatureMethods: + Description: Checks for consistent method usage in feature specs. + Enabled: true + EnabledMethods: [] + VersionAdded: '1.17' + VersionChanged: '2.0' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods +RSpec/Capybara/MatchStyle: + Description: Checks for usage of deprecated style methods. + Enabled: pending + VersionAdded: '2.17' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/MatchStyle +RSpec/Capybara/NegationMatcher: + Description: Enforces use of `have_no_*` or `not_to` for negated expectations. + Enabled: pending + VersionAdded: '2.14' + EnforcedStyle: not_to + SupportedStyles: + - have_no + - not_to + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/NegationMatcher +RSpec/Capybara/SpecificActions: + Description: Checks for there is a more specific actions offered by Capybara. + Enabled: pending + VersionAdded: '2.14' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificActions +RSpec/Capybara/SpecificFinders: + Description: Checks if there is a more specific finder offered by Capybara. + Enabled: pending + VersionAdded: '2.13' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificFinders +RSpec/Capybara/SpecificMatcher: + Description: Checks for there is a more specific matcher offered by Capybara. + Enabled: pending + VersionAdded: '2.12' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificMatcher +RSpec/Capybara/VisibilityMatcher: + Description: Checks for boolean visibility in Capybara finders. + Enabled: true + VersionAdded: '1.39' + VersionChanged: '2.0' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher +RSpec/FactoryBot: + Enabled: true + Include: *1 + Language: *2 +RSpec/FactoryBot/AttributeDefinedStatically: + Description: Always declare attribute values as blocks. + Enabled: true + Include: + - spec/factories.rb + - spec/factories/**/*.rb + - features/support/factories/**/*.rb + VersionAdded: '1.28' + VersionChanged: '2.0' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically +RSpec/FactoryBot/ConsistentParenthesesStyle: + Description: Use a consistent style for parentheses in factory bot calls. + Enabled: pending + EnforcedStyle: require_parentheses + SupportedStyles: + - require_parentheses + - omit_parentheses + VersionAdded: '2.14' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/ConsistentParenthesesStyle +RSpec/FactoryBot/CreateList: + Description: Checks for create_list usage. + Enabled: true + Include: + - "**/*_spec.rb" + - "**/spec/**/*" + - spec/factories.rb + - spec/factories/**/*.rb + - features/support/factories/**/*.rb + EnforcedStyle: create_list + SupportedStyles: + - create_list + - n_times + VersionAdded: '1.25' + VersionChanged: '2.0' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList +RSpec/FactoryBot/FactoryClassName: + Description: Use string value when setting the class attribute explicitly. + Enabled: true + Include: + - spec/factories.rb + - spec/factories/**/*.rb + - features/support/factories/**/*.rb + VersionAdded: '1.37' + VersionChanged: '2.0' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName +RSpec/FactoryBot/FactoryNameStyle: + Description: Checks for name style for argument of FactoryBot::Syntax::Methods. + Enabled: pending + VersionAdded: '2.16' + EnforcedStyle: symbol + SupportedStyles: + - symbol + - string + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle +RSpec/FactoryBot/SyntaxMethods: + Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs. + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.7' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods +RSpec/Rails: + Enabled: true + Include: *1 + Language: *2 +RSpec/Rails/AvoidSetupHook: + Description: Checks that tests use RSpec `before` hook over Rails `setup` method. + Enabled: pending + VersionAdded: '2.4' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook +RSpec/Rails/HaveHttpStatus: + Description: Checks that tests use `have_http_status` instead of equality matchers. + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.12' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus +RSpec/Rails/HttpStatus: + Description: Enforces use of symbolic or numeric value to describe HTTP status. + Enabled: true + EnforcedStyle: symbolic + SupportedStyles: + - numeric + - symbolic + VersionAdded: '1.23' + VersionChanged: '2.0' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus +RSpec/Rails/InferredSpecType: + Description: Identifies redundant spec type. + Enabled: pending + Safe: false + VersionAdded: '2.14' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/InferredSpecType + Inferences: + channels: channel + controllers: controller + features: feature + generator: generator + helpers: helper + jobs: job + mailboxes: mailbox + mailers: mailer + models: model + requests: request + integration: request + api: request + routing: routing + system: system + views: view +RSpec/Rails/MinitestAssertions: + Description: Check if using Minitest matchers. + Enabled: pending + VersionAdded: '2.17' + Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions From 9fd4371215acf0f8ce71d1e4a99a6595c8583f22 Mon Sep 17 00:00:00 2001 From: Sam Bostock Date: Mon, 13 Feb 2023 23:48:39 -0500 Subject: [PATCH 2/2] Extract rubocop.infer.yml --- rubocop.infer.yml | 16 + rubocop.yml | 16 - test/fixtures/full_config.yml | 2629 +-------------------------------- 3 files changed, 19 insertions(+), 2642 deletions(-) create mode 100644 rubocop.infer.yml diff --git a/rubocop.infer.yml b/rubocop.infer.yml new file mode 100644 index 00000000..e931ee61 --- /dev/null +++ b/rubocop.infer.yml @@ -0,0 +1,16 @@ +<% + # Identify installed RuboCop plugins to configure + plugin_configs = { + "rubocop" => "rubocop.yml", + "rubocop-graphql" => "rubocop.graphql.yml", + "rubocop-minitest" => "rubocop.minitest.yml", + "rubocop-performance" => "rubocop.performance.yml", + "rubocop-rails" => "rubocop.rails.yml", + "rubocop-rake" => "rubocop.graphql.yml", + "rubocop-rspec" => "rubocop.rspec.yml", + }.select { |plugin_name, _| Gem.loaded_specs.include?(plugin_name) } +%> + +require: <%= plugin_configs.keys.to_json %> + +inherit_from: <%= plugin_configs.values.to_json %> diff --git a/rubocop.yml b/rubocop.yml index 0353d3ca..002a592a 100644 --- a/rubocop.yml +++ b/rubocop.yml @@ -3,22 +3,6 @@ inherit_mode: - Exclude - Include -<% - # Identify installed RuboCop plugins to configure - plugin_configs = { - "rubocop-graphql" => "rubocop.graphql.yml", - "rubocop-minitest" => "rubocop.minitest.yml", - "rubocop-performance" => "rubocop.performance.yml", - "rubocop-rails" => "rubocop.rails.yml", - "rubocop-rake" => "rubocop.graphql.yml", - "rubocop-rspec" => "rubocop.rspec.yml", - }.select { |plugin_name, _| Gem.loaded_specs.include?(plugin_name) } -%> - -require: <%= plugin_configs.keys.to_json %> - -inherit_from: <%= plugin_configs.values.to_json %> - AllCops: StyleGuideBaseURL: https://shopify.github.io/ruby-style-guide/ diff --git a/test/fixtures/full_config.yml b/test/fixtures/full_config.yml index 03ce28e1..fc4690c0 100644 --- a/test/fixtures/full_config.yml +++ b/test/fixtures/full_config.yml @@ -63,11 +63,6 @@ AllCops: - "/tmp/**/*" - "/vendor/**/*" - "/.git/**/*" - - "/bin/*" - - "/db/*schema.rb" - - "/log/**/*" - - "/public/**/*" - - "/storage/**/*" DefaultFormatter: progress DisplayCopNames: true DisplayStyleGuide: false @@ -97,8 +92,7 @@ AllCops: - rake rubocop-graphql: - graphql - ActiveSupportExtensionsEnabled: true - TargetRailsVersion: + ActiveSupportExtensionsEnabled: false Bundler/DuplicatedGem: Description: Checks for duplicate gem entries in Gemfile. Enabled: true @@ -1491,39 +1485,9 @@ Lint/NumberConversion: VersionAdded: '0.53' VersionChanged: '1.1' SafeAutoCorrect: false - AllowedMethods: - - ago - - from_now - - second - - seconds - - minute - - minutes - - hour - - hours - - day - - days - - week - - weeks - - fortnight - - fortnights - - in_milliseconds + AllowedMethods: [] AllowedPatterns: [] - IgnoredMethods: - - ago - - from_now - - second - - seconds - - minute - - minutes - - hour - - hours - - day - - days - - week - - weeks - - fortnight - - fortnights - - in_milliseconds + IgnoredMethods: [] IgnoredClasses: - Time - DateTime @@ -1922,11 +1886,6 @@ Metrics/BlockLength: IgnoredMethods: [] Exclude: - "/**/*.gemspec" - - "**/*_spec.rb" - - "**/spec/**/*" - inherit_mode: - merge: - - Exclude Metrics/BlockNesting: Description: Avoid excessive block nesting. StyleGuide: "#three-is-the-number-thou-shalt-count" @@ -4023,8 +3982,6 @@ Style/SymbolProc: AllowMethodsWithArguments: false AllowedMethods: - define_method - - mail - - respond_to AllowedPatterns: [] IgnoredMethods: [] AllowComments: false @@ -4213,2587 +4170,7 @@ Style/ZeroLengthPredicate: Safe: false VersionAdded: '0.37' VersionChanged: '0.39' -GraphQL: - Enabled: true - Include: - - "**/graphql/**/*" - Exclude: - - "/spec/**/*" - - "/test/**/*" -GraphQL/ArgumentDescription: - Enabled: true - VersionAdded: '0.80' - Description: Ensures all arguments have a description -GraphQL/ArgumentName: - Enabled: true - VersionAdded: '0.80' - Description: This cop checks whether argument names are snake_case -GraphQL/ArgumentUniqueness: - Enabled: true - VersionAdded: '0.80' - Description: This cop enforces arguments to be defined once per block -GraphQL/ResolverMethodLength: - Enabled: true - VersionAdded: '0.80' - Description: Checks resolver methods are not too long - Max: 10 - CountComments: false - ExcludedMethods: [] -GraphQL/FieldDefinitions: - Enabled: true - VersionAdded: '0.80' - Description: Checks consistency of field definitions - EnforcedStyle: group_definitions - SupportedStyles: - - group_definitions - - define_resolver_after_definition -GraphQL/MultipleFieldDefinitions: - Enabled: true - Description: Ensures that fields with multiple definitions are grouped together -GraphQL/FieldDescription: - Enabled: true - VersionAdded: '0.80' - Description: Ensures all fields have a description -GraphQL/FieldHashKey: - Enabled: true - VersionAdded: '0.80' - Description: Checks :hash_key option is used for appropriate fields -GraphQL/FieldMethod: - Enabled: true - VersionAdded: '0.80' - Description: Checks :method option is used for appropriate fields -GraphQL/FieldName: - Enabled: true - VersionAdded: '0.80' - Description: This cop checks whether field names are snake_case - SafeAutoCorrect: false -GraphQL/FieldUniqueness: - Enabled: true - VersionAdded: '0.80' - Description: This cop enforces fields to be defined once -GraphQL/ExtractInputType: - Enabled: true - VersionAdded: '0.80' - Description: Suggests using input type instead of many arguments - MaxArguments: 2 - Include: - - "**/graphql/mutations/**/*.rb" -GraphQL/ExtractType: - Enabled: true - VersionAdded: '0.80' - Description: Suggests extracting fields with common prefixes to the separate type - MaxFields: 2 - Prefixes: - - is - - has - - with - - avg - - min - - max -GraphQL/LegacyDsl: - Enabled: true - VersionAdded: '0.80' - Description: Checks that types are defined with class-based API -GraphQL/ObjectDescription: - Enabled: true - VersionAdded: '0.80' - Description: Ensures all types have a description - Exclude: - - "/**/*_schema.rb" - - "/**/base_*.rb" - - "/**/graphql/query_context.rb" -GraphQL/OrderedArguments: - Enabled: true - VersionAdded: '0.80' - Description: Arguments should be alphabetically sorted within groups -GraphQL/OrderedFields: - Enabled: true - VersionAdded: '0.80' - Description: Fields should be alphabetically sorted within groups -GraphQL/UnusedArgument: - Enabled: true - Description: Arguments should either be listed explicitly or **rest should be in - the resolve signature -GraphQL/UnnecessaryFieldAlias: - Enabled: true - Description: Field aliases should be different than their field names -GraphQL/UnnecessaryArgumentCamelize: - Enabled: true - Description: Camelize isn't necessary if the argument name doesn't contain underscores -GraphQL/UnnecessaryFieldCamelize: - Enabled: true - Description: Camelize isn't necessary if the field name doesn't contain underscores -Minitest: - Enabled: true - DocumentationBaseURL: https://docs.rubocop.org/rubocop-minitest - Include: - - "**/test/**/*" - - "**/*_test.rb" -Minitest/AssertEmpty: - Description: This cop enforces the test to use `assert_empty` instead of using `assert(object.empty?)`. - StyleGuide: https://minitest.rubystyle.guide#assert-empty - Enabled: true - VersionAdded: '0.2' -Minitest/AssertEmptyLiteral: - Description: This cop enforces the test to use `assert_empty` instead of using `assert_equal([], - object)`. - Enabled: true - VersionAdded: '0.5' - VersionChanged: '0.11' -Minitest/AssertEqual: - Description: This cop enforces the test to use `assert_equal` instead of using `assert(expected - == actual)`. - StyleGuide: https://minitest.rubystyle.guide#assert-equal-arguments-order - Enabled: true - VersionAdded: '0.4' -Minitest/AssertInDelta: - Description: This cop enforces the test to use `assert_in_delta` instead of using - `assert_equal` to compare floats. - StyleGuide: https://minitest.rubystyle.guide/#assert-in-delta - Enabled: pending - VersionAdded: '0.10' -Minitest/AssertIncludes: - Description: This cop enforces the test to use `assert_includes` instead of using - `assert(collection.include?(object))`. - StyleGuide: https://minitest.rubystyle.guide#assert-includes - Enabled: true - VersionAdded: '0.2' -Minitest/AssertInstanceOf: - Description: This cop enforces the test to use `assert_instance_of(Class, object)` - over `assert(object.instance_of?(Class))` - StyleGuide: https://minitest.rubystyle.guide#assert-instance-of - Enabled: true - VersionAdded: '0.4' -Minitest/AssertKindOf: - Description: This cop enforces the test to use `assert_kind_of(Class, object)` over - `assert(object.kind_of?(Class))` - StyleGuide: https://github.com/rubocop/minitest-style-guide#assert-kind-of - Enabled: pending - VersionAdded: '0.10' -Minitest/AssertMatch: - Description: This cop enforces the test to use `assert_match` instead of using `assert(matcher.match(object))`. - StyleGuide: https://minitest.rubystyle.guide#assert-match - Enabled: true - VersionAdded: '0.6' -Minitest/AssertNil: - Description: This cop enforces the test to use `assert_nil` instead of using `assert_equal(nil, - something)` or `assert(something.nil?)`. - StyleGuide: https://minitest.rubystyle.guide#assert-nil - Enabled: true - VersionAdded: '0.1' -Minitest/AssertOutput: - Description: This cop checks for opportunities to use `assert_output`. - StyleGuide: https://minitest.rubystyle.guide/#assert-output - Enabled: pending - VersionAdded: '0.10' -Minitest/AssertPathExists: - Description: This cop enforces the test to use `assert_path_exists` instead of using - `assert(File.exist?(path))`. - StyleGuide: https://minitest.rubystyle.guide/#assert-path-exists - Enabled: pending - VersionAdded: '0.10' -Minitest/AssertPredicate: - Description: This cop enforces the test to use `assert_predicate` instead of using - `assert(obj.a_predicate_method?)`. - StyleGuide: https://minitest.rubystyle.guide/#assert-predicate - Enabled: pending - VersionAdded: '0.18' -Minitest/AssertRaisesCompoundBody: - Description: This cop enforces the block body of `assert_raises { ... }` to be reduced - to only the raising code. - Enabled: pending - VersionAdded: '0.21' -Minitest/AssertRaisesWithRegexpArgument: - Description: This cop enforces checks for regular expression literals passed to - `assert_raises`. - Enabled: pending - Severity: warning - VersionAdded: '0.22' - VersionChanged: '0.26' -Minitest/AssertRespondTo: - Description: This cop enforces the test to use `assert_respond_to(object, :do_something)` - over `assert(object.respond_to?(:do_something))`. - StyleGuide: https://minitest.rubystyle.guide#assert-responds-to-method - Enabled: true - VersionAdded: '0.3' -Minitest/AssertSame: - Description: Enforces the use of `assert_same(expected, actual)` over `assert(expected.equal?(actual))`. - StyleGuide: https://minitest.rubystyle.guide#assert-same - Enabled: pending - VersionAdded: '0.26' -Minitest/AssertSilent: - Description: This cop enforces the test to use `assert_silent { ... }` instead of - using `assert_output('', '') { ... }`. - StyleGuide: https://github.com/rubocop/minitest-style-guide#assert-silent - Enabled: pending - VersionAdded: '0.10' -Minitest/AssertTruthy: - Description: This cop enforces the test to use `assert(actual)` instead of using - `assert_equal(true, actual)`. - StyleGuide: https://minitest.rubystyle.guide#assert-truthy - Enabled: true - Safe: false - VersionAdded: '0.2' - VersionChanged: '0.27' -Minitest/AssertWithExpectedArgument: - Description: This cop tries to detect when a user accidentally used `assert` when - they meant to use `assert_equal`. - Enabled: pending - Severity: warning - Safe: false - VersionAdded: '0.11' - VersionChanged: '0.26' -Minitest/AssertionInLifecycleHook: - Description: This cop checks for usage of assertions in lifecycle hooks. - Enabled: pending - VersionAdded: '0.10' -Minitest/DuplicateTestRun: - Description: This cop detects duplicate test runs caused by one test class inheriting - from another. - StyleGuide: https://minitest.rubystyle.guide/#subclassing-test-cases - Enabled: pending - VersionAdded: '0.19' -Minitest/EmptyLineBeforeAssertionMethods: - Description: Add empty line before assertion methods. - Enabled: pending - VersionAdded: '0.23' -Minitest/GlobalExpectations: - Description: This cop checks for deprecated global expectations. - StyleGuide: https://minitest.rubystyle.guide#global-expectations - Enabled: true - Severity: warning - EnforcedStyle: any - Include: - - "**/test/**/*" - - "**/*_test.rb" - - "**/spec/**/*" - - "**/*_spec.rb" - SupportedStyles: - - _ - - any - - expect - - value - VersionAdded: '0.7' - VersionChanged: '0.26' -Minitest/LiteralAsActualArgument: - Description: This cop enforces correct order of `expected` and `actual` arguments - for `assert_equal`. - StyleGuide: https://minitest.rubystyle.guide/#assert-equal-arguments-order - Enabled: pending - VersionAdded: '0.10' -Minitest/MultipleAssertions: - Description: This cop checks if test cases contain too many assertion calls. - Enabled: pending - VersionAdded: '0.10' - Max: 3 -Minitest/NoAssertions: - Description: This cop checks for at least one assertion (or flunk) in tests. - Enabled: false - VersionAdded: '0.12' -Minitest/NonPublicTestMethod: - Description: Detects non `public` (marked as `private` or `protected`) test methods. - Enabled: pending - Severity: warning - VersionAdded: '0.27' -Minitest/RefuteEmpty: - Description: This cop enforces to use `refute_empty` instead of using `refute(object.empty?)`. - StyleGuide: https://minitest.rubystyle.guide#refute-empty - Enabled: true - VersionAdded: '0.3' -Minitest/RefuteEqual: - Description: Check if your test uses `refute_equal` instead of `assert(expected - != object)` or `assert(! expected == object))`. - StyleGuide: https://minitest.rubystyle.guide#refute-equal - Enabled: true - VersionAdded: '0.3' -Minitest/RefuteFalse: - Description: Check if your test uses `refute(actual)` instead of `assert_equal(false, - actual)`. - StyleGuide: https://minitest.rubystyle.guide#refute-false - Enabled: true - Safe: false - VersionAdded: '0.3' - VersionChanged: '0.27' -Minitest/RefuteInDelta: - Description: This cop enforces the test to use `refute_in_delta` instead of using - `refute_equal` to compare floats. - StyleGuide: https://minitest.rubystyle.guide/#refute-in-delta - Enabled: pending - VersionAdded: '0.10' -Minitest/RefuteIncludes: - Description: This cop enforces the test to use `refute_includes` instead of using - `refute(collection.include?(object))`. - StyleGuide: https://minitest.rubystyle.guide#refute-includes - Enabled: true - VersionAdded: '0.3' -Minitest/RefuteInstanceOf: - Description: This cop enforces the test to use `refute_instance_of(Class, object)` - over `refute(object.instance_of?(Class))`. - StyleGuide: https://minitest.rubystyle.guide#refute-instance-of - Enabled: true - VersionAdded: '0.4' -Minitest/RefuteKindOf: - Description: This cop enforces the test to use `refute_kind_of(Class, object)` over - `refute(object.kind_of?(Class))`. - StyleGuide: https://github.com/rubocop/minitest-style-guide#refute-kind-of - Enabled: pending - VersionAdded: '0.10' -Minitest/RefuteMatch: - Description: This cop enforces the test to use `refute_match` instead of using `refute(matcher.match(object))`. - StyleGuide: https://minitest.rubystyle.guide#refute-match - Enabled: true - VersionAdded: '0.6' -Minitest/RefuteNil: - Description: This cop enforces the test to use `refute_nil` instead of using `refute_equal(nil, - something)` or `refute(something.nil?)`. - StyleGuide: https://minitest.rubystyle.guide#refute-nil - Enabled: true - VersionAdded: '0.2' -Minitest/RefutePathExists: - Description: This cop enforces the test to use `refute_path_exists` instead of using - `refute(File.exist?(path))`. - StyleGuide: https://minitest.rubystyle.guide/#refute-path-exists - Enabled: pending - VersionAdded: '0.10' -Minitest/RefutePredicate: - Description: This cop enforces the test to use `refute_predicate` instead of using - `refute(obj.a_predicate_method?)`. - StyleGuide: https://minitest.rubystyle.guide/#refute-predicate - Enabled: pending - VersionAdded: '0.18' -Minitest/RefuteRespondTo: - Description: This cop enforces the test to use `refute_respond_to(object, :do_something)` - over `refute(object.respond_to?(:do_something))`. - StyleGuide: https://minitest.rubystyle.guide#refute-respond-to - Enabled: true - VersionAdded: '0.4' -Minitest/RefuteSame: - Description: Enforces the use of `refute_same(expected, actual)` over `refute(expected.equal?(actual))`. - StyleGuide: https://minitest.rubystyle.guide#refute-same - Enabled: pending - VersionAdded: '0.26' -Minitest/SkipEnsure: - Description: Checks that `ensure` call even if `skip`. - Enabled: pending - Severity: warning - VersionAdded: '0.20' - VersionChanged: '0.26' -Minitest/SkipWithoutReason: - Description: Checks for skipped tests missing the skipping reason. - Enabled: pending - VersionAdded: '0.24' -Minitest/TestFileName: - Description: Checks if test file names start with `test_` or end with `_test.rb`. - StyleGuide: https://minitest.rubystyle.guide/#file-naming - Enabled: pending - VersionAdded: '0.26' -Minitest/TestMethodName: - Description: This cop enforces that test method names start with `test_` prefix. - Enabled: pending - VersionAdded: '0.10' -Minitest/UnreachableAssertion: - Description: This cop checks for an `assert_raises` block containing any unreachable - assertions. - Enabled: pending - Severity: warning - VersionAdded: '0.14' - VersionChanged: '0.26' -Minitest/UnspecifiedException: - Description: This cop checks for a specified error in `assert_raises`. - StyleGuide: https://minitest.rubystyle.guide#unspecified-exception - Enabled: pending - VersionAdded: '0.10' -Minitest/UselessAssertion: - Description: Detects useless assertions (assertions that either always pass or always - fail). - Enabled: pending - VersionAdded: '0.26' -Performance: - Enabled: true - DocumentationBaseURL: https://docs.rubocop.org/rubocop-performance -Performance/AncestorsInclude: - Description: Use `A <= B` instead of `A.ancestors.include?(B)`. - Reference: https://github.com/JuanitoFatas/fast-ruby#ancestorsinclude-vs--code - Enabled: pending - Safe: false - VersionAdded: '1.7' -Performance/ArraySemiInfiniteRangeSlice: - Description: Identifies places where slicing arrays with semi-infinite ranges can - be replaced by `Array#take` and `Array#drop`. - Enabled: false - Safe: false - VersionAdded: '1.9' -Performance/BigDecimalWithNumericArgument: - Description: Convert numeric literal to string and pass it to `BigDecimal`. - Enabled: pending - VersionAdded: '1.7' -Performance/BindCall: - Description: Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`. - Enabled: true - VersionAdded: '1.6' -Performance/BlockGivenWithExplicitBlock: - Description: Check block argument explicitly instead of using `block_given?`. - Enabled: pending - VersionAdded: '1.9' -Performance/Caller: - Description: Use `caller(n..n)` instead of `caller`. - Enabled: true - VersionAdded: '0.49' - VersionChanged: '1.9' -Performance/CaseWhenSplat: - Description: Reordering `when` conditions with a splat to the end of the `when` - branches can improve performance. - Enabled: false - SafeAutoCorrect: false - VersionAdded: '0.34' - VersionChanged: '1.13' -Performance/Casecmp: - Description: Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, - or `== upcase`.. - Reference: https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code - Enabled: true - Safe: false - VersionAdded: '0.36' -Performance/ChainArrayAllocation: - Description: Instead of chaining array methods that allocate new arrays, mutate - an existing array. - Reference: https://twitter.com/schneems/status/1034123879978029057 - Enabled: false - VersionAdded: '0.59' -Performance/CollectionLiteralInLoop: - Description: Extract Array and Hash literals outside of loops into local variables - or constants. - Enabled: pending - VersionAdded: '1.8' - MinSize: 1 -Performance/CompareWithBlock: - Description: Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`. - Enabled: true - VersionAdded: '0.46' -Performance/ConcurrentMonotonicTime: - Description: Use `Process.clock_gettime(Process::CLOCK_MONOTONIC)` instead of `Concurrent.monotonic_time`. - Reference: https://github.com/rails/rails/pull/43502 - Enabled: pending - VersionAdded: '1.12' -Performance/ConstantRegexp: - Description: Finds regular expressions with dynamic components that are all constants. - Enabled: pending - VersionAdded: '1.9' - VersionChanged: '1.10' -Performance/Count: - Description: Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`. - SafeAutoCorrect: false - Enabled: true - VersionAdded: '0.31' - VersionChanged: '1.8' -Performance/DeletePrefix: - Description: Use `delete_prefix` instead of `gsub`. - Enabled: true - Safe: false - SafeMultiline: true - VersionAdded: '1.6' - VersionChanged: '1.11' -Performance/DeleteSuffix: - Description: Use `delete_suffix` instead of `gsub`. - Enabled: true - Safe: false - SafeMultiline: true - VersionAdded: '1.6' - VersionChanged: '1.11' -Performance/Detect: - Description: Use `detect` instead of `select.first`, `find_all.first`, `filter.first`, - `select.last`, `find_all.last`, and `filter.last`. - Reference: https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code - SafeAutoCorrect: false - Enabled: true - VersionAdded: '0.30' - VersionChanged: '1.8' -Performance/DoubleStartEndWith: - Description: Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x, - ...) || str.{start,end}_with?(y, ...)`. - Enabled: true - VersionAdded: '0.36' - VersionChanged: '0.48' - IncludeActiveSupportAliases: false -Performance/EndWith: - Description: Use `end_with?` instead of a regex match anchored to the end of a string. - Reference: https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end - SafeAutoCorrect: false - Enabled: true - SafeMultiline: true - VersionAdded: '0.36' - VersionChanged: '1.10' -Performance/FixedSize: - Description: Do not compute the size of statically sized objects except in constants. - Enabled: true - VersionAdded: '0.35' -Performance/FlatMap: - Description: Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1)` - or `Enumerable#collect..Array#flatten(1)`. - Reference: https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code - Enabled: true - VersionAdded: '0.30' - EnabledForFlattenWithoutParams: false -Performance/InefficientHashSearch: - Description: Use `key?` or `value?` instead of `keys.include?` or `values.include?`. - Reference: https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code - Enabled: true - VersionAdded: '0.56' - Safe: false -Performance/IoReadlines: - Description: Use `IO.each_line` (`IO#each_line`) instead of `IO.readlines` (`IO#readlines`). - Reference: https://docs.gitlab.com/ee/development/performance.html#reading-from-files-and-other-data-sources - Enabled: false - VersionAdded: '1.7' -Performance/MapCompact: - Description: Use `filter_map` instead of `collection.map(&:do_something).compact`. - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '1.11' -Performance/MethodObjectAsBlock: - Description: Use block explicitly instead of block-passing a method object. - Reference: https://github.com/JuanitoFatas/fast-ruby#normal-way-to-apply-method-vs-method-code - Enabled: pending - VersionAdded: '1.9' -Performance/OpenStruct: - Description: Use `Struct` instead of `OpenStruct`. - Enabled: false - VersionAdded: '0.61' - Safe: false -Performance/RangeInclude: - Description: Use `Range#cover?` instead of `Range#include?` (or `Range#member?`). - Reference: https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code - Enabled: true - VersionAdded: '0.36' - VersionChanged: '1.7' - Safe: false -Performance/RedundantBlockCall: - Description: Use `yield` instead of `block.call`. - Reference: https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode - Enabled: true - VersionAdded: '0.36' -Performance/RedundantEqualityComparisonBlock: - Description: Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`, - or `Enumerable#none?` are compared with `===` or similar methods in block. - Reference: https://github.com/rails/rails/pull/41363 - Enabled: pending - Safe: false - VersionAdded: '1.10' -Performance/RedundantMatch: - Description: Use `=~` instead of `String#match` or `Regexp#match` in a context where - the returned `MatchData` is not needed. - Enabled: true - VersionAdded: '0.36' -Performance/RedundantMerge: - Description: Use Hash#[]=, rather than Hash#merge! with a single key-value pair. - Reference: https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code - Enabled: true - Safe: false - VersionAdded: '0.36' - VersionChanged: '1.11' - MaxKeyValuePairs: 2 -Performance/RedundantSortBlock: - Description: Use `sort` instead of `sort { |a, b| a <=> b }`. - Enabled: pending - VersionAdded: '1.7' -Performance/RedundantSplitRegexpArgument: - Description: Identifies places where `split` argument can be replaced from a deterministic - regexp to a string. - Enabled: pending - VersionAdded: '1.10' -Performance/RedundantStringChars: - Description: Checks for redundant `String#chars`. - Enabled: pending - VersionAdded: '1.7' -Performance/RegexpMatch: - Description: Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, - `Regexp#===`, or `=~` when `MatchData` is not used. - Reference: https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code- - Enabled: true - VersionAdded: '0.47' -Performance/ReverseEach: - Description: Use `reverse_each` instead of `reverse.each`. - Reference: https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code - Enabled: true - VersionAdded: '0.30' -Performance/ReverseFirst: - Description: Use `last(n).reverse` instead of `reverse.first(n)`. - Enabled: pending - VersionAdded: '1.7' -Performance/SelectMap: - Description: Use `filter_map` instead of `ary.select(&:foo).map(&:bar)`. - Enabled: false - VersionAdded: '1.11' -Performance/Size: - Description: Use `size` instead of `count` for counting the number of elements in - `Array` and `Hash`. - Reference: https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code - Enabled: true - VersionAdded: '0.30' -Performance/SortReverse: - Description: Use `sort.reverse` instead of `sort { |a, b| b <=> a }`. - Enabled: pending - VersionAdded: '1.7' -Performance/Squeeze: - Description: Use `squeeze('a')` instead of `gsub(/a+/, 'a')`. - Reference: https://github.com/JuanitoFatas/fast-ruby#remove-extra-spaces-or-other-contiguous-characters-code - Enabled: pending - VersionAdded: '1.7' -Performance/StartWith: - Description: Use `start_with?` instead of a regex match anchored to the beginning - of a string. - Reference: https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end - SafeAutoCorrect: false - Enabled: true - SafeMultiline: true - VersionAdded: '0.36' - VersionChanged: '1.10' -Performance/StringIdentifierArgument: - Description: Use symbol identifier argument instead of string identifier argument. - Enabled: pending - VersionAdded: '1.13' -Performance/StringInclude: - Description: Use `String#include?` instead of a regex match with literal-only pattern. - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '1.7' - VersionChanged: '1.12' -Performance/StringReplacement: - Description: Use `tr` instead of `gsub` when you are replacing the same number of - characters. Use `delete` instead of `gsub` when you are deleting characters. - Reference: https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code - Enabled: true - VersionAdded: '0.33' -Performance/Sum: - Description: Use `sum` instead of a custom array summation. - SafeAutoCorrect: false - Reference: https://blog.bigbinary.com/2016/11/02/ruby-2-4-introduces-enumerable-sum.html - Enabled: pending - VersionAdded: '1.8' - VersionChanged: '1.13' - OnlySumOrWithInitialValue: false -Performance/TimesMap: - Description: Checks for .times.map calls. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.36' - VersionChanged: '1.13' -Performance/UnfreezeString: - Description: Use unary plus to get an unfrozen string literal. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.50' - VersionChanged: '1.9' -Performance/UriDefaultParser: - Description: Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`. - Enabled: true - VersionAdded: '0.50' inherit_mode: merge: - Exclude - Include -Rails: - Enabled: true - DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails -Rails/ActionControllerFlashBeforeRender: - Description: Use `flash.now` instead of `flash` before `render`. - StyleGuide: https://rails.rubystyle.guide/#flash-before-render - Reference: https://api.rubyonrails.org/classes/ActionController/FlashBeforeRender.html - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.16' -Rails/ActionControllerTestCase: - Description: Use `ActionDispatch::IntegrationTest` instead of `ActionController::TestCase`. - StyleGuide: https://rails.rubystyle.guide/#integration-testing - Reference: https://api.rubyonrails.org/classes/ActionController/TestCase.html - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.14' - Include: - - "**/test/**/*.rb" -Rails/ActionFilter: - Description: Enforces consistent use of action filter methods. - Enabled: true - VersionAdded: '0.19' - EnforcedStyle: action - SupportedStyles: - - action - - filter - Include: - - app/controllers/**/*.rb - - app/mailers/**/*.rb -Rails/ActionOrder: - Description: Enforce consistent ordering of controller actions. - Enabled: pending - VersionAdded: '2.17' - ExpectedOrder: - - index - - show - - new - - edit - - create - - update - - destroy - Include: - - app/controllers/**/*.rb -Rails/ActiveRecordAliases: - Description: 'Avoid Active Record aliases: Use `update` instead of `update_attributes`. - Use `update!` instead of `update_attributes!`.' - Enabled: true - VersionAdded: '0.53' - SafeAutoCorrect: false -Rails/ActiveRecordCallbacksOrder: - Description: Order callback declarations in the order in which they will be executed. - StyleGuide: https://rails.rubystyle.guide/#callbacks-order - Enabled: pending - VersionAdded: '2.7' - Include: - - app/models/**/*.rb -Rails/ActiveRecordOverride: - Description: Check for overriding Active Record methods instead of using callbacks. - Enabled: true - VersionAdded: '0.67' - Include: - - app/models/**/*.rb -Rails/ActiveSupportAliases: - Description: 'Avoid ActiveSupport aliases of standard ruby methods: `String#starts_with?`, - `String#ends_with?`, `Array#append`, `Array#prepend`.' - Enabled: true - VersionAdded: '0.48' -Rails/ActiveSupportOnLoad: - Description: Use `ActiveSupport.on_load(...)` to patch Rails framework classes. - Enabled: pending - Reference: - - https://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html - - https://guides.rubyonrails.org/engines.html#available-load-hooks - SafeAutoCorrect: false - VersionAdded: '2.16' -Rails/AddColumnIndex: - Description: Rails migrations don't make use of a given `index` key, but also doesn't - given an error when it's used, so it makes it seem like an index might be used. - Enabled: pending - VersionAdded: '2.11' - Include: - - db/migrate/*.rb -Rails/AfterCommitOverride: - Description: Enforces that there is only one call to `after_commit` (and its aliases - - `after_create_commit`, `after_update_commit`, and `after_destroy_commit`) with - the same callback name per model. - Enabled: pending - VersionAdded: '2.8' -Rails/ApplicationController: - Description: Check that controllers subclass ApplicationController. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '2.4' - VersionChanged: '2.5' -Rails/ApplicationJob: - Description: Check that jobs subclass ApplicationJob. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.49' - VersionChanged: '2.5' -Rails/ApplicationMailer: - Description: Check that mailers subclass ApplicationMailer. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '2.4' - VersionChanged: '2.5' -Rails/ApplicationRecord: - Description: Check that models subclass ApplicationRecord. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.49' - VersionChanged: '2.5' -Rails/ArelStar: - Description: Enforces `Arel.star` instead of `"*"` for expanded columns. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '2.9' -Rails/AssertNot: - Description: Use `assert_not` instead of `assert !`. - Enabled: true - VersionAdded: '0.56' - Include: - - "**/test/**/*" -Rails/AttributeDefaultBlockValue: - Description: Pass method call in block for attribute option `default`. - Enabled: pending - VersionAdded: '2.9' - Include: - - app/models/**/* -Rails/BelongsTo: - Description: 'Use `optional: true` instead of `required: false` for `belongs_to` - relations.' - Enabled: true - VersionAdded: '0.62' -Rails/Blank: - Description: Enforces use of `blank?`. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.48' - VersionChanged: '2.10' - NilOrEmpty: true - NotPresent: true - UnlessPresent: true -Rails/BulkChangeTable: - Description: Check whether alter queries are combinable. - Enabled: true - VersionAdded: '0.57' - Database: - SupportedDatabases: - - mysql - - postgresql - Include: - - db/migrate/*.rb -Rails/CompactBlank: - Description: Checks if collection can be blank-compacted with `compact_blank`. - Enabled: pending - Safe: false - VersionAdded: '2.13' -Rails/ContentTag: - Description: Use `tag.something` instead of `tag(:something)`. - Reference: - - https://github.com/rubocop/rubocop-rails/issues/260 - - https://github.com/rails/rails/issues/25195 - - https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag - Enabled: true - VersionAdded: '2.6' - VersionChanged: '2.12' - Exclude: - - "/app/models/**/*.rb" - - "/config/**/*.rb" -Rails/CreateTableWithTimestamps: - Description: Checks the migration for which timestamps are not included when creating - a new table. - Enabled: true - VersionAdded: '0.52' - Include: - - db/migrate/*.rb - Exclude: - - "/db/migrate/*_create_active_storage_tables.active_storage.rb" -Rails/Date: - Description: Checks the correct usage of date aware methods, such as Date.today, - Date.current etc. - Enabled: true - VersionAdded: '0.30' - VersionChanged: '2.11' - EnforcedStyle: flexible - SupportedStyles: - - strict - - flexible - AllowToTime: true -Rails/DefaultScope: - Description: Avoid use of `default_scope`. - StyleGuide: https://rails.rubystyle.guide#avoid-default-scope - Enabled: false - VersionAdded: '2.7' -Rails/Delegate: - Description: Prefer delegate method for delegations. - Enabled: true - VersionAdded: '0.21' - VersionChanged: '0.50' - EnforceForPrefixed: true -Rails/DelegateAllowBlank: - Description: Do not use allow_blank as an option to delegate. - Enabled: true - VersionAdded: '0.44' -Rails/DeprecatedActiveModelErrorsMethods: - Description: Avoid manipulating ActiveModel errors hash directly. - Enabled: pending - Safe: false - VersionAdded: '2.14' - VersionChanged: '2.15' -Rails/DotSeparatedKeys: - Description: Enforces the use of dot-separated keys instead of `:scope` options - in `I18n` translation methods. - StyleGuide: https://rails.rubystyle.guide/#dot-separated-keys - Enabled: pending - VersionAdded: '2.15' -Rails/DuplicateAssociation: - Description: Don't repeat associations in a model. - Enabled: pending - VersionAdded: '2.14' -Rails/DuplicateScope: - Description: Multiple scopes share this same where clause. - Enabled: pending - VersionAdded: '2.14' -Rails/DurationArithmetic: - Description: Do not use duration as arithmetic operand with `Time.current`. - StyleGuide: https://rails.rubystyle.guide#duration-arithmetic - Enabled: pending - VersionAdded: '2.13' -Rails/DynamicFindBy: - Description: Use `find_by` instead of dynamic `find_by_*`. - StyleGuide: https://rails.rubystyle.guide#find_by - Enabled: true - Safe: false - VersionAdded: '0.44' - VersionChanged: '2.10' - Whitelist: - - find_by_sql - - find_by_token_for - AllowedMethods: - - find_by_sql - - find_by_token_for - AllowedReceivers: - - Gem::Specification - - page -Rails/EagerEvaluationLogMessage: - Description: Checks that blocks are used for interpolated strings passed to `Rails.logger.debug`. - Reference: https://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance - Enabled: pending - VersionAdded: '2.11' -Rails/EnumHash: - Description: Prefer hash syntax over array syntax when defining enums. - StyleGuide: https://rails.rubystyle.guide#enums - Enabled: true - VersionAdded: '2.3' - Include: - - app/models/**/*.rb -Rails/EnumUniqueness: - Description: Avoid duplicate integers in hash-syntax `enum` declaration. - Enabled: true - VersionAdded: '0.46' - Include: - - app/models/**/*.rb -Rails/EnvironmentComparison: - Description: Favor `Rails.env.production?` over `Rails.env == 'production'`. - Enabled: true - VersionAdded: '0.52' -Rails/EnvironmentVariableAccess: - Description: Do not access `ENV` directly after initialization. - Enabled: false - VersionAdded: '2.10' - VersionChanged: '2.11' - Include: - - app/**/*.rb - - lib/**/*.rb - Exclude: - - "/lib/**/*.rake" - AllowReads: false - AllowWrites: false -Rails/Exit: - Description: Favor `fail`, `break`, `return`, etc. over `exit` in application or - library code outside of Rake files to avoid exits during unit testing or running - in production. - Enabled: true - VersionAdded: '0.41' - Include: - - app/**/*.rb - - config/**/*.rb - - lib/**/*.rb - Exclude: - - "/lib/**/*.rake" -Rails/ExpandedDateRange: - Description: Checks for expanded date range. - StyleGuide: https://rails.rubystyle.guide/#date-time-range - Enabled: pending - VersionAdded: '2.11' -Rails/FilePath: - Description: Use `Rails.root.join` for file path joining. - Enabled: true - VersionAdded: '0.47' - VersionChanged: '2.4' - EnforcedStyle: slashes - SupportedStyles: - - slashes - - arguments -Rails/FindBy: - Description: Prefer find_by over where.first. - StyleGuide: https://rails.rubystyle.guide#find_by - Enabled: true - VersionAdded: '0.30' - VersionChanged: '2.11' - IgnoreWhereFirst: true - Include: - - app/models/**/*.rb -Rails/FindById: - Description: Favor the use of `find` over `where.take!`, `find_by!`, and `find_by_id!` - when you need to retrieve a single record by primary key when you expect it to - be found. - StyleGuide: https://rails.rubystyle.guide/#find - Enabled: pending - VersionAdded: '2.7' -Rails/FindEach: - Description: Prefer all.find_each over all.find. - StyleGuide: https://rails.rubystyle.guide#find-each - Enabled: true - VersionAdded: '0.30' - VersionChanged: '2.9' - Include: - - app/models/**/*.rb - AllowedMethods: - - order - - limit - - select - - lock - AllowedPatterns: [] - IgnoredMethods: - - order - - limit - - select - - lock -Rails/FreezeTime: - Description: Prefer `freeze_time` over `travel_to` with an argument of the current - time. - StyleGuide: https://rails.rubystyle.guide/#freeze-time - Enabled: pending - VersionAdded: '2.16' - SafeAutoCorrect: false -Rails/HasAndBelongsToMany: - Description: Prefer has_many :through to has_and_belongs_to_many. - StyleGuide: https://rails.rubystyle.guide#has-many-through - Enabled: true - VersionAdded: '0.12' - Include: - - app/models/**/*.rb -Rails/HasManyOrHasOneDependent: - Description: Define the dependent option to the has_many and has_one associations. - StyleGuide: https://rails.rubystyle.guide#has_many-has_one-dependent-option - Enabled: true - VersionAdded: '0.50' - Include: - - app/models/**/*.rb -Rails/HelperInstanceVariable: - Description: Do not use instance variables in helpers. - Enabled: true - VersionAdded: '2.0' - Include: - - app/helpers/**/*.rb -Rails/HttpPositionalArguments: - Description: Use keyword arguments instead of positional arguments in http method - calls. - Enabled: true - VersionAdded: '0.44' - Include: - - spec/**/* - - test/**/* -Rails/HttpStatus: - Description: Enforces use of symbolic or numeric value to define HTTP status. - Enabled: true - VersionAdded: '0.54' - VersionChanged: '2.11' - EnforcedStyle: symbolic - SupportedStyles: - - numeric - - symbolic -Rails/I18nLazyLookup: - Description: Checks for places where I18n "lazy" lookup can be used. - StyleGuide: https://rails.rubystyle.guide/#lazy-lookup - Reference: https://guides.rubyonrails.org/i18n.html#lazy-lookup - Enabled: pending - VersionAdded: '2.14' - Include: - - app/controllers/**/*.rb -Rails/I18nLocaleAssignment: - Description: Prefer the usage of `I18n.with_locale` instead of manually updating - `I18n.locale` value. - Enabled: pending - VersionAdded: '2.11' - Include: - - spec/**/*.rb - - test/**/*.rb -Rails/I18nLocaleTexts: - Description: Enforces use of I18n and locale files instead of locale specific strings. - StyleGuide: https://rails.rubystyle.guide/#locale-texts - Enabled: pending - VersionAdded: '2.14' -Rails/IgnoredColumnsAssignment: - Description: Looks for assignments of `ignored_columns` that override previous assignments. - StyleGuide: https://rails.rubystyle.guide/#append-ignored-columns - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.17' -Rails/IgnoredSkipActionFilterOption: - Description: Checks that `if` and `only` (or `except`) are not used together as - options of `skip_*` action filter. - Reference: https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options - Enabled: true - VersionAdded: '0.63' - Include: - - app/controllers/**/*.rb - - app/mailers/**/*.rb -Rails/IndexBy: - Description: Prefer `index_by` over `each_with_object`, `to_h`, or `map`. - Enabled: true - VersionAdded: '2.5' - VersionChanged: '2.8' -Rails/IndexWith: - Description: Prefer `index_with` over `each_with_object`, `to_h`, or `map`. - Enabled: true - VersionAdded: '2.5' - VersionChanged: '2.8' -Rails/Inquiry: - Description: Prefer Ruby's comparison operators over Active Support's `Array#inquiry` - and `String#inquiry`. - StyleGuide: https://rails.rubystyle.guide/#inquiry - Enabled: pending - VersionAdded: '2.7' -Rails/InverseOf: - Description: Checks for associations where the inverse cannot be determined automatically. - Enabled: true - VersionAdded: '0.52' - IgnoreScopes: false - Include: - - app/models/**/*.rb -Rails/LexicallyScopedActionFilter: - Description: Checks that methods specified in the filter's `only` or `except` options - are explicitly defined in the class. - StyleGuide: https://rails.rubystyle.guide#lexically-scoped-action-filter - Enabled: true - Safe: false - VersionAdded: '0.52' - Include: - - app/controllers/**/*.rb - - app/mailers/**/*.rb -Rails/LinkToBlank: - Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` - option passed to them.' - Reference: - - https://mathiasbynens.github.io/rel-noopener/ - - https://html.spec.whatwg.org/multipage/links.html#link-type-noopener - - https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer - Enabled: true - VersionAdded: '0.62' -Rails/MailerName: - Description: Mailer should end with `Mailer` suffix. - StyleGuide: https://rails.rubystyle.guide/#mailer-name - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.7' - Include: - - app/mailers/**/*.rb -Rails/MatchRoute: - Description: Don't use `match` to define any routes unless there is a need to map - multiple request types among [:get, :post, :patch, :put, :delete] to a single - action using the `:via` option. - StyleGuide: https://rails.rubystyle.guide/#no-match-routes - Enabled: pending - VersionAdded: '2.7' - Include: - - config/routes.rb - - config/routes/**/*.rb -Rails/MigrationClassName: - Description: The class name of the migration should match its file name. - Enabled: pending - VersionAdded: '2.14' - Include: - - db/migrate/*.rb -Rails/NegateInclude: - Description: Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`. - StyleGuide: https://rails.rubystyle.guide#exclude - Enabled: pending - Safe: false - VersionAdded: '2.7' - VersionChanged: '2.9' -Rails/NotNullColumn: - Description: Do not add a NOT NULL column without a default value. - Enabled: true - VersionAdded: '0.43' - Include: - - db/migrate/*.rb -Rails/OrderById: - Description: Do not use the `id` column for ordering. Use a timestamp column to - order chronologically. - StyleGuide: https://rails.rubystyle.guide/#order-by-id - Enabled: false - VersionAdded: '2.8' -Rails/Output: - Description: Checks for calls to puts, print, etc. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.15' - VersionChanged: '0.19' - Include: - - app/**/*.rb - - config/**/*.rb - - db/**/*.rb - - lib/**/*.rb -Rails/OutputSafety: - Description: The use of `html_safe` or `raw` may be a security risk. - Enabled: true - VersionAdded: '0.41' -Rails/Pick: - Description: Prefer `pick` over `pluck(...).first`. - StyleGuide: https://rails.rubystyle.guide#pick - Enabled: true - Safe: false - VersionAdded: '2.6' -Rails/Pluck: - Description: Prefer `pluck` over `map { ... }`. - StyleGuide: https://rails.rubystyle.guide#pluck - Enabled: pending - VersionAdded: '2.7' -Rails/PluckId: - Description: Use `ids` instead of `pluck(:id)` or `pluck(primary_key)`. - StyleGuide: https://rails.rubystyle.guide/#ids - Enabled: false - Safe: false - VersionAdded: '2.7' -Rails/PluckInWhere: - Description: Use `select` instead of `pluck` in `where` query methods. - Enabled: pending - Safe: false - VersionAdded: '2.7' - VersionChanged: '2.8' - EnforcedStyle: conservative - SupportedStyles: - - conservative - - aggressive -Rails/PluralizationGrammar: - Description: Checks for incorrect grammar when using methods like `3.day.ago`. - Enabled: true - VersionAdded: '0.35' -Rails/Presence: - Description: Checks code that can be written more easily using `Object#presence` - defined by Active Support. - Enabled: true - VersionAdded: '0.52' -Rails/Present: - Description: Enforces use of `present?`. - Enabled: true - VersionAdded: '0.48' - VersionChanged: '0.67' - NotNilAndNotEmpty: true - NotBlank: true - UnlessBlank: true -Rails/RakeEnvironment: - Description: Include `:environment` as a dependency for all Rake tasks. - Enabled: true - Safe: false - VersionAdded: '2.4' - VersionChanged: '2.6' - Include: - - "**/Rakefile" - - "**/*.rake" - Exclude: - - "/lib/capistrano/tasks/**/*.rake" -Rails/ReadWriteAttribute: - Description: Checks for read_attribute(:attr) and write_attribute(:attr, val). - StyleGuide: https://rails.rubystyle.guide#read-attribute - Enabled: true - VersionAdded: '0.20' - VersionChanged: '0.29' - Include: - - app/models/**/*.rb -Rails/RedundantAllowNil: - Description: Finds redundant use of `allow_nil` when `allow_blank` is set to certain - values in model validations. - Enabled: true - VersionAdded: '0.67' - Include: - - app/models/**/*.rb -Rails/RedundantForeignKey: - Description: Checks for associations where the `:foreign_key` option is redundant. - Enabled: true - VersionAdded: '2.6' -Rails/RedundantPresenceValidationOnBelongsTo: - Description: Checks for redundant presence validation on belongs_to association. - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.13' -Rails/RedundantReceiverInWithOptions: - Description: Checks for redundant receiver in `with_options`. - Enabled: true - VersionAdded: '0.52' -Rails/RedundantTravelBack: - Description: Checks for redundant `travel_back` calls. - Enabled: pending - VersionAdded: '2.12' - Include: - - spec/**/*.rb - - test/**/*.rb -Rails/ReflectionClassName: - Description: Use a string for `class_name` option value in the definition of a reflection. - Enabled: true - Safe: false - VersionAdded: '0.64' - VersionChanged: '2.10' -Rails/RefuteMethods: - Description: Use `assert_not` methods instead of `refute` methods. - Enabled: true - VersionAdded: '0.56' - EnforcedStyle: assert_not - SupportedStyles: - - assert_not - - refute - Include: - - "**/test/**/*" -Rails/RelativeDateConstant: - Description: Do not assign relative date to constants. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.48' - VersionChanged: '2.13' -Rails/RenderInline: - Description: Prefer using a template over inline rendering. - StyleGuide: https://rails.rubystyle.guide/#inline-rendering - Enabled: pending - VersionAdded: '2.7' -Rails/RenderPlainText: - Description: Prefer `render plain:` over `render text:`. - StyleGuide: https://rails.rubystyle.guide/#plain-text-rendering - Enabled: pending - VersionAdded: '2.7' - ContentTypeCompatibility: true -Rails/RequestReferer: - Description: Use consistent syntax for request.referer. - Enabled: true - VersionAdded: '0.41' - EnforcedStyle: referer - SupportedStyles: - - referer - - referrer -Rails/RequireDependency: - Description: Do not use `require_dependency` when running in Zeitwerk mode. `require_dependency` - is for autoloading in classic mode. - Reference: https://guides.rubyonrails.org/autoloading_and_reloading_constants.html - Enabled: false - VersionAdded: '2.10' -Rails/ReversibleMigration: - Description: Checks whether the change method of the migration file is reversible. - StyleGuide: https://rails.rubystyle.guide#reversible-migration - Reference: https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html - Enabled: true - VersionAdded: '0.47' - VersionChanged: '2.13' - Include: - - db/**/*.rb -Rails/ReversibleMigrationMethodDefinition: - Description: Checks whether the migration implements either a `change` method or - both an `up` and a `down` method. - Enabled: false - VersionAdded: '2.10' - VersionChanged: '2.13' - Include: - - db/**/*.rb -Rails/RootJoinChain: - Description: Use a single `#join` instead of chaining on `Rails.root` or `Rails.public_path`. - Enabled: pending - VersionAdded: '2.13' -Rails/RootPathnameMethods: - Description: Use `Rails.root` IO methods instead of passing it to `File`. - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.16' -Rails/RootPublicPath: - Description: Favor `Rails.public_path` over `Rails.root` with `'public'`. - Enabled: pending - VersionAdded: '2.15' -Rails/SafeNavigation: - Description: Use Ruby's safe navigation operator (`&.`) instead of `try!`. - Enabled: true - VersionAdded: '0.43' - ConvertTry: false -Rails/SafeNavigationWithBlank: - Description: Avoid `foo&.blank?` in conditionals. - Enabled: true - VersionAdded: '2.4' - SafeAutoCorrect: false -Rails/SaveBang: - Description: Identifies possible cases where Active Record save! or related should - be used. - StyleGuide: https://rails.rubystyle.guide#save-bang - Enabled: false - VersionAdded: '0.42' - VersionChanged: '0.59' - AllowImplicitReturn: true - AllowedReceivers: [] - SafeAutoCorrect: false -Rails/SchemaComment: - Description: Enforces the use of the `comment` option when adding a new table or - column to the database during a migration. - Enabled: false - VersionAdded: '2.13' -Rails/ScopeArgs: - Description: Checks the arguments of ActiveRecord scopes. - Enabled: true - VersionAdded: '0.19' - VersionChanged: '2.12' - Include: - - app/models/**/*.rb -Rails/ShortI18n: - Description: 'Use the short form of the I18n methods: `t` instead of `translate` - and `l` instead of `localize`.' - StyleGuide: https://rails.rubystyle.guide/#short-i18n - Enabled: pending - VersionAdded: '2.7' - EnforcedStyle: conservative - SupportedStyles: - - conservative - - aggressive -Rails/SkipsModelValidations: - Description: Use methods that skips model validations with caution. See reference - for more information. - Reference: https://guides.rubyonrails.org/active_record_validations.html#skipping-validations - Enabled: true - VersionAdded: '0.47' - VersionChanged: '2.7' - ForbiddenMethods: - - decrement! - - decrement_counter - - increment! - - increment_counter - - insert - - insert! - - insert_all - - insert_all! - - toggle! - - touch - - touch_all - - update_all - - update_attribute - - update_column - - update_columns - - update_counters - - upsert - - upsert_all - AllowedMethods: [] -Rails/SquishedSQLHeredocs: - Description: Checks SQL heredocs to use `.squish`. - StyleGuide: https://rails.rubystyle.guide/#squished-heredocs - Enabled: pending - VersionAdded: '2.8' - VersionChanged: '2.9' - SafeAutoCorrect: false -Rails/StripHeredoc: - Description: Enforces the use of squiggly heredoc over `strip_heredoc`. - StyleGuide: https://rails.rubystyle.guide/#prefer-squiggly-heredoc - Enabled: pending - VersionAdded: '2.15' -Rails/TableNameAssignment: - Description: Do not use `self.table_name =`. Use Inflections or `table_name_prefix` - instead. - StyleGuide: https://rails.rubystyle.guide/#keep-ar-defaults - Enabled: false - VersionAdded: '2.14' - Include: - - app/models/**/*.rb -Rails/TimeZone: - Description: Checks the correct usage of time zone aware methods. - StyleGuide: https://rails.rubystyle.guide#time - Reference: http://danilenko.org/2012/7/6/rails_timezones - Enabled: true - SafeAutoCorrect: false - VersionAdded: '0.30' - VersionChanged: '2.13' - EnforcedStyle: flexible - SupportedStyles: - - strict - - flexible - Exclude: - - "/**/*.gemspec" -Rails/TimeZoneAssignment: - Description: Prefer the usage of `Time.use_zone` instead of manually updating `Time.zone` - value. - Reference: https://thoughtbot.com/blog/its-about-time-zones - Enabled: pending - VersionAdded: '2.10' - Include: - - spec/**/*.rb - - test/**/*.rb -Rails/ToFormattedS: - Description: Checks for consistent uses of `to_fs` or `to_formatted_s`. - StyleGuide: https://rails.rubystyle.guide/#prefer-to-fs - Enabled: pending - EnforcedStyle: to_fs - SupportedStyles: - - to_fs - - to_formatted_s - VersionAdded: '2.15' -Rails/ToSWithArgument: - Description: Identifies passing any argument to `#to_s`. - Enabled: pending - Safe: false - VersionAdded: '2.16' -Rails/TopLevelHashWithIndifferentAccess: - Description: Identifies top-level `HashWithIndifferentAccess`. - Reference: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#top-level-hashwithindifferentaccess-is-soft-deprecated - Enabled: pending - VersionAdded: '2.16' -Rails/TransactionExitStatement: - Description: Avoid the usage of `return`, `break` and `throw` in transaction blocks. - Enabled: pending - VersionAdded: '2.14' -Rails/UniqBeforePluck: - Description: Prefer the use of uniq or distinct before pluck. - Enabled: true - VersionAdded: '0.40' - VersionChanged: '2.13' - EnforcedStyle: conservative - SupportedStyles: - - conservative - - aggressive - SafeAutoCorrect: false -Rails/UniqueValidationWithoutIndex: - Description: Uniqueness validation should have a unique index on the database column. - Enabled: true - VersionAdded: '2.5' - Include: - - app/models/**/*.rb -Rails/UnknownEnv: - Description: Use correct environment name. - Enabled: true - VersionAdded: '0.51' - Environments: - - development - - test - - production -Rails/UnusedIgnoredColumns: - Description: Remove a column that does not exist from `ignored_columns`. - Enabled: pending - VersionAdded: '2.11' - Include: - - app/models/**/*.rb -Rails/Validation: - Description: Use validates :attribute, hash of validations. - Enabled: true - VersionAdded: '0.9' - VersionChanged: '0.41' - Include: - - app/models/**/*.rb -Rails/WhereEquals: - Description: Pass conditions to `where` as a hash instead of manually constructing - SQL. - StyleGuide: https://rails.rubystyle.guide/#hash-conditions - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.9' - VersionChanged: '2.10' -Rails/WhereExists: - Description: Prefer `exists?(...)` over `where(...).exists?`. - Enabled: pending - SafeAutoCorrect: false - EnforcedStyle: exists - SupportedStyles: - - exists - - where - VersionAdded: '2.7' - VersionChanged: '2.10' -Rails/WhereMissing: - Description: Use `where.missing(...)` to find missing relationship records. - StyleGuide: https://rails.rubystyle.guide/#finding-missing-relationship-records - Enabled: pending - VersionAdded: '2.16' -Rails/WhereNot: - Description: Use `where.not(...)` instead of manually constructing negated SQL in - `where`. - StyleGuide: https://rails.rubystyle.guide/#hash-conditions - Enabled: pending - VersionAdded: '2.8' -Rails/WhereNotWithMultipleConditions: - Description: Do not use `where.not(...)` with multiple conditions. - Enabled: pending - VersionAdded: '2.17' -Rake: - Enabled: true - Include: - - Rakefile - - "**/*.rake" -Rake/ClassDefinitionInTask: - Description: Do not define a class or module in rake task, because it will be defined - to the top level. - Enabled: true - VersionAdded: 0.3.0 -Rake/Desc: - Description: Describe the task with `desc` method. - Enabled: true - VersionAdded: 0.1.0 -Rake/DuplicateNamespace: - Description: Do not define namespace with the same name - Enabled: true - VersionAdded: 0.5.0 -Rake/DuplicateTask: - Description: Do not define tasks with the same name - Enabled: true - VersionAdded: 0.4.0 -Rake/MethodDefinitionInTask: - Description: Do not define a method in rake task, because it will be defined to - the top level. - Enabled: true - VersionAdded: 0.2.0 -Capybara: - Enabled: true - DocumentationBaseURL: https://docs.rubocop.org/rubocop-capybara - Include: - - "**/*_spec.rb" - - "**/spec/**/*" - - "**/test/**/*" -Capybara/CurrentPathExpectation: - Description: Checks that no expectations are set on Capybara's `current_path`. - Enabled: true - VersionAdded: '1.18' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/CurrentPathExpectation -Capybara/MatchStyle: - Description: Checks for usage of deprecated style methods. - Enabled: pending - VersionAdded: "<>" - Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/MatchStyle -Capybara/NegationMatcher: - Description: Enforces use of `have_no_*` or `not_to` for negated expectations. - Enabled: pending - VersionAdded: '2.14' - EnforcedStyle: not_to - SupportedStyles: - - have_no - - not_to - Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/NegationMatcher -Capybara/SpecificActions: - Description: Checks for there is a more specific actions offered by Capybara. - Enabled: pending - VersionAdded: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/SpecificActions -Capybara/SpecificFinders: - Description: Checks if there is a more specific finder offered by Capybara. - Enabled: pending - VersionAdded: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/SpecificFinders -Capybara/SpecificMatcher: - Description: Checks for there is a more specific matcher offered by Capybara. - Enabled: pending - VersionAdded: '2.12' - Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/SpecificMatcher -Capybara/VisibilityMatcher: - Description: Checks for boolean visibility in Capybara finders. - Enabled: true - VersionAdded: '1.39' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-capybara/RuboCop/Cop/Capybara/VisibilityMatcher -RSpec: - Enabled: true - StyleGuideBaseURL: https://rspec.rubystyle.guide - DocumentationBaseURL: https://docs.rubocop.org/rubocop-rspec - Include: &1 - - "**/*_spec.rb" - - "**/spec/**/*" - Language: &2 - inherit_mode: - merge: - - Expectations - - Helpers - - Hooks - - Subjects - ExampleGroups: - inherit_mode: - merge: - - Regular - - Skipped - - Focused - Regular: - - describe - - context - - feature - - example_group - Skipped: - - xdescribe - - xcontext - - xfeature - Focused: - - fdescribe - - fcontext - - ffeature - Examples: - inherit_mode: - merge: - - Regular - - Skipped - - Focused - - Pending - Regular: - - it - - specify - - example - - scenario - - its - Focused: - - fit - - fspecify - - fexample - - fscenario - - focus - Skipped: - - xit - - xspecify - - xexample - - xscenario - - skip - Pending: - - pending - Expectations: - - are_expected - - expect - - expect_any_instance_of - - is_expected - - should - - should_not - - should_not_receive - - should_receive - Helpers: - - let - - let! - Hooks: - - prepend_before - - before - - append_before - - around - - prepend_after - - after - - append_after - Includes: - inherit_mode: - merge: - - Examples - - Context - Examples: - - it_behaves_like - - it_should_behave_like - - include_examples - Context: - - include_context - SharedGroups: - inherit_mode: - merge: - - Examples - - Context - Examples: - - shared_examples - - shared_examples_for - Context: - - shared_context - Subjects: - - subject - - subject! -RSpec/AlignLeftLetBrace: - Description: Checks that left braces for adjacent single line lets are aligned. - Enabled: false - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace -RSpec/AlignRightLetBrace: - Description: Checks that right braces for adjacent single line lets are aligned. - Enabled: false - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace -RSpec/AnyInstance: - Description: Check that instances are not being stubbed globally. - Enabled: true - VersionAdded: '1.4' - StyleGuide: https://rspec.rubystyle.guide/#any_instance_of - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance -RSpec/AroundBlock: - Description: Checks that around blocks actually run the test. - Enabled: true - VersionAdded: '1.11' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock -RSpec/Be: - Description: Check for expectations where `be` is used without argument. - Enabled: true - VersionAdded: '1.25' - StyleGuide: https://rspec.rubystyle.guide/#be-matcher - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be -RSpec/BeEq: - Description: Check for expectations where `be(...)` can replace `eq(...)`. - Enabled: pending - Safe: false - VersionAdded: 2.9.0 - VersionChanged: '2.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq -RSpec/BeEql: - Description: Check for expectations where `be(...)` can replace `eql(...)`. - Enabled: true - Safe: false - VersionAdded: '1.7' - VersionChanged: '2.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql -RSpec/BeNil: - Description: Ensures a consistent style is used when matching `nil`. - Enabled: pending - EnforcedStyle: be_nil - SupportedStyles: - - be - - be_nil - VersionAdded: 2.9.0 - VersionChanged: 2.10.0 - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil -RSpec/BeforeAfterAll: - Description: Check that before/after(:all) isn't being used. - Enabled: true - Exclude: - - spec/spec_helper.rb - - spec/rails_helper.rb - - spec/support/**/*.rb - VersionAdded: '1.12' - StyleGuide: https://rspec.rubystyle.guide/#avoid-hooks-with-context-scope - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll -RSpec/ChangeByZero: - Description: Prefer negated matchers over `to change.by(0)`. - Enabled: pending - VersionAdded: '2.11' - VersionChanged: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero - NegatedMatcher: -RSpec/ClassCheck: - Description: Enforces consistent use of `be_a` or `be_kind_of`. - StyleGuide: "#is-a-vs-kind-of" - Enabled: pending - VersionAdded: '2.13' - EnforcedStyle: be_a - SupportedStyles: - - be_a - - be_kind_of - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ClassCheck -RSpec/ContextMethod: - Description: "`context` should not be used for specifying methods." - Enabled: true - VersionAdded: '1.36' - StyleGuide: https://rspec.rubystyle.guide/#example-group-naming - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod -RSpec/ContextWording: - Description: Checks that `context` docstring starts with an allowed prefix. - Enabled: true - Prefixes: - - when - - with - - without - AllowedPatterns: [] - VersionAdded: '1.20' - VersionChanged: '2.13' - StyleGuide: https://rspec.rubystyle.guide/#context-descriptions - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording -RSpec/DescribeClass: - Description: Check that the first argument to the top-level describe is a constant. - Enabled: true - Exclude: - - "**/spec/features/**/*" - - "**/spec/requests/**/*" - - "**/spec/routing/**/*" - - "**/spec/system/**/*" - - "**/spec/views/**/*" - IgnoredMetadata: - type: - - channel - - controller - - helper - - job - - mailer - - model - - request - - routing - - view - - feature - - system - - mailbox - - aruba - - task - VersionAdded: '1.0' - VersionChanged: '2.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass -RSpec/DescribeMethod: - Description: Checks that the second argument to `describe` specifies a method. - Enabled: true - VersionAdded: '1.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod -RSpec/DescribeSymbol: - Description: Avoid describing symbols. - Enabled: true - VersionAdded: '1.15' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol -RSpec/DescribedClass: - Description: Checks that tests use `described_class`. - Enabled: true - SkipBlocks: false - EnforcedStyle: described_class - SupportedStyles: - - described_class - - explicit - SafeAutoCorrect: false - VersionAdded: '1.0' - VersionChanged: '1.11' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass -RSpec/DescribedClassModuleWrapping: - Description: Avoid opening modules and defining specs within them. - Enabled: false - VersionAdded: '1.37' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping -RSpec/Dialect: - Description: Enforces custom RSpec dialects. - Enabled: false - PreferredMethods: {} - VersionAdded: '1.33' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect -RSpec/DuplicatedMetadata: - Description: Avoid duplicated metadata. - Enabled: pending - VersionAdded: '2.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata -RSpec/EmptyExampleGroup: - Description: Checks if an example group does not include any tests. - Enabled: true - SafeAutoCorrect: false - VersionAdded: '1.7' - VersionChanged: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup -RSpec/EmptyHook: - Description: Checks for empty before and after hooks. - Enabled: true - VersionAdded: '1.39' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook -RSpec/EmptyLineAfterExample: - Description: Checks if there is an empty line after example blocks. - Enabled: true - AllowConsecutiveOneLiners: true - VersionAdded: '1.36' - StyleGuide: https://rspec.rubystyle.guide/#empty-lines-around-examples - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample -RSpec/EmptyLineAfterExampleGroup: - Description: Checks if there is an empty line after example group blocks. - Enabled: true - VersionAdded: '1.27' - StyleGuide: https://rspec.rubystyle.guide/#empty-lines-between-describes - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup -RSpec/EmptyLineAfterFinalLet: - Description: Checks if there is an empty line after the last let block. - Enabled: true - VersionAdded: '1.14' - StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet -RSpec/EmptyLineAfterHook: - Description: Checks if there is an empty line after hook blocks. - Enabled: true - VersionAdded: '1.27' - VersionChanged: '2.13' - StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook - AllowConsecutiveOneLiners: true -RSpec/EmptyLineAfterSubject: - Description: Checks if there is an empty line after subject block. - Enabled: true - VersionAdded: '1.14' - StyleGuide: https://rspec.rubystyle.guide/#empty-line-after-let - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject -RSpec/ExampleLength: - Description: Checks for long examples. - Enabled: true - Max: 5 - CountAsOne: [] - VersionAdded: '1.5' - VersionChanged: '2.3' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength -RSpec/ExampleWithoutDescription: - Description: Checks for examples without a description. - Enabled: true - EnforcedStyle: always_allow - SupportedStyles: - - always_allow - - single_line_only - - disallow - VersionAdded: '1.22' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription -RSpec/ExampleWording: - Description: Checks for common mistakes in example descriptions. - Enabled: true - CustomTransform: - be: is - BE: IS - have: has - HAVE: HAS - IgnoredWords: [] - DisallowedExamples: - - works - VersionAdded: '1.0' - VersionChanged: '2.13' - StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording -RSpec/ExcessiveDocstringSpacing: - Description: Checks for excessive whitespace in example descriptions. - Enabled: pending - VersionAdded: '2.5' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing -RSpec/ExpectActual: - Description: Checks for `expect(...)` calls containing literal values. - Enabled: true - Exclude: - - spec/routing/**/* - VersionAdded: '1.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual -RSpec/ExpectChange: - Description: Checks for consistent style of change matcher. - Enabled: true - EnforcedStyle: method_call - SupportedStyles: - - method_call - - block - SafeAutoCorrect: false - VersionAdded: '1.22' - VersionChanged: '2.5' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange -RSpec/ExpectInHook: - Description: Do not use `expect` in hooks such as `before`. - Enabled: true - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook -RSpec/ExpectOutput: - Description: Checks for opportunities to use `expect { ... }.to output`. - Enabled: true - VersionAdded: '1.10' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput -RSpec/FilePath: - Description: Checks that spec file paths are consistent and well-formed. - Enabled: true - Include: - - "**/*_spec*rb*" - - "**/spec/**/*" - CustomTransform: - RuboCop: rubocop - RSpec: rspec - IgnoreMethods: false - SpecSuffixOnly: false - VersionAdded: '1.2' - VersionChanged: '1.40' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath -RSpec/Focus: - Description: Checks if examples are focused. - Enabled: true - VersionAdded: '1.5' - VersionChanged: '2.1' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus -RSpec/HookArgument: - Description: Checks the arguments passed to `before`, `around`, and `after`. - Enabled: true - EnforcedStyle: implicit - SupportedStyles: - - implicit - - each - - example - VersionAdded: '1.7' - StyleGuide: https://rspec.rubystyle.guide/#redundant-beforeeach - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument -RSpec/HooksBeforeExamples: - Description: Checks for before/around/after hooks that come after an example. - Enabled: true - VersionAdded: '1.29' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples -RSpec/IdenticalEqualityAssertion: - Description: Checks for equality assertions with identical expressions on both sides. - Enabled: pending - VersionAdded: '2.4' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion -RSpec/ImplicitBlockExpectation: - Description: Check that implicit block expectation syntax is not used. - Enabled: true - VersionAdded: '1.35' - StyleGuide: https://rspec.rubystyle.guide/#implicit-block-expectations - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation -RSpec/ImplicitExpect: - Description: Check that a consistent implicit expectation style is used. - Enabled: true - EnforcedStyle: is_expected - SupportedStyles: - - is_expected - - should - VersionAdded: '1.8' - StyleGuide: https://rspec.rubystyle.guide/#use-expect - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect -RSpec/ImplicitSubject: - Description: Checks for usage of implicit subject (`is_expected` / `should`). - Enabled: true - EnforcedStyle: single_line_only - SupportedStyles: - - single_line_only - - single_statement_only - - disallow - - require_implicit - VersionAdded: '1.29' - VersionChanged: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject -RSpec/InstanceSpy: - Description: Checks for `instance_double` used with `have_received`. - Enabled: true - VersionAdded: '1.12' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy -RSpec/InstanceVariable: - Description: Checks for instance variable usage in specs. - Enabled: true - AssignmentOnly: false - VersionAdded: '1.0' - VersionChanged: '1.7' - StyleGuide: https://rspec.rubystyle.guide/#instance-variables - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable -RSpec/ItBehavesLike: - Description: Checks that only one `it_behaves_like` style is used. - Enabled: true - EnforcedStyle: it_behaves_like - SupportedStyles: - - it_behaves_like - - it_should_behave_like - VersionAdded: '1.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike -RSpec/IteratedExpectation: - Description: Check that `all` matcher is used instead of iterating over an array. - Enabled: true - VersionAdded: '1.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation -RSpec/LeadingSubject: - Description: Enforce that subject is the first definition in the test. - Enabled: true - VersionAdded: '1.7' - VersionChanged: '1.14' - StyleGuide: https://rspec.rubystyle.guide/#leading-subject - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject -RSpec/LeakyConstantDeclaration: - Description: Checks that no class, module, or constant is declared. - Enabled: true - VersionAdded: '1.35' - StyleGuide: https://rspec.rubystyle.guide/#declare-constants - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration -RSpec/LetBeforeExamples: - Description: Checks for `let` definitions that come after an example. - Enabled: true - VersionAdded: '1.16' - VersionChanged: '1.22' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples -RSpec/LetSetup: - Description: Checks unreferenced `let!` calls being used for test setup. - Enabled: true - VersionAdded: '1.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup -RSpec/MessageChain: - Description: Check that chains of messages are not being stubbed. - Enabled: true - VersionAdded: '1.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain -RSpec/MessageExpectation: - Description: Checks for consistent message expectation style. - Enabled: false - EnforcedStyle: allow - SupportedStyles: - - allow - - expect - VersionAdded: '1.7' - VersionChanged: '1.8' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation -RSpec/MessageSpies: - Description: Checks that message expectations are set using spies. - Enabled: true - EnforcedStyle: have_received - SupportedStyles: - - have_received - - receive - VersionAdded: '1.9' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies -RSpec/MissingExampleGroupArgument: - Description: Checks that the first argument to an example group is not empty. - Enabled: true - VersionAdded: '1.28' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument -RSpec/MultipleDescribes: - Description: Checks for multiple top-level example groups. - Enabled: true - VersionAdded: '1.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes -RSpec/MultipleExpectations: - Description: Checks if examples contain too many `expect` calls. - Enabled: true - Max: 1 - VersionAdded: '1.7' - VersionChanged: '1.21' - StyleGuide: https://rspec.rubystyle.guide/#expectation-per-example - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations -RSpec/MultipleMemoizedHelpers: - Description: Checks if example groups contain too many `let` and `subject` calls. - Enabled: true - AllowSubject: true - Max: 5 - VersionAdded: '1.43' - StyleGuide: https://rspec.rubystyle.guide/#let-blocks - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers -RSpec/MultipleSubjects: - Description: Checks if an example group defines `subject` multiple times. - Enabled: true - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects -RSpec/NamedSubject: - Description: Checks for explicitly referenced test subjects. - Enabled: true - EnforcedStyle: always - SupportedStyles: - - always - - named_only - IgnoreSharedExamples: true - VersionAdded: 1.5.3 - VersionChanged: '2.15' - StyleGuide: https://rspec.rubystyle.guide/#use-subject - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject -RSpec/NestedGroups: - Description: Checks for nested example groups. - Enabled: true - Max: 3 - AllowedGroups: [] - VersionAdded: '1.7' - VersionChanged: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups -RSpec/NoExpectationExample: - Description: Checks if an example contains any expectation. - Enabled: pending - Safe: false - VersionAdded: '2.13' - VersionChanged: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NoExpectationExample - AllowedPatterns: - - "^expect_" - - "^assert_" -RSpec/NotToNot: - Description: Checks for consistent method usage for negating expectations. - Enabled: true - EnforcedStyle: not_to - SupportedStyles: - - not_to - - to_not - VersionAdded: '1.4' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot -RSpec/OverwritingSetup: - Description: Checks if there is a let/subject that overwrites an existing one. - Enabled: true - VersionAdded: '1.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup -RSpec/Pending: - Description: Checks for any pending or skipped examples. - Enabled: false - VersionAdded: '1.25' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending -RSpec/PendingWithoutReason: - Description: Checks for pending or skipped examples without reason. - Enabled: pending - VersionAdded: '2.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason -RSpec/PredicateMatcher: - Description: Prefer using predicate matcher over using predicate method directly. - Enabled: true - Strict: true - EnforcedStyle: inflected - AllowedExplicitMatchers: [] - SupportedStyles: - - inflected - - explicit - SafeAutoCorrect: false - VersionAdded: '1.16' - StyleGuide: https://rspec.rubystyle.guide/#predicate-matchers - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher -RSpec/ReceiveCounts: - Description: Check for `once` and `twice` receive counts matchers usage. - Enabled: true - VersionAdded: '1.26' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts -RSpec/ReceiveNever: - Description: Prefer `not_to receive(...)` over `receive(...).never`. - Enabled: true - VersionAdded: '1.28' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever -RSpec/RepeatedDescription: - Description: Check for repeated description strings in example groups. - Enabled: true - VersionAdded: '1.9' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription -RSpec/RepeatedExample: - Description: Check for repeated examples within example groups. - Enabled: true - VersionAdded: '1.10' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample -RSpec/RepeatedExampleGroupBody: - Description: Check for repeated describe and context block body. - Enabled: true - VersionAdded: '1.38' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody -RSpec/RepeatedExampleGroupDescription: - Description: Check for repeated example group descriptions. - Enabled: true - VersionAdded: '1.38' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription -RSpec/RepeatedIncludeExample: - Description: Check for repeated include of shared examples. - Enabled: true - VersionAdded: '1.44' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample -RSpec/ReturnFromStub: - Description: Checks for consistent style of stub's return setting. - Enabled: true - EnforcedStyle: and_return - SupportedStyles: - - and_return - - block - VersionAdded: '1.16' - VersionChanged: '1.22' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub -RSpec/ScatteredLet: - Description: Checks for let scattered across the example group. - Enabled: true - VersionAdded: '1.14' - VersionChanged: '1.39' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet -RSpec/ScatteredSetup: - Description: Checks for setup scattered across multiple hooks in an example group. - Enabled: true - VersionAdded: '1.10' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup -RSpec/SharedContext: - Description: Checks for proper shared_context and shared_examples usage. - Enabled: true - VersionAdded: '1.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext -RSpec/SharedExamples: - Description: Enforces use of string to titleize shared examples. - Enabled: true - VersionAdded: '1.25' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples -RSpec/SingleArgumentMessageChain: - Description: Checks that chains of messages contain more than one element. - Enabled: true - VersionAdded: '1.9' - VersionChanged: '1.10' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain -RSpec/SortMetadata: - Description: Sort RSpec metadata alphabetically. - Enabled: pending - VersionAdded: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SortMetadata -RSpec/StubbedMock: - Description: Checks that message expectations do not have a configured response. - Enabled: true - VersionAdded: '1.44' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock -RSpec/SubjectDeclaration: - Description: Ensure that subject is defined using subject helper. - Enabled: pending - VersionAdded: '2.5' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration -RSpec/SubjectStub: - Description: Checks for stubbed test subjects. - Enabled: true - VersionAdded: '1.7' - VersionChanged: '2.8' - StyleGuide: https://rspec.rubystyle.guide/#dont-stub-subject - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub -RSpec/UnspecifiedException: - Description: Checks for a specified error in checking raised errors. - Enabled: true - VersionAdded: '1.30' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException -RSpec/VariableDefinition: - Description: Checks that memoized helpers names are symbols or strings. - Enabled: true - EnforcedStyle: symbols - SupportedStyles: - - symbols - - strings - VersionAdded: '1.40' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition -RSpec/VariableName: - Description: Checks that memoized helper names use the configured style. - Enabled: true - EnforcedStyle: snake_case - SupportedStyles: - - snake_case - - camelCase - AllowedPatterns: [] - VersionAdded: '1.40' - VersionChanged: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName -RSpec/VerifiedDoubleReference: - Description: Checks for consistent verified double reference style. - Enabled: pending - SafeAutoCorrect: false - EnforcedStyle: constant - SupportedStyles: - - constant - - string - VersionAdded: 2.10.0 - VersionChanged: '2.12' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubleReference -RSpec/VerifiedDoubles: - Description: Prefer using verifying doubles over normal doubles. - Enabled: true - IgnoreNameless: true - IgnoreSymbolicNames: false - VersionAdded: 1.2.1 - VersionChanged: '1.5' - StyleGuide: https://rspec.rubystyle.guide/#doubles - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles -RSpec/VoidExpect: - Description: Checks void `expect()`. - Enabled: true - VersionAdded: '1.16' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect -RSpec/Yield: - Description: Checks for calling a block within a stub. - Enabled: true - VersionAdded: '1.32' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield -RSpec/Capybara: - Enabled: true - Include: *1 - Language: *2 -RSpec/Capybara/CurrentPathExpectation: - Description: Checks that no expectations are set on Capybara's `current_path`. - Enabled: true - VersionAdded: '1.18' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation -RSpec/Capybara/FeatureMethods: - Description: Checks for consistent method usage in feature specs. - Enabled: true - EnabledMethods: [] - VersionAdded: '1.17' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods -RSpec/Capybara/MatchStyle: - Description: Checks for usage of deprecated style methods. - Enabled: pending - VersionAdded: '2.17' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/MatchStyle -RSpec/Capybara/NegationMatcher: - Description: Enforces use of `have_no_*` or `not_to` for negated expectations. - Enabled: pending - VersionAdded: '2.14' - EnforcedStyle: not_to - SupportedStyles: - - have_no - - not_to - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/NegationMatcher -RSpec/Capybara/SpecificActions: - Description: Checks for there is a more specific actions offered by Capybara. - Enabled: pending - VersionAdded: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificActions -RSpec/Capybara/SpecificFinders: - Description: Checks if there is a more specific finder offered by Capybara. - Enabled: pending - VersionAdded: '2.13' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificFinders -RSpec/Capybara/SpecificMatcher: - Description: Checks for there is a more specific matcher offered by Capybara. - Enabled: pending - VersionAdded: '2.12' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificMatcher -RSpec/Capybara/VisibilityMatcher: - Description: Checks for boolean visibility in Capybara finders. - Enabled: true - VersionAdded: '1.39' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher -RSpec/FactoryBot: - Enabled: true - Include: *1 - Language: *2 -RSpec/FactoryBot/AttributeDefinedStatically: - Description: Always declare attribute values as blocks. - Enabled: true - Include: - - spec/factories.rb - - spec/factories/**/*.rb - - features/support/factories/**/*.rb - VersionAdded: '1.28' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically -RSpec/FactoryBot/ConsistentParenthesesStyle: - Description: Use a consistent style for parentheses in factory bot calls. - Enabled: pending - EnforcedStyle: require_parentheses - SupportedStyles: - - require_parentheses - - omit_parentheses - VersionAdded: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/ConsistentParenthesesStyle -RSpec/FactoryBot/CreateList: - Description: Checks for create_list usage. - Enabled: true - Include: - - "**/*_spec.rb" - - "**/spec/**/*" - - spec/factories.rb - - spec/factories/**/*.rb - - features/support/factories/**/*.rb - EnforcedStyle: create_list - SupportedStyles: - - create_list - - n_times - VersionAdded: '1.25' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList -RSpec/FactoryBot/FactoryClassName: - Description: Use string value when setting the class attribute explicitly. - Enabled: true - Include: - - spec/factories.rb - - spec/factories/**/*.rb - - features/support/factories/**/*.rb - VersionAdded: '1.37' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName -RSpec/FactoryBot/FactoryNameStyle: - Description: Checks for name style for argument of FactoryBot::Syntax::Methods. - Enabled: pending - VersionAdded: '2.16' - EnforcedStyle: symbol - SupportedStyles: - - symbol - - string - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle -RSpec/FactoryBot/SyntaxMethods: - Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs. - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.7' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods -RSpec/Rails: - Enabled: true - Include: *1 - Language: *2 -RSpec/Rails/AvoidSetupHook: - Description: Checks that tests use RSpec `before` hook over Rails `setup` method. - Enabled: pending - VersionAdded: '2.4' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook -RSpec/Rails/HaveHttpStatus: - Description: Checks that tests use `have_http_status` instead of equality matchers. - Enabled: pending - SafeAutoCorrect: false - VersionAdded: '2.12' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus -RSpec/Rails/HttpStatus: - Description: Enforces use of symbolic or numeric value to describe HTTP status. - Enabled: true - EnforcedStyle: symbolic - SupportedStyles: - - numeric - - symbolic - VersionAdded: '1.23' - VersionChanged: '2.0' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus -RSpec/Rails/InferredSpecType: - Description: Identifies redundant spec type. - Enabled: pending - Safe: false - VersionAdded: '2.14' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/InferredSpecType - Inferences: - channels: channel - controllers: controller - features: feature - generator: generator - helpers: helper - jobs: job - mailboxes: mailbox - mailers: mailer - models: model - requests: request - integration: request - api: request - routing: routing - system: system - views: view -RSpec/Rails/MinitestAssertions: - Description: Check if using Minitest matchers. - Enabled: pending - VersionAdded: '2.17' - Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions