-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rubocop as a superset of standard
this adds rails, rspec, and other rules in addition to the standardrb ones
- Loading branch information
Showing
9 changed files
with
462 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# .rubocop.yml | ||
inherit_mode: | ||
merge: | ||
- Exclude | ||
|
||
require: | ||
- rubocop-performance | ||
- standard/cop/block_single_line_braces | ||
- ./lib/cops/lint/env.rb | ||
|
||
inherit_gem: | ||
standard: config/base.yml | ||
|
||
inherit_from: | ||
- .rubocop_rails.yml | ||
- .rubocop_rspec.yml | ||
- .rubocop_strict.yml | ||
|
||
AllCops: | ||
NewCops: disable | ||
|
||
Lint/Env: | ||
Enabled: true | ||
Include: | ||
- "**/*.rb" | ||
Exclude: | ||
- "**/config/environments/**/*" | ||
- "**/config/application.rb" | ||
- "**/config/environment.rb" | ||
- "**/config/puma.rb" | ||
- "**/config/boot.rb" | ||
- "**/spec/*_helper.rb" | ||
- "**/spec/**/support/**/*" | ||
- "lib/generators/**/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
# Based on removed standard configuration: | ||
# https://github.com/testdouble/standard/commit/94d133f477a5694084ac974d5ee01e8a66ce777e#diff-65478e10d5b2ef41c7293a110c0e6b7c | ||
|
||
require: | ||
- rubocop-rails | ||
|
||
Rails/ActionFilter: | ||
Enabled: true | ||
EnforcedStyle: action | ||
Include: | ||
- app/controllers/**/*.rb | ||
|
||
Rails/ActiveRecordAliases: | ||
Enabled: true | ||
|
||
Rails/ActiveSupportAliases: | ||
Enabled: true | ||
|
||
Rails/ApplicationJob: | ||
Enabled: true | ||
|
||
Rails/ApplicationRecord: | ||
Enabled: true | ||
|
||
Rails/AssertNot: | ||
Enabled: true | ||
Include: | ||
- '**/test/**/*' | ||
|
||
Rails/Blank: | ||
Enabled: true | ||
# Convert usages of `nil? || empty?` to `blank?` | ||
NilOrEmpty: true | ||
# Convert usages of `!present?` to `blank?` | ||
NotPresent: true | ||
# Convert usages of `unless present?` to `if blank?` | ||
UnlessPresent: true | ||
|
||
Rails/BulkChangeTable: | ||
Enabled: true | ||
Database: null | ||
Include: | ||
- db/migrate/*.rb | ||
|
||
Rails/CreateTableWithTimestamps: | ||
Enabled: true | ||
Include: | ||
- db/migrate/*.rb | ||
|
||
Rails/Date: | ||
Enabled: true | ||
EnforcedStyle: flexible | ||
|
||
Rails/Delegate: | ||
Enabled: true | ||
EnforceForPrefixed: true | ||
|
||
Rails/DelegateAllowBlank: | ||
Enabled: true | ||
|
||
Rails/DynamicFindBy: | ||
Enabled: true | ||
Whitelist: | ||
- find_by_sql | ||
|
||
Rails/EnumUniqueness: | ||
Enabled: true | ||
Include: | ||
- app/models/**/*.rb | ||
|
||
Rails/EnvironmentComparison: | ||
Enabled: true | ||
|
||
Rails/Exit: | ||
Enabled: true | ||
Include: | ||
- app/**/*.rb | ||
- config/**/*.rb | ||
- lib/**/*.rb | ||
Exclude: | ||
- lib/**/*.rake | ||
|
||
Rails/FilePath: | ||
Enabled: true | ||
EnforcedStyle: arguments | ||
|
||
Rails/FindBy: | ||
Enabled: true | ||
Include: | ||
- app/models/**/*.rb | ||
|
||
Rails/FindEach: | ||
Enabled: true | ||
Include: | ||
- app/models/**/*.rb | ||
|
||
Rails/HasAndBelongsToMany: | ||
Enabled: true | ||
Include: | ||
- app/models/**/*.rb | ||
|
||
Rails/HttpPositionalArguments: | ||
Enabled: true | ||
Include: | ||
- 'spec/**/*' | ||
- 'test/**/*' | ||
|
||
Rails/HttpStatus: | ||
Enabled: true | ||
EnforcedStyle: symbolic | ||
|
||
Rails/InverseOf: | ||
Enabled: true | ||
Include: | ||
- app/models/**/*.rb | ||
|
||
Rails/LexicallyScopedActionFilter: | ||
Enabled: true | ||
Safe: false | ||
Include: | ||
- app/controllers/**/*.rb | ||
|
||
Rails/NotNullColumn: | ||
Enabled: true | ||
Include: | ||
- db/migrate/*.rb | ||
|
||
Rails/Output: | ||
Enabled: true | ||
Include: | ||
- app/**/*.rb | ||
- config/**/*.rb | ||
- db/**/*.rb | ||
- lib/**/*.rb | ||
|
||
Rails/OutputSafety: | ||
Enabled: true | ||
|
||
Rails/PluralizationGrammar: | ||
Enabled: true | ||
|
||
Rails/Presence: | ||
Enabled: true | ||
|
||
Rails/Present: | ||
Enabled: true | ||
NotNilAndNotEmpty: true | ||
NotBlank: true | ||
UnlessBlank: true | ||
|
||
Rails/ReadWriteAttribute: | ||
Enabled: true | ||
Include: | ||
- app/models/**/*.rb | ||
|
||
Rails/RedundantReceiverInWithOptions: | ||
Enabled: true | ||
|
||
Rails/RefuteMethods: | ||
Enabled: true | ||
Include: | ||
- '**/test/**/*' | ||
|
||
Rails/RelativeDateConstant: | ||
Enabled: true | ||
AutoCorrect: false | ||
|
||
Rails/RequestReferer: | ||
Enabled: true | ||
EnforcedStyle: referer | ||
|
||
Rails/ReversibleMigration: | ||
Enabled: true | ||
Include: | ||
- db/migrate/*.rb | ||
|
||
Rails/SafeNavigation: | ||
Enabled: true | ||
ConvertTry: false | ||
|
||
Rails/ScopeArgs: | ||
Enabled: true | ||
Include: | ||
- app/models/**/*.rb | ||
|
||
Rails/TimeZone: | ||
Enabled: true | ||
EnforcedStyle: flexible | ||
|
||
Rails/UniqBeforePluck: | ||
Enabled: true | ||
EnforcedStyle: conservative | ||
AutoCorrect: false | ||
|
||
Rails/Validation: | ||
Enabled: true | ||
Include: | ||
- app/models/**/*.rb | ||
|
||
Rails/ActiveRecordCallbacksOrder: # new in 2.7 | ||
Enabled: false | ||
Rails/AddColumnIndex: # new in 2.11 | ||
Enabled: false | ||
Rails/AfterCommitOverride: # new in 2.8 | ||
Enabled: false | ||
Rails/AttributeDefaultBlockValue: # new in 2.9 | ||
Enabled: false | ||
Rails/CompactBlank: # new in 2.13 | ||
Enabled: false | ||
Rails/DurationArithmetic: # new in 2.13 | ||
Enabled: false | ||
Rails/EagerEvaluationLogMessage: # new in 2.11 | ||
Enabled: false | ||
Rails/ExpandedDateRange: # new in 2.11 | ||
Enabled: false | ||
Rails/FindById: # new in 2.7 | ||
Enabled: false | ||
Rails/I18nLocaleAssignment: # new in 2.11 | ||
Enabled: false | ||
Rails/Inquiry: # new in 2.7 | ||
Enabled: false | ||
Rails/MailerName: # new in 2.7 | ||
Enabled: false | ||
Rails/MatchRoute: # new in 2.7 | ||
Enabled: false | ||
Rails/NegateInclude: # new in 2.7 | ||
Enabled: false | ||
Rails/Pluck: # new in 2.7 | ||
Enabled: false | ||
Rails/PluckInWhere: # new in 2.7 | ||
Enabled: false | ||
Rails/RedundantPresenceValidationOnBelongsTo: # new in 2.13 | ||
Enabled: false | ||
Rails/RedundantTravelBack: # new in 2.12 | ||
Enabled: false | ||
Rails/RenderInline: # new in 2.7 | ||
Enabled: false | ||
Rails/RenderPlainText: # new in 2.7 | ||
Enabled: false | ||
Rails/RootJoinChain: # new in 2.13 | ||
Enabled: false | ||
Rails/ShortI18n: # new in 2.7 | ||
Enabled: false | ||
Rails/SquishedSQLHeredocs: # new in 2.8 | ||
Enabled: false | ||
Rails/TimeZoneAssignment: # new in 2.10 | ||
Enabled: false | ||
Rails/UnusedIgnoredColumns: # new in 2.11 | ||
Enabled: false | ||
Rails/WhereEquals: # new in 2.9 | ||
Enabled: false | ||
Rails/WhereExists: # new in 2.7 | ||
Enabled: false | ||
Rails/WhereNot: # new in 2.8 | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require: | ||
- rubocop-rspec | ||
|
||
# Disable all cops by default, | ||
# only enable those defined explcitly in this configuration file | ||
RSpec: | ||
Enabled: false | ||
|
||
RSpec/Focus: | ||
Enabled: true | ||
|
||
RSpec/EmptyExampleGroup: | ||
Enabled: true | ||
|
||
RSpec/EmptyLineAfterExampleGroup: | ||
Enabled: true | ||
|
||
RSpec/EmptyLineAfterFinalLet: | ||
Enabled: true | ||
|
||
RSpec/EmptyLineAfterHook: | ||
Enabled: true | ||
|
||
RSpec/EmptyLineAfterSubject: | ||
Enabled: true | ||
|
||
RSpec/HookArgument: | ||
Enabled: true | ||
|
||
RSpec/HooksBeforeExamples: | ||
Enabled: true | ||
|
||
RSpec/ImplicitExpect: | ||
Enabled: true | ||
|
||
RSpec/IteratedExpectation: | ||
Enabled: true | ||
|
||
RSpec/LetBeforeExamples: | ||
Enabled: true | ||
|
||
RSpec/MissingExampleGroupArgument: | ||
Enabled: true | ||
|
||
RSpec/ReceiveCounts: | ||
Enabled: true | ||
|
||
RSpec/Capybara/CurrentPathExpectation: | ||
Enabled: true | ||
|
||
RSpec/FactoryBot/AttributeDefinedStatically: | ||
Enabled: true | ||
|
||
RSpec/FactoryBot/CreateList: | ||
Enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Lint/Debugger: # don't leave binding.pry | ||
Enabled: true | ||
Exclude: [] | ||
|
||
RSpec/Focus: # run ALL tests on CI | ||
Enabled: true | ||
Exclude: [] | ||
|
||
Rails/Output: # Don't leave puts-debugging | ||
Enabled: true | ||
Exclude: [] | ||
|
||
Rails/FindEach: # each could severely affect the performance, use find_each | ||
Enabled: true | ||
Exclude: [] | ||
|
||
Rails/UniqBeforePluck: # uniq.pluck and not pluck.uniq | ||
Enabled: true | ||
Exclude: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.