Hound: Review JavaScript, CoffeeScript, and Ruby code for style guide violations
houndci.com
houndci.com
There's really no way not to sound like a pedantic jerk when you comment on someone's pull request about such things.
This at least makes the robot out to be the pedant.
a few years ago, IIRC, Josh Peek did that for the Rails code base and that one commit got like five thousand "thank you" comments.
That, and tasks that are left to be dealt with later are tasks that never get done.
> Use CoffeeScript
[1] https://github.com/thoughtbot/guides/blob/master/best-practi...
That being said, if you care about these things, I wonder if these checks are best left to a pre-commit hook. It removes noise from the commit history and the PRs and forces people to think about it right away, rather than being corrected after the fact.
I guess having that done on a server has the benefit of not having to worry about keeping the linters' version up-to-date/homogenous over all the devs' machines.
At work, we have JSCS (https://github.com/jscs-dev/node-jscs) and SCSS-lint (https://github.com/causes/scss-lint) as part of our pre-commit hook (on top of editor plugins) and that has been great honestly. It decreased the PR noise a lot and I feel it has been good for new hires since it avoids having the first PR comments being about style issues.
I wrote a post about how I added JSCS in the pre-commit hook by the way: http://tech.adroll.com/blog/web/2014/03/05/adding-jscs-to-yo... It should be easily extendable to other linters.
My argument is that often, especially on a large existing codebase, you'll get thousands of warnings and in that case, having the trends over time is useful as a way of measuring progress. The relative change is more important than the absolute value.
We work a lot with opensource projects and you need to respect the project style. Since some of our stuff was created from other things, we can't even keep the same jshintrc configuration for all our things.
I use SublimeLinter [1] in Sublime. It shows me the errors in an integrated fashion.
Once the project has some maturity it is better to not change the rules because you don't want to waste a lot of time changing stupid things like double quotes to single quotes.
If I see 150 errors in a file, it is likely that I will introduce the 151, and it usually means that your jshintrc is a fantasy. If I see less than 5 errors I will fix them all and use git blame to know who introduce these bugs and kindly recommend using an integrated linter with the editor.
I don't think is good idea to run a linter like this on any kind of CI. If someone breaks something serious the test suite will fail anyway, and if is not so serious why wasting time fixing it. I think is definitely better an easier to educate your team to use some plugin on their editor.
I'm not even sure why code editor can produce code that does not obey agreed upon stylistic rules. Oh, wait. It's because it's not a code editor, just a text editor. Why don't we have cod editors yet?
Most good linters enforce as many "best practices" as they enforce "style suggestions".
Imho: It's important you know why / what they recommend.
Regarding the second:
100% Agree.
I was going to snark that we do, they're called IDEs and they're horrible, but then I realized something.
In between an IDE and a text editor, there could totally exist a bona fide code editor, an in-between kind of system, but we (devs) tend to cluster our solutions under two categories, namely text editors (raw, simple, direct) and IDEs (complex, featureful, enormous).
This reminds me of a weird thing about testing frameworks - staggering numbers of testing frameworks get written, yet nearly all of them tend to either use "assert"-style syntax or "should/expect"-style syntax.
There could totally exist other families of syntax, but there don't. (Actually, there probably do, but if so, I'm not aware of them, and it could be because they're far from the mainstream.)
So with both these examples, you have this incredible diversity of implementations which can be divided really easily into just two basic categories. So even though there's an enormous amount of diversity at a very granular level, just one conceptual level up, there's almost no diversity at all.
So because of all this I have to say that I think your question is actually a much better question than I initially thought.
I'm currently working on a PHP version of Hound, called Anorak[1]. At the moment I'm part of a small team building a PHP replacement of Rubocop called Hippo[2]. We originally wrote a basic tokenizer with regex, but although it works well, we realise it's slow, so we're rebuilding it with "token_get_all" and hacking around that.
There are a lot of small, plain Ruby classes that are very easy to understand. Must be relatively easy to maintain and add new features.
[1] https://github.com/thoughtbot/hound
[2] http://robots.thoughtbot.com/sandi-metz-rules-for-developers
https://developers.google.com/closure/utilities/docs/linter_...
Personally I prefer this over cluttering the PR process.
Codelinters are imho less about "style" than about best practices. And many exist for good reason other just for uniformity. Both is usually important enough to enforce it.
2) if they do you dont want to wait until the tests pass - so it's outside of that process anyhow
3) the real root problem here is: "emergency deploys need to be fast and adhoc" - not "linting is part of the ci process"
Guard will first execute the rspec tests, and only if those pass it will execute rubocop. This way you don't have rubocop immediatelly complaning if you make a style violation and can focus on making the code work first. Once you are done with that you will still nagged about style before you commit your code.
Usually tests take quite a bit and you dont want to wait forever to finally see an obvious style violation.
I wonder how hard it would be for the bot to autofix stuff too? Perhaps it could serve a git remote and allow you to pull all the fixes in one go?