1

I'm the co-founder (there's two of us) of a software development company, doing mostly webdevelopment. Recently we hired our first employee and soon enough we find ourselves in the need of a standard (and preferably enforced) coding style. We do however not enforce a certain IDE. I for example use Atom while the currently other 2 devs use PHPStorm.

Is there a way to enforce a certain coding style, much like you can set in Eclipse, across different editors/IDE's? I know of editorconfig, however that only fixes the indenting-type and end-of-line-characters. Not when to actually use indenting or new-lines. But an extended version of that seems perfect for what we want to achieve.

I haven't been able to find any such thing or any other straightforward way of handling this. How would you go about tackling this?

1 Answers1

3

You cannot have a single configuration format that any editor and IDE will understand. Therefore:

  • Define a basic coding convention in plain text. This can evolve over time, and doesn't have to be very detailed in the beginning. Two paragraphs about naming convention and bracing/indentation style is probably sufficient.

  • Everyone is responsible for configuring their own editor in accordance with the coding convention. The editor is an aid for the developer using that editor. Unless you standardize on a single editor/IDE, it is not a suitable platform for other processes.

  • Find a separate style checking and linting tool, and run it as part of your extended test suite. This could run after commit on a CI server, or as a Git pre-commit hook before the ill-formatted code can enter version control.

  • Note that coding conventions will often contain semantic rules that can't be checked by a tool. Human review is important as well. A pull-request based workflow can help that every code is reviewed before it becomes part of your product.

amon
  • 135,795