Why you should care
Using the simplified, but deprecated/discouraged commands in shell scripts can lead to minor unpredictability and less feature flexibility. It is better practice to stick to the established alternatives to these two commands, for readability, consistency and expansion.Why you should care
Using certain syntax in shell, like these simplified commands can have issues with behavioral consistency and flexibility. Avoiding modern syntax can potentially lead to unexpected application behavior and increased development time debugging. [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/innovation/" icon="icon-office"]CAST Recommendations
Encouraging developers to read up on the latest syntax/suggested style for shell – in order to reduce their use of outdated/partially deprecated commands, even if their use might simplify the appearance of the code.References
https://stackoverflow.com/questions/669452/is-double-square-brackets-preferable-over-single-square-brackets-in-ba https://stackoverflow.com/questions/22709371/backticks-vs-braces-in-bash[nz_btn text="Style Guide" link="https://github.com/Kristories/awesome-guidelines" target="_self" icon="icon-book" animate="false" animation_type="ghost" color="turquoise" size="small" shape="rounded" type="ghost" hover_normal="fill" hover_ghost="fill"]How we detect
This code insight counts one violation each time following pattern for command execution and conditions are encountered :- ` <command> `
- [ <condition> ]
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_intrinsics-avoid-simplified-syntax/
https://doc.casthighlight.com/alt_intrinsics-avoid-simplified-syntax/
Comments