Role models are important.
-- Officer Alex J. Murphy / RoboCop
RuboCop is a Ruby static code analyzer (a.k.a. linter) and code formatter. Out of the box it will enforce many of the guidelines outlined in the community Ruby Style Guide.
Apart from reporting problems in your code, RuboCop can also automatically fix some of the problems for you.
See "Basic Usage" to get yourself familiar with RuboCop's capabilities.
RuboCop is an extremely flexible tool and most aspects of its behavior can be tweaked via various configuration options.