Rubocop is a static code check tool for ruby. Very handy and powerful.
Here is a list of Common Rubocop Errors, for your reference. You can simply search by your Rubocop error message in this post. And get your code improved quickly.
Ruby is a frequently used glue language for DevOps. Both Chef and Puppet are implemented by Ruby. For ruby code check, I use Rubocop[1] and Foodcritic[2] frequently. For Python code, I use pylint[3]. For Shell code, I highly recommend shellcheck.
Tips: Create Jenkins jobs to run periodical check for all your scripts.
Here are samples in Github: Ruby, Python and Bash. GitHub
I also maintain a free and available demo Jenkins here.
for this error message: Rubocop Error: Use 0o for octal literals
Add ignore rule to .rubocop.yml would be better because these numbers are not octal literals.
Style/NumericLiteralPrefix:
EnforcedOctalStyle: zero_only
Jack, thanks for your input.
Yes, skipping the rule is also one feasible way.
I’ve updated the post according to your feedback, Jack.
http://www.dennyzhang.com/rubocop_errors/#sec-1-3
For the example of file mode in this post, I think it’s octal literals. Right?
And enabling this rule will give us extra benefits. Do you agree, Jack?
[…] Note: If you’re using Ruby heavily, check about this: Common Rubocop Errors. […]