new rubocop and new config for it
Hi, Short Version ------------- New rubocop in testing. New shared config is done and also demonstrated on three example modules. Speak now or complain later. PR with new shared rubocop including reasoning: https://github.com/yast/yast-devtools/pull/163 PR with adaptation of picked modules: - https://github.com/yast/yast-storage-ng/pull/1278 - https://github.com/yast/yast-yast2/pull/1230 - https://github.com/yast/yast-bootloader/pull/660 Long Version and Observations ----------------------------- Why === TW now uses ruby 3.0 and will be soon using 3.1. The bad part is that our ancient versions of rubocop does not work with new ruby. So we had two options either patch old rubocop or adapt to new one. After discussion we decide for the second option as even our older version had problem with some ruby 2.3 syntax. Observations ============ - new rubocop has safe and unsafe auto corrections. --auto-correct do only safe ones. -A does both. It is useful when doing adaptation as I usually do safe first and then carefully review rest of changes done by -A - rubocop --only is useful to fix just set of cops if you have huge list of issues. I do it, when I want to do manual cops one per commit - redundant branch cop has issue with some workflow encoded in elsifs..as two branches looks identical, but it is under chain of previous condition . In general problem mainly in uterly old ugly code and it is quite rare - similar issue applies to new combinable loops cop. As a loop can modify itself or order is important like in this case of storage-ng https://github.com/yast/yast-storage-ng/pull/1278/commits/e1d9020409409f0b55... - new cop to check if important methods like constructor call super is quite useful and reveal some real bugs in storage-ng code ( like using nil as widget ID for Empty object ). I think majority of issues needs fix in https://github.com/yast/yast-storage-ng/pull/1278/commits/14ca4c6f4544362d5b... as trivial fix was not enough and I overlook it at first. - also Lint/DuplicateElsifCondition find real bug in yast2 - https://github.com/yast/yast-yast2/pull/1230/commits/6866413d9fdfc94619d8236... So please comment in pull request or directly as answer here to email. I think quick discussion can happen on review meeting. Josef
participants (1)
-
josef Reidinger