code quality4 June 2017 · Filed in Development
This week’s focus is on code quality. This is where the code that we create is clear and uniform for the purposes of making it easier to maintain.
The ability to maintain code is very important as there are always bugs, security updates, features or simply a better way to write the code. Addition of a company wide shared library for instance.
Code quality also effects the readability of code.
Most programming languages have ‘Style Guidelines’ that define the uniform aspect of the code.
If the code style is agreed upon (and often the coding communities for each language have an opinion on this),
then becoming familiar with the code goes hand in hand with the language it is written in.
This is simple things like how many spaces are in a tab or indent. Where the brackets go for IF statements, etc.
Tools have been created to make this job easier for programmers, called Linters.
In addition to linters which can spot simple errors too, there are code analysis tools also. These are tools that are more in line with unit testing and run the code to varying degrees, such as running a puppet manifest inside a docker container and testing the results. This can be found at puppetlabs_spec_helper.
These linters and tests can be automated of course. My favourite way is via pre commit Git Hook or a status check from Github to a jenkins job. This job the runs the linter and reports back the good or bad status.
Let me know how you get on with lint and checks.Click now to find out how you can boost your I.T career. Tags: code quality · lint · linter Previous Post: email and alerts Next Post: puppet camp london june 2017