A reader asked me for quick recommendations on writing clean code. Here’s what I wrote back:
But you may just mean “easy to maintain”. For that, there are a number of Rails best practices that can help in Rails, if that’s what you’re using at the time. You can even install a gem to check some of them automatically (https://github.com/railsbp/rails_best_practices).
Finding a style guide can help, though it will only get you so far. It’s easy to see how to improve a little, and the rules are well explained. Here’s the one GitHub uses internally: https://github.com/styleguide/ruby
To a large extent, just make sure you maintain your own code. Nothing else keeps you honest quite as well as using and maintaining your own stuff!