aboutsummaryrefslogtreecommitdiffstats
path: root/.rubocop.yml
Commit message (Collapse)AuthorAgeFilesLines
* Add custom RuboCop for `assert_not` over `refute`Daniel Colson2018-04-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | Since at least cf4afc4 we have preferred `assert_not` methods over `refute` methods. I have seen plenty of comments in PRs about this, and we have tried to fix it a few times (5294ad8, e45f176, 8910f12, 41f50be, d4cfd54, 48a183e, and 211adb4), but the `refute` methods keep sneaking back in. This custom RuboCop will take care of enforcing this preference, so we don't have to think about it again. I suspect there are other similar stylistic preferences that could be solved with some custom RuboCops, so I will definitely keep my eyes open. `assert_not` over `assert !` might be a good candidate, for example. I wasn't totally sure if `ci/custom_cops` was the best place to put this, but nothing else seemed quite right. At one point I had it set up as a gem, but I think custom cops like this would have limited value in another context. I want to see how code climate handles the new cops before autocorrecting the existing violations. If things go as expected, I will push another commit with those corrections.
* Add cop for preferring 'Foo.method' over 'Foo::method'Andrew White2018-02-221-0/+4
|
* Rails 6 requires Ruby 2.4.1+Jeremy Daer2018-02-171-1/+1
| | | | | | Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug. References #32028
* Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-161-1/+1
| | | | | Some places we can't remove because Ruby still don't have a method equivalent to strip_heredoc to be called in an already existent string.
* Enable autocorrect for `Lint/EndAlignment` copKoichi ITO2018-01-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary This PR changes .rubocop.yml. Regarding the code using `if ... else ... end`, I think the coding style that Rails expects is as follows. ```ruby var = if cond a else b end ``` However, the current .rubocop.yml setting does not offense for the following code. ```ruby var = if cond a else b end ``` I think that the above code expects offense to be warned. Moreover, the layout by autocorrect is unnatural. ```ruby var = if cond a else b end ``` This PR adds a setting to .rubocop.yml to make an offense warning and autocorrect as expected by the coding style. And this change also fixes `case ... when ... end` together. Also this PR itself is an example that arranges the layout using `rubocop -a`. ### Other Information Autocorrect of `Lint/EndAlignment` cop is `false` by default. https://github.com/bbatsov/rubocop/blob/v0.51.0/config/default.yml#L1443 This PR changes this value to `true`. Also this PR has changed it together as it is necessary to enable `Layout/ElseAlignment` cop to make this behavior.
* Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the futureRyuta Kamizono2017-12-141-0/+3
| | | | Follow up of #31432.
* Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed moreRyuta Kamizono2017-12-121-0/+3
| | | | Follow up of #31390.
* Enable `Style/DefWithParentheses` rubocop ruleRyuta Kamizono2017-11-271-0/+3
| | | | | | | The def with blank `()` was newly added in #31176, but we have not used the blank `()` style in most part of our code base. So I've enabled `Style/DefWithParentheses` to prevent to newly added the code.
* Enable `Style/RedundantReturn` rubocop rule, and fixed a couple moreRyuta Kamizono2017-11-011-0/+4
| | | | Follow up of #31004.
* Merge pull request #31005 from shuheiktgw/remove_unnecessary_semicolonsMatthew Draper2017-10-281-0/+4
| | | | Removed unnecessary semicolons
* Remove frozen_string_literal comment from activestorage's migrationbogdanvlviv2017-08-221-0/+1
| | | | | The activestorage's migration is used as template for apps Related to #30348
* Fix RuboCop offensesKoichi ITO2017-08-161-0/+1
| | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-1/+0
|
* Remove unnecessary Include parameter in rubocop.ymlKoichi ITO2017-08-141-1/+0
|
* Use frozen string literal in root filesKoichi ITO2017-08-131-13/+1
|
* Use frozen string literal in ci/Koichi ITO2017-08-131-0/+1
|
* Use frozen string literal in tools/Koichi ITO2017-08-131-0/+1
|
* Use frozen string literal in tasks/Koichi ITO2017-08-131-0/+1
|
* Use frozen string literal in guides/Koichi ITO2017-08-131-0/+1
|
* Use frozen string literal in Active StorageKoichi ITO2017-08-121-0/+1
|
* Do not change the entire codebase style only because of active_storageRafael Mendonça França2017-08-031-1/+0
| | | | | | We are already removing the braces around hash parameters in the last argument in other places so we should not change the entire codebase because of two places.
* Fix all rubocop violationsRafael Mendonça França2017-08-031-4/+1
|
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+3
|
* Use frozen string literal in actionview/Kir Shatrov2017-07-241-0/+4
|
* Use frozen string literal in actioncable/Kir Shatrov2017-07-231-0/+1
|
* Use frozen string literal in actionmailer/Kir Shatrov2017-07-231-0/+1
|
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+1
|
* Enable `Layout/FirstParameterIndentation` copRyuta Kamizono2017-07-171-0/+3
| | | | | | | We have some indentation cops. But now there is a little inconsistent params indentations. Enable `Layout/FirstParameterIndentation` cop to prevent newly inconsistent indentation added and auto-correct to existing violations.
* Use frozen string literal in activemodel/Kir Shatrov2017-07-161-0/+1
|
* Enable Layout/EmptyLineAfterMagicComment copKoichi ITO2017-07-111-0/+3
|
* Use frozen-string-literal in ActiveJobKir Shatrov2017-07-091-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+6
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-4/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+4
|
* rubocop namespace changes from `Style` to `Layout`Yasuo Honda2017-05-241-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refer https://github.com/bbatsov/rubocop/pull/4278/commits/54166bf76ba76b14f1bbc8a34165f175dbc3f227 for the commit ``` /path/to/rails/.rubocop.yml: Style/CaseIndentation has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/CommentIndentation has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/EmptyLines has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/EmptyLinesAroundClassBody has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/EmptyLinesAroundMethodBody has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/EmptyLinesAroundModuleBody has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/IndentationConsistency has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/IndentationWidth has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceAfterColon has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceAfterComma has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceAroundEqualsInParameterDefault has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceAroundKeyword has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceAroundOperators has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceBeforeFirstArg has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceBeforeBlockBraces has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceInsideBlockBraces has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceInsideHashLiteralBraces has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/SpaceInsideParens has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/Tab has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/TrailingBlankLines has the wrong namespace - should be Layout /path/to/rails/.rubocop.yml: Style/TrailingWhitespace has the wrong namespace - should be Layout ```
* Add `Style/EmptyLinesAroundMethodBody` in `.rubocop.yml` and remove extra ↵Ryuta Kamizono2017-02-121-0/+4
| | | | empty lines
* Rename AlignWith to EnforcedStyleAlignWithtoshimaru2017-01-161-1/+1
|
* Shave a couple of allocations off Journey scan & parseMatthew Draper2016-12-251-0/+1
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-0/+21
|
* Set target ruby version for rubocop to 2.2 instead 2.3.Igor Zubkov2016-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change will help to catch ruby 2.3+ syntax in code base. Right now, minimal ruby version set to 2.2.2 in gemspecs. Rubocop output before: $ rubocop Inspecting 2133 files .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................CC......................................................................................................................................................................................................................................................... Offenses: activerecord/test/cases/schema_dumper_test.rb:454:32: C: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. output = dump_table_schema('infinity_defaults') ^^^^^^^^^^^^^^^^^^^ guides/bug_report_templates/active_record_migrations_gem.rb:65:4: C: Final newline missing. end guides/bug_report_templates/active_record_migrations_master.rb:64:4: C: Final newline missing. end 2133 files inspected, 3 offenses detected $ After: $ rubocop Inspecting 2133 files .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................CC......................................................................................................................................................................................................................................................... Offenses: activerecord/test/cases/schema_dumper_test.rb:454:32: C: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. output = dump_table_schema('infinity_defaults') ^^^^^^^^^^^^^^^^^^^ guides/bug_report_templates/active_record_migrations_gem.rb:65:4: C: Final newline missing. end guides/bug_report_templates/active_record_migrations_master.rb:64:4: C: Final newline missing. end 2133 files inspected, 3 offenses detected $
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-0/+4
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-0/+12
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Fix a typoVijay Dev2016-08-071-1/+1
|
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-0/+4
|
* adds a few cops and sortsXavier Noria2016-08-061-21/+48
|
* explain the meaning of some RuboCop config options [ci skip]Xavier Noria2016-07-211-0/+8
| | | | | | | | For consistency mainly. Also, some have a name that could make the reader think they enforce the opposite of what they do, because the default is not visible there.
* Add a new rule to rubocopRafael Mendonça França2016-07-201-10/+13
|
* Enable a few more rubocop rulesRafael Mendonça França2016-07-171-0/+13
|
* Move code style configuration files to root directoryJon Moss2016-06-161-0/+27
I think these are meant to be in the root directory, not in `/activerecord`? :grimacing: r? @sgrif [ci skip]