RuboCop and the 80 character line length limit is absurd

Having a line length limit is absurd. Just change your wrap setting in vim! IMO this gives you best of both worlds you can have everything on the screen when you need it or off when you don’t. Also, it’s easier to read indentation and syntax on one liner code snippets. When the code flows off the screen it can hide a lot of grit and make it easier to get a general lay of the land (ie. control logic) and then turn wrap on and hack.

Every time you adjust the select query you have to fiddle with the line length because OMG, it might overflow 80 and break your mac.

I myself think any line length limit is absurd, just use common sense. If it is clearer to break, then break it, otherwise don’t. But breaking it for the sake of an arbitrary length limit?

You’re inevitably going to use a line limit (You might even agree with it), so put this in your .vimrc, it highlights the 100th character. (Yeah I use a 100 character line length limit). I think Github displays 120 characters so that might actually make the most sense.

autocmd Filetype ruby highlight ColorColumn ctermbg=red
autocmd Filetype ruby call matchadd('ColorColumn', '\%101v', 120)

Published by

Anthony

Anthony loves open source software. Especially Linux and Ruby on Rails. He enjoys tinkering with his Raspberry Pi projects, writing code late at night, and drinking coffee. He aspires to be a Linux guru and software development magician. He is currently reading books on AI.

Leave a Reply

Your email address will not be published. Required fields are marked *