Why you should care
Having multiple lines as one line of code remarkably decreases readability of the code. This makes the source code tougher to understand, and execute, causing it to more error prone and susceptible to bugs in the near-future.Business Impacts
Combining multiple lines of code on one line is risky because it makes the code unreadable and less productive in the long run. [nz_btn text="Production Risk" target="_self" animate="false" animation_type="ghost" color="pink" size="small" shape="rounded" type="normal" hover_normal="opacity" hover_ghost="fill" link="http://casthighlight.wpengine.com/category/product/indicators-methodology/risk/" icon="icon-office"]CAST Recommendations
References
https://softwareengineering.stackexchange.com/questions/104066/single-line-statements-good-practices[nz_btn text="Style Guide" target="_self" animate="false" animation_type="ghost" color="turquoise" size="small" shape="rounded" type="ghost" hover_normal="fill" hover_ghost="fill" link="https://github.com/Kristories/awesome-guidelines" icon="icon-book"]How we detect
This code insight shows that the whitespace at the beginning of each line can’t be safely stripped at compile time; whitespace after the slash will result in tricky errors; and while most script engines support this, it is not part of ECMAScript. Use string concatenation instead.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.
For reference only. For the complete details please refer the original article
https://doc.casthighlight.com/alt_multilinestring-avoid-multiline-string-literals/
https://doc.casthighlight.com/alt_multilinestring-avoid-multiline-string-literals/
Comments