linter-rails-best-practices

Yen-Nan Lin

Atom editor is an open source, hackable text editor by Github and Atom community. Actually, there are a lot of good editors for programming. However, most of them are very difficult to extend its function. Atom editor is based on web technology (HTML, CSS, javascript), so it is very easy to customize and provide better visualization than other traditional editors.

screenshot

demo of linter-rails-best-practices

Linter is one of the useful functions from a good programming editor. At Atom community, there is a good Linter package that provides a backbone of basic linter functions and public APIs to let programmer reuse. As a newbie of Rails, rails_best_practices is useful to help me to identify which part needed to be improved. But there is no linter plugin for rails_best_practices at Atom, so I have to execute it manually. It’s annoying to me. That’s why I do this project.

Thanks Atom Linter community. There are a lot of linters at Github, so I can quickly to learn how they are implemented and make my linter plugin as concise as possible. Some implementations would let executable file output result with JSON to a temp file and then parse the temp file. Maybe they have some limitations, so they use a more complicated way. But I choose to use buffered child process to record standard output from the executable file, and then the plugin extract information from the line buffer with regular expression. Finally, it sends the information to Linter’s pubic APIs to show result at Atom. Now the linter-rails-best-practices would check code of Ruby, Rails, ERB, Haml, Slim, RABL at Atom.

Links: