We are wasting so much time on improving source code quality, doing things like force people to obey a strict paper with hundreds coding rules. We have to yell at programmer whom offend the rules and kick their ass to follow each rule, but they will forget more and more details after a few days. So, there only rules master could remember all details about those rules and commit without any coding style problems.
Day after day, programmers will get tired to follow the rules while there have much more important thing needs to do. The source code quality will get worse by worse, finally the source code become unreadable and the whole project go into the grave.
This situation must change! That's why I started to develop on this aspect.
How could we focus on the program logic but not cause the source code getting unreadable?
Actually there already have some utilities to help for do this job automatically:
Code Formatting
- uncrustify
- astyle
- clang-format
Static Code Analyser
- Artistic Style
- https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis
- https://www.owasp.org/index.php/Static_Code_Analysis
You could invoke them manually or write a script to execute them, but as you know huam is unreliable ...
So we need a point to insert our script for let the utilities to work automatically without human manually.
All programmer must commit source code to source code repository, so THAT IS THE POINT!
We construct a git hook script to do all the dirty jobs, so all works will be done while commit!
Certainly, another question comes : how we put the script into ".git/hooks" ??
We will invoke use_coding_styler() in CMakeLists.txt to ensure all things are ready.
Comments !