Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
We have to use the lowest common denominator to check the supported syntax
and in our case it is Ruby 2.1.
Please note that it will not help with unsupported syntax in HAML files
because they are not checked by Rubocop.
|
|
`Style/VariableNumber` is explicitly disabled because I don't think we
care if we name a variable `var_1` or `var1`.
|
|
|
|
This reverts commit 70faf5fdfbfa0e427b12d4181a9302394974c3cf, reversing
changes made to 2307eb84dcd1748cc231719017551111310d1bf9.
|
|
|
|
|
|
Enable some Rubocop cops related to new lines
## What does this MR do?
This MR enabled two additional Rubocop cops:
Keeps track of empty lines around block bodies.
`Style/EmptyLinesAroundBlockBody`
Keeps track of empty lines around method bodies.
` Style/EmptyLinesAroundMethodBody`
See merge request !5637
|
|
Enable Style/EmptyLinesAround Module/Class Body cop
## What does this MR do?
Enable a new rubocop cops as discussed here: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1877/diffs#note_13021078
## Are there points in the code the reviewer needs to double check?
May be a good idea to send a message to people to prevent `master` red because of the new cop.
## Why was this MR needed?
We want to improve code style and not waste endbosses time checking style manually
## What are the relevant issue numbers?
## Screenshots (if relevant)
## Does this MR meet the acceptance criteria?
- [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- Tests
- [ ] Added for this feature/bug
- [ ] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !5692
|
|
|
|
|
|
|
|
|
|
Enable Rubocop cops that check access modifiers
## What does this MR do?
This MR enables Rubocop cops that detect methods that should be restricted but are the part of public API because of access modifiers used improperly.
This also fixes existing offenses.
## Why was this MR needed?
Some method in our codebase are public instead of being private because it is sometimes difficult to get it right without static analysis.
## What are the relevant issue numbers?
See #17478
Closes #17372
See merge request !5014
|
|
Avoid multi-line ?: (the ternary operator). Use if/unless instead.
See #17478
|
|
This enables following cops:
Check for useless access modifiers
Lint/UselessAccessModifier
Checks for attempts to use `private` or `protected` to set the
visibility of a class method, which does not work.
Lint/IneffectiveAccessModifier
This also disables two false possitives in concerns.
|
|
|
|
|
|
https://github.com/bbatsov/rubocop/blob/v0.41.2/CHANGELOG.md
|
|
|
|
|
|
|
|
Enable Style/SpaceAfterComma and Colon Rubocop cops
See #17478
See merge request !4991
|
|
|
|
|
|
There are currently two cops for this:
* Migration/AddIndex: checks if indexes are added concurrently
* Migration/ColumnWithDefault: checks if columns with default values are
added in a concurrent manner
Both cops are fairly simple and make no attempt at correcting the code
as this is quite hard to do (e.g. modifications may need to be applied
in various places in the same file). They however should provide enough
to catch people ignoring the comments in generated migrations telling
them to use add_concurrent_index or add_column_with_default.
|
|
Enable Style/MultilineBlockChain rubocop style cop
Avoid multi-line chains of blocks.
See #17478.
See merge request !4349
|
|
See #17478
|
|
Migrations shouldn't fail RuboCop checks - especially lint checks, such
as the nested method check. To avoid changing code in existing
migrations, add the magic comment to the top of each of them to skip
that file.
|
|
Disable Rails/UniqBeforePluck rubocop cop
Rails/UniqBeforePluck seems to have some bugs
* https://github.com/bbatsov/rubocop/issues/3122
* https://github.com/bbatsov/rubocop/issues/3148
and we had some problems in EE with that https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/425#note_12245005
See merge request !4477
|
|
Enable Lint/AmbiguousOperator rubocop cop
Enforce using parentheses if ambiguous operators are detected, like `header *some_method` or `array.select &:even?`.
See #17478
See merge request !4454
|
|
|
|
See #17478
|
|
See #17478
|
|
Enable Style/Semicolon rubocop style cop
Don't use semicolons to terminate expressions.
See #17478.
See merge request !4351
|
|
Enable Style/For rubocop cop
> Do not use `for`, unless you know exactly why. Most of the time iterators should be used instead. `for` is implemented in terms of `each` (so you're adding a level of indirection), but with a twist - `for` doesn't introduce a new scope (unlike `each`) and variables defined in its block will be visible outside it.
See #17478
See merge request !4397
|
|
Do not use for, unless you know exactly why.
See #17478
|
|
Fix error 500 when sorting issues by milestone due date and filtering by labels
fixes #15557
See merge request !4327
|
|
See #17478
|
|
|
|
Enable Style/SpaceBeforeComma rubocop cop
No spaces before commas.
See #17478
See merge request !4360
|
|
Enable Performance/TimesMap Rubocop cop
Use Array.new with a block instead of `.times.collect` / `.times.map`.
See #17478
See merge request !4357
|
|
Enable Style/NegatedIf Rubocop cop
Favor `unless` over `if` for negative conditions (or control flow ||).
```ruby
# bad
do_something if !some_condition
# bad
do_something if not some_condition
# good
do_something unless some_condition
# good
some_condition || do_something
```
See #17478
See merge request !4355
|
|
Enable Lint/LiteralInCondition rubocop cop
Detects literals used in conditions.
See #17478
See merge request !4354
|
|
Enable Style/MultilineIfThen rubocop cop
Do not use then for multi-line if.
See #7478.
See merge request !4353
|
|
Enable Style/MethodDefParentheses rubocop cop
Use def with parentheses when there are parameters.
See #17478
See merge request !4352
|
|
Enable Style/IndentAssignment Rubocop style cop
Checks the indentation of the first line of the right-hand-side of a multi-line assignment.
See #17478
See merge request !4348
|