I'm heading a new team of developers working on a software project that makes use of continuous integration (circleci) w/ a pretty fleshed out suite of busterjs unit/integration/acceptance tests. Our project is primarily written w/ coffeescript, and I try to make use of coffeescript-linter to ensure everyone working our code base keeps code consistent and as organized as possible.

My question is, does anyone have any thoughts on when/if/how to enforce linting? Should I integrate linting into my tests that are executed by circleci before deployment?

Another thought I had was writing a simple shell script that combines git-push and the linting utility into one step and then including it in the project & having everyone use it.

I'm pretty new to managing teams of programmers so anyone else's feedback is much appreciated.

EDIT: In the last 3 seconds it just occurred to me that git-hooks is probably perfect for this. Specifically a git-hook on commit.

  • 1
    When to enforce? Immediately. But I'm not sure you need automated enforcement; code style doesn't affect functionality. Just carry around a big stick, and whack the ones who refuse to comply. – Robert Harvey Apr 2 '13 at 17:47
  • Yeah I'm debating doing it at all. Don't want to burden my team with trivial requirements & let them focus on more important things like functionality and deadlines. That being said consistency sometimes aids in maintainability & readability between programmers – Casey Flynn Apr 2 '13 at 17:49

When you a) have a coding standard and b) have configured the linter to be consistent with the coding standard, that's when you start enforcing linting.

Put the linter on the CI server.

  • I'd even suggest having a successful lint run as a part of the checkin trigger maybe. Allow for a mechanism for explicitly declaring exceptions though. – Rob Wells Aug 27 '13 at 9:52

The question is, how important is it to you that issues found by coffeescript-linter are addressed immediately.

If it is unacceptable to have code in the repository that gets flagged by the linter, then you should have the linter run as a commit hook so it can block the commit if there are issues.

If it is undesirable but not unacceptable, then I would run the linter as part of the test suite (and it it complains, regard that as a test failure)

If it is not practical to run the linter as a test case, then I would run it on the CI server on a separate schedule (for example, once a day or once a week) and encourage developers to use the linter when they have a particularly large commit.

  • Totally agree with the first three paragraphs. Not sure about the last one though @Bart. I've seen a lot of technical debt pile up in projects where successful lint runs where required... eventually. Unless a cleanup is regularly enforced, you finish up with a massive stack of "to do's" that people are afraid to touch because their system is currently working "as is". (-: – Rob Wells Aug 27 '13 at 9:56
  • @RobWells: Of course it is best to integrate the lint with the build, but sometimes it is just not practical. What if every commit kicks of a build, but the build server builds up a backlog due to the duration of build+lint? – Bart van Ingen Schenau Aug 27 '13 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.