Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How best to use ruumba with rubocop on a Rails project? #10

Open
kaoru opened this issue Dec 12, 2017 · 3 comments
Open

How best to use ruumba with rubocop on a Rails project? #10

kaoru opened this issue Dec 12, 2017 · 3 comments
Assignees
Labels

Comments

@kaoru
Copy link

kaoru commented Dec 12, 2017

We have a .rubocop.yml file, which inherits from a .rubocop_todo.yml file generated with the --auto-gen-config option.

I've just tried running ruumba app/views --auto-gen-config and it's overwritten my .rubocop_todo.yml file.

What's more it hasn't made ruumba app/views run cleanly, I still get lots of warnings from it.

There's some notes in your README about using a .ruumba.yml and inheriting from .rubocop.yml? I've tried that but it's still not running cleanly.

How do you recommend we lay out our configuration files for rubocop and ruumba, and which command or commands should we run to run them?

I think this would be a useful section to add to your README file somewhere. Thanks!

@olliebennett
Copy link

olliebennett commented Aug 22, 2018

If it's useful, I've pasted my .ruumba.yml config below.

  • This is based on ruumba (0.1.5) and rubocop (0.58.2).
  • See the comments for my instructions on how I regenerate some of this and workaround the unreliable --auto-gen-config behaviour.
inherit_from: .rubocop.yml

AllCops:
  Include:
    - '**/*.erb'

# The following cops are not applicable to ERB files

Style/CommentedKeyword:
  Enabled: false

Style/FrozenStringLiteralComment:
  Enabled: false

# Arguably all 'Layout' cops are not applicable

Layout/AlignHash:
  Enabled: false

Layout/AlignParameters:
  Enabled: false

Layout/BlockAlignment:
  Enabled: false

Layout/CaseIndentation:
  Enabled: false

Layout/ClosingParenthesisIndentation:
  Enabled: false

Layout/CommentIndentation:
  Enabled: false

Layout/ConditionPosition:
  Enabled: false

Layout/EndAlignment:
  Enabled: false

Layout/ElseAlignment:
  Enabled: false

Layout/EmptyLines:
  Enabled: false

Layout/EmptyLinesAroundBlockBody:
  Enabled: false

Layout/ExtraSpacing:
  Enabled: false

Layout/FirstParameterIndentation:
  Enabled: false

Layout/IndentArray:
  Enabled: false

Layout/IndentationConsistency:
  Enabled: false

Layout/IndentationWidth:
  Enabled: false

Layout/IndentHash:
  Enabled: false

Layout/InitialIndentation:
  Enabled: false

Layout/LeadingBlankLines:
  Enabled: false

Layout/LeadingCommentSpace:
  Enabled: false

Layout/MultilineMethodCallBraceLayout:
  Enabled: false

Layout/MultilineMethodCallIndentation:
  Enabled: false

Layout/SpaceAfterColon:
  Enabled: false

Layout/SpaceAfterComma:
  Enabled: false

Layout/SpaceAroundOperators:
  Enabled: false

Layout/SpaceBeforeBlockBraces:
  Enabled: false

Layout/SpaceBeforeComma:
  Enabled: false

Layout/SpaceBeforeComment:
  Enabled: false

Layout/SpaceBeforeFirstArg:
  Enabled: false

Layout/SpaceBeforeSemicolon:
  Enabled: false

Layout/SpaceInsideArrayLiteralBrackets:
  Enabled: false

Layout/SpaceInsideBlockBraces:
  Enabled: false

Layout/SpaceInsideHashLiteralBraces:
  Enabled: false

Layout/SpaceInsideParens:
  Enabled: false

Layout/SpaceInsideStringInterpolation:
  Enabled: false

Layout/TrailingBlankLines:
  Enabled: false

Layout/TrailingWhitespace:
  Enabled: false

# Incorrectly flagged by Ruumba
# Typically the false positives relate to important HTML differences which aren't
# inside ERB tags and so aren't detected correctly by Ruumba.
# TODO: Monitor these, and re-enable permanently once Ruumba flags correctly.

Lint/Void:
  Enabled: false

Lint/EmptyWhen:
  Enabled: false

Rails/Presence:
  Enabled: false

Style/EmptyElse:
  Enabled: false

Style/IdenticalConditionalBranches:
  Enabled: false

Style/IfInsideElse:
  Enabled: false

Style/IfUnlessModifier:
  Enabled: false

Style/Next:
  Enabled: false

Style/UnneededCondition:
  Enabled: false

# TODO: Enable cops below and resolve violations.
# Note: The `--auto-gen-config` flag is glitchy with `ruumba`.
# To re-generate this list;
# - delete all rules below this comment and save.
# - run `bin/ruumba`
# - Copy full output (many errors + warnings!)
# - Use text manipulation to extract occurrences of `: C: XXXX/YYYY` and `: W: XXXX/YYYY`
# - De-duplicate and sort the matching cop names
# - Paste below and manipulate to be `Enabled: false` in each case.

Metrics/BlockLength:
  Enabled: false

Metrics/BlockNesting:
  Enabled: false

Metrics/LineLength:
  Enabled: false

Rails/OutputSafety:
  Enabled: false

Rails/UnknownEnv:
  Enabled: false

Style/BlockDelimiters:
  Enabled: false

Style/BracesAroundHashParameters:
  Enabled: false

Style/MultilineIfModifier:
  Enabled: false

Style/NestedParenthesizedCalls:
  Enabled: false

Style/NestedTernaryOperator:
  Enabled: false

Style/Semicolon:
  Enabled: false

Style/StringLiterals:
  Enabled: false

Style/SymbolProc:
  Enabled: false

Style/TernaryParentheses:
  Enabled: false

Style/ZeroLengthPredicate:
  Enabled: false

@kaoru
Copy link
Author

kaoru commented Aug 30, 2018

Amazing, thanks for sharing @olliebennett! I'll give that a go and let you know how I get on 😄 👍

@ericqweinstein
Copy link
Owner

@kaoru, glad @olliebennett could help! Let me know if you get along and/or if you still would like a README update. (Things are hectic on my end these days, but README updates should be pretty easy to merge.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants