Commit Graph

10 Commits

Author SHA1 Message Date
Javi Martín
199d8ff609 Bump rubocop from 0.75.0 to 0.83.0
Recent versions introduce the `Layout/SpaceAroundMethodCallOperator`,
which we are going to use. We aren't upgrading to the latest rubocop
version because it conflicts with the version of Capybara we're using
and because it isn't supported by Hound.

Some rules have been renamed:

Layout/IndentAssignment is now Layout/AssignmentIndentation
Layout/IndentHeredoc is now Layout/HeredocIndentation
Layout/LeadingBlankLines is now Layout/LeadingEmptyLines
Layout/Tab is now Layout/IndentationStyle
Layout/TrailingBlankLines is now Layout/TrailingEmptyLines
Lint/StringConversionInInterpolation is now Lint/RedundantStringCoercion
Metrics/LineLength is now Layout/LineLength

Note after upgrading we get a new "offense" in the `StartWith` rule, so
we're changing the code in order to fix it.
2020-06-16 13:47:38 +02:00
Javi Martín
cf361defc7 Update rubocop version for hound
Hound now supports rubocop 0.75.
2019-10-25 23:23:28 +02:00
Javi Martín
621523cfd9 Merge basic and standard rubocop files in one file
A bit of history in order to understand this change.

A year ago we introduced Hound so it would review our pull requests and
warn contributors when they weren't following our coding style.

However, back then we had many rules we hadn't reviewed yet, and we
weren't sure we wanted to ask contributors to follow them.

So we decided to split these files: .rubocop_basic.yml would contain
rules we had already agreed on and wanted contributors to respect, and
.rubocop.yml would contain rules we still had to review.

Now we've finally gone through all these rules. We've removed some of
them, kept some of them, added new ones, and applied them.

Now all rules with a severity level of "convention" or higher return no
offenses. The rules with "severity: refactor" return some offenses,
though:

* Metrics/LineLenght can only be properly accomplished when we define
better multi-line indentation standards, while in some cases long lines
indicate we need to refactor the code
* Rails/DynamicFindBy returns a few false positives
* Rails/HasManyOrHasOneDependent should by all means be implemented,
although it will not be a trivial task
* Rails/SaveBang returns a few false positives and there are a couple of
places where we skip it on purpose

There are also rules excluding some files:

* Rails/InverseOf returns a false positive
* Rails/OutputSafety is ignored on purpose when we add auto-links to a
text we trust
* RSpec/InstanceVariable returns false positives in two files

Other than that, everything works as expected.
2019-10-25 23:23:27 +02:00
Javi Martín
19555442da Update Hound's rubocop version
Hound doesn't support version 0.75 yet, so we need to use 0.72.0.
2019-10-08 12:52:11 +02:00
Javi Martín
5211f47842 Add and apply ESLint spacing rules
For now we're only adding rules related to spacing and double quotes,
following the same rules we use in Ruby, which are the same rules
CoffeeScript followed when compiling these files.

We're also using the recommended ESLint rules, which will warn us about
many JavaScript common pitfalls, the `strict` rule which enforces using
strict mode, and the `no-console` rule, which will prevent us from
shipping code meant for debugging.

Although it's arguably more common to use the JSON format to define
these rules, I've chosen YAML because it's the format we use in all our
linters.
2019-09-11 14:03:24 +02:00
Javi Martín
d93a029ce5 Convert CofeeScript to JavaScript
Compiled using `coffee -c` with CoffeeScript 1.12.6.
2019-09-11 14:03:24 +02:00
Javi Martín
f30afab9e3 Add ERB Lint configuration file
The rubocop linter cannot use the `rubocop_config` option because it's
not compatible with Ruby 2.3. So we're setting the rubocop rules
manually.
2019-03-20 14:35:40 +01:00
Javi Martín
a0976d8bfd Enable CoffeeScript Lint in Hound
We already had a CoffeeScript Lint configuration file, but we weren't
using it. We're replacing it with a more basic one.
2019-03-05 21:38:36 +01:00
Javi Martín
7794690b8c Enable SCSS rules in Hound 2018-10-26 12:13:06 +02:00
Javi Martín
4048d17203 Add basic rubocop configuraton for Hound
This way we can ask contributors to follow some basic guidelines like
removing trailing whitespaces while not overwhelming them with all our
rules.
2018-10-26 11:46:17 +02:00