Code indentation, line, and character encoding formats should be consistent

Code indentation, line, and character encoding formats should be consistent

Software AgilityCode Readability

This code insights detects when different code formatting styles are heterogeneous (CRLF, CR or LF for new line formatting, full spaces, tab spaces … for identations, UTF8, Windows-1252 … for character encoding). Depending on the number of different styles used within a given scanned source file, Highlight counts penalty points accordingly.

Why you should care

Considering if a coding style (e.g. double space or tab to indent a line) is better than another is an opinion and disputable. However, the formatting style should be consistent across a code base. It makes the source code much easier to read, thus more comfortable to work with.

References:
https://code.tutsplus.com/tutorials/top-15-best-practices-for-writing-super-readable-code–net-8118

CAST recommendations

Static code analysis tools can automate this code insight verification. Ideally, a unique code formatting style should be adopted technology wide, at least within a given application.

About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.

How it worksFeatures & Analytics