Mailinglist Archive: yast-devel (108 mails)

< Previous Next >
Re: [yast-devel] Yast2-bootloader and Rubocop?
I took opurtunity and try rubocop on legacy yast module like bootloader.
Result of my attempt is visible at
https://github.com/yast/yast-bootloader/pull/202
so now it is possible to compare how configuration file can look for
legacy module.

Few notes:

- some decisions are my personal code style taste. We should unify it.

- I intentionally make difference between new code in src/lib and rest.
This is really cool that rubocop allows it. E.g. old code longest
line is 299 chars, new code have 120 and can be decreased after some
cleaning. Same apply for metrics.

- auto-correct feature is really cool, but in few cases I found bugs
there.

- some options are really nice tunable

- integration with travis is really cool

- it took me two days to fine tune configuration, but I think that when
we agreed on style, then only metrics should be tuned to prevent
getting module into worser state


I welcome any comments,

Josef



On Mon, 24 Nov 2014 19:56:00 +0100
Ladislav Slezak <lslezak@xxxxxxx> wrote:


Hi all,


I looked at Rubocop (a Ruby code scanner) [1] and tried to use it in
the registration module to see if it could be used in Yast to improve
the code quality.

I have summarized my findings in a blog post [2], in short:

- it is highly configurable
- it can find also some semantic issues
- it suggests how to fix the found issues
- it can auto correct many issues (esp. indentation and white space)


You can see the found issues and fixes in this pull request [3]. Many
issues were just harmless indentation or white space issues, but some
were quite critical like this "private" attribute misuse [4].
Majority of the issues were autocorrected by Rubocop itself, I just
reviewed the changes and committed each fix in a separate commit to
see what was the problem and how it was fixed.


What do you think about Rubocop and Yast? Would it make sense to use
it globally for all modules? What would be the pros and cons for you?
Would you like to fix the coding issues in the existing code?


Thanks for your feedback!



[1] https://github.com/bbatsov/rubocop
[2] http://lslezak.blogspot.cz/2014/11/using-rubocop.html
[3] https://github.com/yast/yast-registration/pull/177
[4]
https://github.com/yast/yast-registration/commit/4f4819838723e7ddd7598976db29268226838557


--

Best Regards

Ladislav Slez√°k
Yast Developer
------------------------------------------------------------------------
SUSE LINUX, s.r.o. e-mail:
lslezak@xxxxxxx Lihovarsk√° 1060/12 tel:
+420 284 028 960 190 00 Prague 9 fax:
+420 284 028 951 Czech Republic
http://www.suse.cz/

--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
References