We have an in-tree Clang plugin in build/clang-plugin that can be used to deploy more in-depth checking on top of the AST. You can have it emit compiler warnings or errors. It runs as part of automation, so if you write a checker, the tree will burn and bad commits will get backed out. A problem is it only runs on Clang. But something is better than nothing. There is lots of untapped potential in this plugin.

Bug 939350 tracks adding a `mach lint` command (really a generic linting facility). There is a patch in my review queue now. Over time, I see this evolving into something very useful. Read the comments in the bug.

My Mercurial extension at [1] automatically lints Python on commit/qref. It has drastically cut down on the amount of "nit:" comments in code reviews and thus makes the code review process more efficient and lets the reviewer focus more on what the code is actually doing rather than how it looks. As I like to say, "every time I type 'nit' in a code review, Mozilla is wasting money on my salary." Humans should not be performing work that machines can do faster and better.

The scientific community generally disagrees with your opinion that "checking formatting in general is a massive waste of time." Studies have shown that consistent code style helps with code readability and thus maintainability. There is a reason large or mature software projects often enforce consistent code styles. Keep in mind this consistency benefits newer contributors more than old due to the knowledge gap. I defer to mhoye to post links to relevant studies and papers.

I agree that the state of JS linting is sad.

[1] https://hg.mozilla.org/users/gszorc_mozilla.com/hgext-gecko-dev

On 12/19/13, 8:33 AM, Martin Thomson wrote:
If we are talking about checking (a separate thing, in my opinion), then we 
should be talking about linting :)  Checking for formatting is probably less 
useful than something more concrete.  Having run jshint over some of the code, 
I was horrified at the output it produced.

That said, checking formatting in general is a massive waste of time.  If we had an 
automated tool, then I could notice a problem, then say "did you run 
{clang-format,astyle,js-beautify}", but generally not worry about formatting.

----- Original Message -----
From: "Till Schneidereit" <t...@tillschneidereit.net>
To: "Ehsan Akhgari" <ehsan.akhg...@gmail.com>
Cc: "Mike Hommey" <m...@glandium.org>, dev-platform@lists.mozilla.org, "Andrea 
Marchesini" <amarches...@mozilla.com>
Sent: Thursday, December 19, 2013 8:11:39 AM
Subject: Re: style guide proposal

[...]

I think we should increase the checking we do, and make it a habit to run
the checks before try-servering or putting a patch up for review. It's
really not a good investment of anyone's time to have to deal with trailing
whitespace during a review.

[1]:
http://mxr.mozilla.org/mozilla-central/source/js/src/config/check_spidermonkey_style.py
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to