The tools you list have nothing to do with code reviews. They are there exactly to let the reviewers to focus on more useful subjects.
Code reviews are for important things which cannot be automated: using a design pattern when another one matches better, over-documenting clear code or under-documenting unclear one, not using language features which can make code shorter and more readable. All those things are “too smart” for a machine: a program, no matter how sophisticated is it, won't be able to tell whether your application of abstract factory pattern is a good idea in a given context or not. That's why code reviews are done by persons, often more experienced developers.
Subjects mentioned during code reviews are also often subjective. One developer will tell that this specific method should be split in two. Another equally experienced one will consider that the method is fine and does exactly one thing. One reviewer will find a goto
statement terrible; his colleague may find that in this particular case, goto
is fine and can't be removed without leading to less readable code.
Style tools, on the other hand, are the archetype of automation of purely objective, basic, even sometimes dumb rules. Line 273 is too long. You've forgotten a capital letter. And here, there is a space missing. And here, I've found two empty lines instead of one. Boooring.
Don't waste anyone's time for that during code reviews. If there is a style guide in your project, use style checker (like pep8
) but run it automatically through pre-commit hook. Space missing? No commit for you, sir. An empty line contains whitespace? Please remove it if you want your code in version control.
In fact:
Since the rules are objective and straightforward, there is nothing to discuss during a code review. There is whitespace in an empty line. So remove it. What would you like to tell about it during a code review?
Worse, it can lead to discussions which are all but constructive. For some, code reviews would become an opportunity to discuss the merits of their preferred style, because, frankly, everyone knows that two spaces are better than four, and now, the code review is focused on “Should we change our code style and rewrite our entire code base to use two spaces instead of four”. Avoid this at all costs.
The remaining—the stuff which is too complicated for a machine—is for code reviews, letting the reviewers to focus on things that actually matter.
Automated checking, would it be style checking, compiling, tests, static analysis or formal proof, should be, well, automated. Where should it be in continuous integration process is a different subject. Short and fast checks, such as style checking, can be put directly in a pre-commit hook to avoid any non-compliant code in the code base. Long checks, such as static analysis, will usually be done during the build.
Remember, if you have a subject which:
- Doesn't have a straight answer, the answer being based on personal experience and educated guesses,
- Results in non-binary "well, it can be A, but B can be accepted here, while C seems a bit problematic, but will be an excellent solution if this were that"-style answers,
- Cannot possibly be automated even with most sophisticated applications,
- Cannot easily be ported to another context,
- Is focused on code quality, readability, expressiveness and maintainability,
code reviews may be a good place for it. On the other hand, if the subject:
- Is purely objective and without ambiguity,
- Results in a binary answer, often based on a metric,
- Can be automated (sometimes requiring a lot of work and research),
- Applies to every situation in the same group,
- Is focused on code quality, readability, expressiveness and maintainability,
pre-commit hooks or the build are much better places than a code review.
Further reading: