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

Β·

[vc_row][vc_column width=”1/1″ animate=”false” effect=”fade” margin_b=”true” text_align=”left” pl=”40″ pr=”40″ pt=”0″ pb=”0″][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

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

[/vc_column_text][nz_btn text=”Software Agility” link=”http://casthighlight.wpengine.com/category/product/indicators-methodology/code-insights/software-agility/” target=”_self” animate=”false” animation_type=”ghost” color=”pink” size=”small” shape=”rounded” type=”normal” hover_normal=”fill” hover_ghost=”fill”][nz_btn text=”Code Readability” link=”http://casthighlight.wpengine.com/category/product/indicators-methodology/code-insights/software-agility/code-readability/” target=”_self” animate=”false” animation_type=”ghost” color=”black” size=”small” shape=”rounded” type=”ghost” hover_normal=”fill” hover_ghost=”fill”][vc_empty_space height=”32px”][vc_separator color=”grey” align=”align_center”][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

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.

[/vc_column_text][vc_separator color=”grey” align=”align_center”][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

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 [/vc_column_text][vc_separator color=”grey” align=”align_center”][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

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.[/vc_column_text][vc_separator color=”grey” align=”align_center” style=”” border_width=”” el_width=””][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

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.[/vc_column_text][nz_btn text=”How it works” link=”http://casthighlight.wpengine.com/how-it-works/” target=”_self” animate=”true” animation_type=”ghost” color=”black” size=”small” shape=”rounded” type=”normal” hover_normal=”fill” hover_ghost=”fill” icon=”icon-cog”][nz_btn text=”Features & Analytics” link=”http://casthighlight.wpengine.com/outputs-analytics/” target=”_self” animate=”true” animation_type=”ghost” color=”pink” size=”small” shape=”rounded” type=”ghost” hover_normal=”fill” hover_ghost=”fill” icon=”icon-stats”][/vc_column][/vc_row]


Leave a Reply

Your email address will not be published. Required fields are marked *