-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: Add rubocop and simplecov (#30)
- Loading branch information
1 parent
f59d169
commit d08ab85
Showing
5 changed files
with
311 additions
and
2 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
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,296 @@ | ||
require: | ||
- rubocop-rspec | ||
- rubocop-performance | ||
- rubocop-rails | ||
- rubocop-thread_safety | ||
|
||
AllCops: | ||
DisplayStyleGuide: true | ||
Exclude: | ||
- 'bin/**/*' | ||
- 'db/schema.rb' | ||
|
||
Layout/BlockAlignment: | ||
Description: 'Align block ends correctly.' | ||
Enabled: true | ||
# The value `start_of_block` means that the `end` should be aligned with line | ||
# where the `do` keyword appears. | ||
EnforcedStyleAlignWith: start_of_block | ||
|
||
Layout/ClassStructure: | ||
Description: 'Enforces a configured order of definitions within a class body.' | ||
Enabled: true | ||
Categories: | ||
module_inclusion: | ||
- include | ||
- prepend | ||
- extend | ||
ExpectedOrder: | ||
- module_inclusion | ||
- constants | ||
- public_class_methods | ||
- initializer | ||
- public_methods | ||
- protected_methods | ||
- private_methods | ||
|
||
Layout/EndAlignment: | ||
Description: 'Align ends correctly.' | ||
Enabled: true | ||
# The value `variable` means that in assignments, `end` should be aligned | ||
# with the start of the variable on the left hand side of `=`. In all other | ||
EnforcedStyleAlignWith: variable | ||
|
||
Layout/FirstArrayElementLineBreak: | ||
Description: 'Checks for a line break before the first element in a multi-line array.' | ||
Enabled: true | ||
|
||
Layout/FirstHashElementLineBreak: | ||
Description: 'Checks for a line break before the first element in a multi-line hash.' | ||
Enabled: true | ||
|
||
Layout/FirstMethodArgumentLineBreak: | ||
Description: 'Checks for a line break before the first argument in a multi-line method call.' | ||
Enabled: true | ||
|
||
Layout/FirstMethodParameterLineBreak: | ||
Description: 'Checks for a line break before the first parameter in a multi-line method parameter definition.' | ||
Enabled: true | ||
|
||
Layout/FirstArgumentIndentation: | ||
Description: 'Checks the indentation of the first argument in a method call.' | ||
Enabled: true | ||
# The first parameter should always be indented one level relative to the | ||
# parent that is receiving the parameter | ||
EnforcedStyle: consistent | ||
|
||
Layout/FirstArrayElementIndentation: | ||
Description: 'Checks the indentation of the first element in an array literal.' | ||
Enabled: true | ||
# The value `consistent` means that the indentation of the first element shall | ||
# always be relative to the first position of the line where the opening | ||
# bracket is. | ||
EnforcedStyle: consistent | ||
|
||
Layout/FirstHashElementIndentation: | ||
Description: 'Checks the indentation of the first key in a hash literal.' | ||
Enabled: true | ||
# The value `consistent` means that the indentation of the first key shall | ||
# always be relative to the first position of the line where the opening | ||
# brace is. | ||
EnforcedStyle: consistent | ||
|
||
Layout/LineLength: | ||
Description: 'Limit lines to 120 characters.' | ||
Enabled: true | ||
Max: 120 | ||
|
||
Layout/MultilineArrayLineBreaks: | ||
Description: 'Checks that each item in a multi-line array literal starts on a separate line.' | ||
Enabled: true | ||
|
||
Layout/MultilineAssignmentLayout: | ||
Description: 'Check for a newline after the assignment operator in multi-line assignments.' | ||
Enabled: true | ||
# Ensures that the assignment operator and the rhs are on the same line for | ||
# the set of supported types. | ||
EnforcedStyle: same_line | ||
|
||
Layout/MultilineHashKeyLineBreaks: | ||
Description: 'Checks that each item in a multi-line hash literal starts on a separate line.' | ||
Enabled: true | ||
|
||
Layout/MultilineMethodArgumentLineBreaks: | ||
Description: 'Checks that each argument in a multi-line method call starts on a separate line.' | ||
Enabled: true | ||
|
||
Layout/MultilineMethodCallIndentation: | ||
Description: 'Checks indentation of method calls with the dot operator that span more than one line.' | ||
Enabled: true | ||
EnforcedStyle: indented | ||
|
||
Lint/AmbiguousBlockAssociation: | ||
Description: 'Checks for ambiguous block association with method when param passed without parentheses.' | ||
Enabled: true | ||
Exclude: | ||
- 'spec/**/*' | ||
|
||
Metrics/AbcSize: | ||
Enabled: false | ||
|
||
Metrics/BlockLength: | ||
Enabled: false | ||
|
||
Metrics/ClassLength: | ||
Enabled: false | ||
|
||
Metrics/CyclomaticComplexity: | ||
Enabled: false | ||
|
||
Metrics/MethodLength: | ||
Enabled: false | ||
|
||
Metrics/ModuleLength: | ||
Enabled: false | ||
|
||
Metrics/PerceivedComplexity: | ||
Enabled: false | ||
|
||
Naming/PredicateName: | ||
Enabled: false | ||
|
||
Performance/CaseWhenSplat: | ||
Enabled: true | ||
|
||
Rails/InverseOf: | ||
Description: 'Checks for associations where the inverse cannot be determined automatically.' | ||
Enabled: false | ||
|
||
Rails/HttpStatus: | ||
Description: 'Enforces use of symbolic or numeric value to describe HTTP status.' | ||
Enabled: false | ||
|
||
Rails/HasManyOrHasOneDependent: | ||
Description: 'Forces a "dependent" options for has_one and has_many rails relations.' | ||
Enabled: false | ||
|
||
RSpec/ExampleLength: | ||
Description: 'Checks for long examples.' | ||
Enabled: false | ||
|
||
RSpec/MultipleExpectations: | ||
Description: 'Checks if examples contain too many expect calls.' | ||
Enabled: false | ||
|
||
RSpec/MultipleMemoizedHelpers: | ||
Enabled: false | ||
|
||
RSpec/NestedGroups: | ||
Enabled: false | ||
|
||
Style/BlockDelimiters: | ||
Description: >- | ||
Avoid using {...} for multi-line blocks (multiline chaining is always ugly). | ||
Prefer {...} over do...end for single-line blocks. | ||
Enabled: true | ||
EnforcedStyle: line_count_based | ||
IgnoredMethods: | ||
- lambda | ||
- proc | ||
- it | ||
- expect | ||
- change | ||
|
||
Style/CommentAnnotation: | ||
Description: 'Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE, INFO).' | ||
Enabled: true | ||
Keywords: | ||
- TODO | ||
- FIXME | ||
- OPTIMIZE | ||
- HACK | ||
- REVIEW | ||
- NOTE | ||
- INFO | ||
|
||
Style/Documentation: | ||
Enabled: false | ||
|
||
Style/MethodCallWithArgsParentheses: | ||
Description: 'Use parentheses for method calls with arguments.' | ||
Enabled: true | ||
IgnoreMacros: true | ||
IgnoredMethods: | ||
- require_relative | ||
- require | ||
- load | ||
- raise | ||
- desc | ||
- yield | ||
- puts | ||
AllowParenthesesInMultilineCall: false | ||
AllowParenthesesInChaining: false | ||
AllowParenthesesInCamelCaseMethod: false | ||
EnforcedStyle: require_parentheses | ||
Exclude: | ||
- 'lib/tasks/**/*' | ||
- 'db/**/*' | ||
- 'spec/**/*' | ||
- 'config.ru' | ||
- 'Gemfile' | ||
- '**/rspec/**/*.rb' | ||
|
||
Style/NestedParenthesizedCalls: | ||
Description: >- | ||
Parenthesize method calls which are nested inside the | ||
argument list of another parenthesized method call. | ||
Enabled: true | ||
AllowedMethods: [] | ||
|
||
Style/OneLineConditional: | ||
Description: 'Favor the ternary operator(?:) over if/then/else/end constructs.' | ||
Enabled: false | ||
|
||
Style/Send: | ||
Description: >- | ||
Prefer `Object#__send__` or `Object#public_send` to `send`, | ||
as `send` may overlap with existing methods. | ||
Enabled: true | ||
|
||
Style/SymbolArray: | ||
Description: 'Use %i or %I for arrays of symbols.' | ||
Enabled: false | ||
|
||
Style/TrailingCommaInArguments: | ||
Description: 'Checks for trailing comma in argument lists.' | ||
StyleGuide: '#no-trailing-params-comma' | ||
Enabled: true | ||
VersionAdded: '0.36' | ||
# If `comma`, the cop requires a comma after the last argument, but only for | ||
# parenthesized method calls where each argument is on its own line. | ||
# If `consistent_comma`, the cop requires a comma after the last argument, | ||
# for all parenthesized method calls with arguments. | ||
EnforcedStyleForMultiline: comma | ||
SupportedStylesForMultiline: | ||
- comma | ||
- consistent_comma | ||
- no_comma | ||
|
||
Style/TrailingCommaInArrayLiteral: | ||
EnforcedStyleForMultiline: comma | ||
|
||
Style/TrailingCommaInHashLiteral: | ||
EnforcedStyleForMultiline: comma | ||
|
||
Style/TernaryParentheses: | ||
Description: 'Checks for use of parentheses around ternary conditions.' | ||
Enabled: true | ||
EnforcedStyle: require_parentheses_when_complex | ||
|
||
Style/GlobalVars: | ||
Description: 'Do not introduce global variables.' | ||
StyleGuide: '#instance-vars' | ||
Reference: 'https://www.zenspider.com/ruby/quickref.html' | ||
Enabled: true | ||
VersionAdded: '0.13' | ||
# Built-in global variables are allowed by default. | ||
AllowedVariables: ['$segment_client', '$json_web_token'] | ||
|
||
Style/ClassAndModuleChildren: | ||
Exclude: | ||
- 'test/**/*' | ||
|
||
Lint/RaiseException: | ||
Enabled: false | ||
|
||
Lint/StructNewOverride: | ||
Enabled: false | ||
|
||
Style/HashEachMethods: | ||
Enabled: false | ||
|
||
Style/HashTransformKeys: | ||
Enabled: false | ||
|
||
Style/HashTransformValues: | ||
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
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
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