abartov / bybeconv

Project Ben-Yehuda's content management system.
https://benyehuda.org/
Other
10 stars 5 forks source link

Add linters to the project. #290

Closed abartov closed 3 months ago

abartov commented 3 months ago

I propose to add some linters/code analizers to project to ensure that common coding style is used by all developers, and benefit from static code analisys.

For ruby de-factor standard is a rubocop gem: https://github.com/rubocop/rubocop

We can either use it directly, or we can use some services like CodeClimate (it is free for open-source projects, see https://docs.codeclimate.com/docs/open-source-free). CodeClimate uses many tools under hood, including rubocop.

abartov commented 3 months ago

I am happy to add Rubocop and to gradually clean up the code. (But to commit lint/cleanup and actual features or bug fixes separately.)

And it seems CodeClimate doesn't (or no longer does) allow signup without requesting a demo, and demos are bookable only for companies with 100+ employees, so it effectively no longer offers a free tier.

damisul commented 3 months ago

Hey, @abartov , please check linked PR.

I've intentinally added violation to a spec, to demonstrate how it will looks like in a case of warning. Essentially linters checks are only run on lines of code affected by PR, so we should not receive tons of warnings per PR.

I've did some initial tuning of rubocop's config to disable on relax some checks, if you'll feel that some warnings are too noisy we can disable other checks later too.

Also take a look at README, I've added there a section about working with rubocop/pronto.

damisul commented 3 months ago

One of minor issues with pronto is that it does not resolves comment on fixed issues automatically. We'll need to deal with it ourselves (CodeClimate checks if some comments it issued already irrelevant and marks them as resolved automatically). But I believe we should be OK for now with this.