As a committer, I would rather have it clearly explained what the rules are before I do it incorrectly. Sure, having tools that will do it for me is awesome, but considering how many examples in the OP are different because of historical reasons, those tools are difficult to configure.
That's exactly what tools like clang-format fixes. Code will be in the repository using one correct styling. The difference is that the commiter won't have to style it himself.
> As a committer, I would rather have it clearly explained what the rules are before I do it incorrectly. Sure, having tools that will do it for me is awesome, but considering how many examples in the OP are different because of historical reasons, those tools are difficult to configure.
Which tools you said that are difficult to configure? clang-format? It's 5~20 lines in a .clang-format in the root folder of your repo. Configure it once and profit forever.
* I'm talking about clang-format here because that's what I use for C/C++. I don't know anything about other languages.
It's the same for any other mental load that could be offloaded to machine. Coding style? Don't demand people sticking to rules - use some formatter/prettyfier/linter. Well known and frequent bugs? At least try to use static analysis or write tests and run those with some sanitizer. Codebase too big/convoluted/... - use some tools (parsers, indexers, search) to get better insight. Just try use proper tools and machines.
If you want to enforce codding style (which is OK) you need to provide developers the tools to ease that process.
Contributing with patches to 15 different projects, using 15 different rules for styling makes it impossible to keep up.
FOSS projects should start using tools like clang-format so developers don't need care if a project use 2/4/6/8 spaces instead of tab. The tool should be able to automatically format the code before committing.
Some projects even use git hooks to compare the commit with auto-generated styling tools to check if it follows the rules.