mastodon icon indicating copy to clipboard operation
mastodon copied to clipboard

Add rubocop-rspec

Open larouxn opened this issue 2 years ago • 2 comments

Add rubocop-rspec to ensure stylistic best practices in our test suite.

Alternative to disabling extension suggestions, see below.

  • https://github.com/mastodon/mastodon/pull/20548

larouxn avatar Nov 13 '22 11:11 larouxn

The spec directory is currently excluded in .rubocop.yml. Is this extension necessary?

ykzts avatar Nov 14 '22 09:11 ykzts

The spec directory is currently excluded in .rubocop.yml. Is this extension necessary?

Hmm good point. This gem won't do anything if that directory is excluded. Thanks for the catch!

Sounds like we should probably un-exclude that and add this gem, to make sure our tests are the best they can be. I'll quickly push that change here to see how the CI linting step fares.

larouxn avatar Nov 14 '22 09:11 larouxn

@larouxn

Sounds like we should probably un-exclude that and add this gem, to make sure our tests are the best they can be. I'll quickly push that change here to see how the CI linting step fares.

The whole RuboCop setup seems to be broken, and RuboCop does not pass on the code base.

image

I suspect the CI linting job is only linting on the PR's changed code (which is OK, and not bad actually), so that is why it is not failing here.

I happened to drift into the RuboCop topic myself in a parallel PR https://github.com/mastodon/mastodon/pull/20574 (I missed your's, shame on me).

It turns out that the entire RuboCop config needs an overhaul, the gems updateing and a generated RuboCop todo.

I did all that in #20574 and also added rubocop-rspec and rubocop-performance gems there.

I'm sorry about that parallelism of mine.

However, I'm sure though, that this cannot be fixed by adding the gem. The overhaul is needed, to get RuboCop to hint the devs to good code again.

casaper avatar Nov 16 '22 21:11 casaper

👋 @casaper, that all makes a lot more sense. I was seeing RuboCop linting failure locally but not in here (PR CI). Definitely we need to revamp our RuboCop and linting integration/setup. Thank you for taking a look into it!

Closing this PR in favour of your better, more comprehensive approach. 🙇‍♂️ (https://github.com/mastodon/mastodon/pull/20574)

larouxn avatar Nov 17 '22 00:11 larouxn