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.
You can learn more about RuboCop on the project docs.