Skip to content

Instantly share code, notes, and snippets.

@JFernandezWM
Created August 1, 2018 16:27
Show Gist options
  • Select an option

  • Save JFernandezWM/6ba0570ac924b35c103525ba66a64080 to your computer and use it in GitHub Desktop.

Select an option

Save JFernandezWM/6ba0570ac924b35c103525ba66a64080 to your computer and use it in GitHub Desktop.

Revisions

  1. JFernandezWM created this gist Aug 1, 2018.
    357 changes: 357 additions & 0 deletions .rubocop.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,357 @@
    AllCops:
    TargetRubyVersion: 2.4.1
    Exclude:
    - "vendor/**/*"
    - bin/*
    Layout/DotPosition:
    Description: Checks the position of the dot in multi-line method calls.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
    Enabled: true
    EnforcedStyle: leading
    SupportedStyles:
    - leading
    - trailing
    Layout/EmptyLineAfterMagicComment:
    Description: 'Add an empty line after magic comments to separate them from code.'
    StyleGuide: '#separate-magic-comments-from-code'
    Enabled: true
    Lint/AmbiguousBlockAssociation:
    Exclude:
    - "spec/**/*"
    Style/CollectionMethods:
    Description: Preferred collection methods.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
    Enabled: true
    PreferredMethods:
    collect: map
    collect!: map!
    find: detect
    find_all: select
    reduce: inject
    Naming/FileName:
    Description: Use snake_case for source file names.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
    Enabled: false
    Exclude: []
    Style/GuardClause:
    Description: Check for conditionals that can be replaced with guard clauses
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
    Enabled: false
    MinBodyLength: 1
    Style/IfUnlessModifier:
    Description: Favor modifier if/unless usage when you have a single-line body.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
    Enabled: false
    Style/OptionHash:
    Description: Don't use option hashes when you can use keyword arguments.
    Enabled: false
    Style/PercentLiteralDelimiters:
    Description: Use `%`-literal delimiters consistently
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
    Enabled: false
    PreferredDelimiters:
    "%": "()"
    "%i": "()"
    "%q": "()"
    "%Q": "()"
    "%r": "{}"
    "%s": "()"
    "%w": "()"
    "%W": "()"
    "%x": "()"
    Naming/PredicateName:
    Description: Check the names of predicate methods.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
    Enabled: true
    NamePrefix:
    - is_
    - has_
    - have_
    NamePrefixBlacklist:
    - is_
    Exclude:
    - spec/**/*
    Style/RaiseArgs:
    Description: Checks the arguments passed to raise/fail.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
    Enabled: false
    EnforcedStyle: exploded
    SupportedStyles:
    - compact
    - exploded
    Style/SignalException:
    Description: Checks for proper usage of fail and raise.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
    Enabled: true
    EnforcedStyle: semantic
    SupportedStyles:
    - only_raise
    - only_fail
    - semantic
    Style/SingleLineBlockParams:
    Description: Enforces the names of some block params.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
    Enabled: false
    Methods:
    - reduce:
    - a
    - e
    - inject:
    - a
    - e
    Style/SingleLineMethods:
    Description: Avoid single-line methods.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
    Enabled: false
    AllowIfMethodIsEmpty: true
    Style/StringLiterals:
    Description: Checks if uses of quotes match the configured preference.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
    Enabled: true
    EnforcedStyle: single_quotes
    SupportedStyles:
    - single_quotes
    - double_quotes
    Style/StringLiteralsInInterpolation:
    Description: Checks if uses of quotes inside expressions in interpolated strings
    match the configured preference.
    Enabled: true
    EnforcedStyle: single_quotes
    SupportedStyles:
    - single_quotes
    - double_quotes
    Style/TrailingCommaInArguments:
    Description: 'Checks for trailing comma in argument lists.'
    StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
    Enabled: true
    EnforcedStyleForMultiline: no_comma
    Style/TrailingCommaInArrayLiteral:
    Description: 'Checks for trailing comma in array literals.'
    StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
    Enabled: true
    EnforcedStyleForMultiline: no_comma
    Style/TrailingCommaInHashLiteral:
    Description: 'Checks for trailing comma in hash literals.'
    StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
    Enabled: true
    EnforcedStyleForMultiline: no_comma
    Metrics/AbcSize:
    Description: A calculated magnitude based on number of assignments, branches, and
    conditions.
    Enabled: false
    Max: 15
    Metrics/ClassLength:
    Description: Avoid classes longer than 100 lines of code.
    Enabled: false
    CountComments: false
    Max: 100
    Metrics/ModuleLength:
    CountComments: false
    Max: 100
    Description: Avoid modules longer than 100 lines of code.
    Enabled: false
    Metrics/CyclomaticComplexity:
    Description: A complexity metric that is strongly correlated to the number of test
    cases needed to validate a method.
    Enabled: false
    Max: 6
    Metrics/MethodLength:
    Description: Avoid methods longer than 10 lines of code.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
    Enabled: false
    CountComments: false
    Max: 10
    Metrics/ParameterLists:
    Description: Avoid parameter lists longer than three or four parameters.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
    Enabled: false
    Max: 5
    CountKeywordArgs: true
    Metrics/PerceivedComplexity:
    Description: A complexity metric geared towards measuring complexity for a human
    reader.
    Enabled: false
    Max: 7
    Lint/AssignmentInCondition:
    Description: Don't use assignment in conditions.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
    Enabled: false
    AllowSafeAssignment: true
    Style/InlineComment:
    Description: Avoid inline comments.
    Enabled: false
    Naming/AccessorMethodName:
    Description: Check the naming of accessor methods for get_/set_.
    Enabled: false
    Style/Alias:
    Description: Use alias_method instead of alias.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
    Enabled: false
    Style/Documentation:
    Description: Document classes and non-namespace modules.
    Enabled: false
    Style/DoubleNegation:
    Description: Checks for uses of double negation (!!).
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
    Enabled: false
    Style/EachWithObject:
    Description: Prefer `each_with_object` over `inject` or `reduce`.
    Enabled: false
    Style/EmptyLiteral:
    Description: Prefer literals to Array.new/Hash.new/String.new.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
    Enabled: false
    Style/ModuleFunction:
    Description: Checks for usage of `extend self` in modules.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
    Enabled: false
    Style/OneLineConditional:
    Description: Favor the ternary operator(?:) over if/then/else/end constructs.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
    Enabled: false
    Style/PerlBackrefs:
    Description: Avoid Perl-style regex back references.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
    Enabled: false
    Style/Send:
    Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
    may overlap with existing methods.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
    Enabled: false
    Style/SpecialGlobalVars:
    Description: Avoid Perl-style global variables.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
    Enabled: false
    Style/VariableInterpolation:
    Description: Don't interpolate global, instance and class variables directly in
    strings.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
    Enabled: false
    Style/WhenThen:
    Description: Use when x then ... for one-line cases.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
    Enabled: false
    Lint/EachWithObjectArgument:
    Description: Check for immutable argument given to each_with_object.
    Enabled: true
    Lint/HandleExceptions:
    Description: Don't suppress exception.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
    Enabled: false
    Lint/LiteralAsCondition:
    Description: Checks of literals used in conditions.
    Enabled: false
    Lint/LiteralInInterpolation:
    Description: Checks for literals used in interpolation.
    Enabled: false

    ##################### Rails ##################################

    Rails/ActionFilter:
    Description: 'Enforces consistent use of action filter methods.'
    Enabled: true
    Rails/Date:
    Description: >-
    Checks the correct usage of date aware methods,
    such as Date.today, Date.current etc.
    Enabled: true
    Rails/Delegate:
    Description: 'Prefer delegate method for delegations.'
    Enabled: true
    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
    Rails/FindBy:
    Description: 'Prefer find_by over where.first.'
    StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
    Enabled: true
    Rails/FindEach:
    Description: 'Prefer all.find_each over all.find.'
    StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find-each'
    Enabled: true
    Rails/HasAndBelongsToMany:
    Description: 'Prefer has_many :through to has_and_belongs_to_many.'
    StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
    Enabled: true
    Rails/HttpPositionalArguments:
    Description: 'Rails 5 only, disabled to keep Hound quiet'
    Enabled: false
    Rails/NotNullColumn:
    Description: 'Do not add a NOT NULL column without a default value'
    Enabled: false
    Rails/Output:
    Description: 'Checks for calls to puts, print, etc.'
    Enabled: true
    Rails/OutputSafety:
    Description: 'The use of `html_safe` or `raw` may be a security risk.'
    Enabled: true
    Rails/PluralizationGrammar:
    Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
    Enabled: true
    Rails/ReadWriteAttribute:
    Description: >-
    Checks for read_attribute(:attr) and
    write_attribute(:attr, val).
    StyleGuide: 'https://github.com/bbatsov/rails-style-guide#read-attribute'
    Enabled: true
    Rails/RequestReferer:
    Description: 'Use consistent syntax for request.referer.'
    Enabled: true
    Rails/SafeNavigation:
    Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
    Enabled: true
    Rails/ScopeArgs:
    Description: 'Checks the arguments of ActiveRecord scopes.'
    Enabled: true
    Rails/TimeZone:
    Description: 'Checks the correct usage of time zone aware methods.'
    StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
    Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
    Enabled: true
    Rails/UniqBeforePluck:
    Description: 'Prefer the use of uniq or distinct before pluck.'
    Enabled: true
    Rails/Validation:
    Description: 'Use validates :attribute, hash of validations.'
    Enabled: true
    Security/JSONLoad:
    Description : 'Prefer usage of JSON.parse'
    Enabled: true

    Layout/DotPosition:
    Description: Checks the position of the dot in multi-line method calls.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
    Enabled: true
    EnforcedStyle: leading
    SupportedStyles:
    - leading
    - trailing
    Metrics/BlockLength:
    Enabled: false
    Style/AndOr:
    Description: Use &&/|| instead of and/or.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-and-or-or
    Enabled: true
    EnforcedStyle: conditionals
    SupportedStyles:
    - always
    - conditionals
    Style/ClassAndModuleChildren:
    Enabled: true
    EnforcedStyle: nested
    SupportedStyles:
    - compact
    - nested
    Style/MultilineIfModifier:
    Enabled: false
    Style/StringLiterals:
    Description: Checks if uses of quotes match the configured preference.
    StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
    Enabled: true
    EnforcedStyle: single_quotes
    SupportedStyles:
    - single_quotes
    - double_quotes