Why you should care
Artifacts with a SELECT clause tend to be complex in nature as SELECT clauses with many clauses are difficult to read and does not help the reader in identifying the columns that can be retrieved. Also a query that retrieves many columns can potentially cause performance problems as such performance problems may arise when the query is executed.
It is recommended to avoid complex artifacts in the code as their complex nature can result in loss of time and slow down the innovative capabilities of the code.
These factors can make the code unsuitable for clients.
Instead of using SELECT, every column to be used in the query, should be explicitly listed while using a table alias.
For Example –
SELECT column1, column2, column3. FROM TABLE
SELECT * FROM TABLE
How we detect
This code insight focuses on how functions, procedure and triggers should not have a too high cyclomatic complexity
How we detect
Ineffective Interprocess Communications: Utilizing SELECT * in SQL can create technical issues during the cloud migration process as the database application could constrained by physical machines which might using other services. It can also disrupt the application when accessing it from the cloud.
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.