Implementation of Design Queries in Rego #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementation of Design Queries in Rego
Description
This pull request contains the implementation of some Design analysis into the new Rego engine. The overall structure is similar to the one previously developed here for security smells.
Implemented Queries
The following queries and errors were adapted based on the existing Python logic:
design_avoid_commentsdesign_imperative_abstractiondesign_long_resourcedesign_misplaced_attributedesign_multifaceted_abstractionimplementation_too_many_variablesMissing Queries
Currently, not all of the existing Design queries were converted due to the following reasons:
design_duplicate_block,implementation_improper_alignmentandimplementation_long_statement.implementation_unguarded_variableanddesign_unnecessary_abstraction.Testing
All tests related to these changes are passing and working as expected.
Notes
imperative_abstraction.pyshould not be necessary anymore since the query was converted to Rego. However, since there are not specific tests for this query, it was kept and a comment was added. A file similar to the IR was manually created and used during development for testing purposes.