openSUSE / opi

OBS Package Installer (CLI)
GNU General Public License v3.0
248 stars 22 forks source link

perlcritic issues fixed #18

Closed Tux closed 5 years ago

Tux commented 5 years ago

I have gone though most of the perlcritic issues that are easy to fix without changing too much code

Please consider

guoyunhe commented 5 years ago

Please give detailed explanation of your change. For example, why remove File::Temp, why prefix $_obs_apiroot with an underscore.

Tux commented 5 years ago

require 5.8.1 because that is the minimum syntax you use • Removed Tile::Temp because it isn't used • Added List::Util qw/ first / to speed up a replaced grep in boolean contaxt on a possible large list • Prefixed with the underscore because it otherwise cloacks another variable in a different scope with the same same • Added the semicolon because of consistency • die instead of print+exit for two reasons: 1: it is more clear, 2. a die can be caught and the error message will be available • return $1 to not use $&, which - on older perl versions - will cause an overall slowdown • else return → return, as there should never be an else after an unconditional die, croak, exit, next, or return. • Use $bo instead of $b as there is no reason to use $b, which is a special variable and can cause action at a distance. $a and $b should be reserved for use in sort only. • Declarations of arrays do not need initializing with () • Force list context in sort return • Indirect object invocation is frowned upon, as it me lead to weird and incromprehencible error messages