Skip to content

Commit

Permalink
Merge pull request #39 from nachandr/no_insight_generation
Browse files Browse the repository at this point in the history
[RFR] Insight should not be generated with a rule with non-zero effort
  • Loading branch information
sshveta authored Sep 30, 2024
2 parents feb4f81 + c2a0503 commit a50ae61
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions data/yaml/custom_rule_insights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@
when:
builtin.file:
pattern: "^.*\\.properties$"
- ruleID: discover-properties-file-TC3
description: "Properties file (Insights TC3)"
labels:
- konveyor.io/target=discovery
tag: ["Properties File (Insights TC3)"]
message: Found properties file, Insight muts not be created
effort: 1
when:
builtin.file:
pattern: "^.*\\.properties$"
7 changes: 5 additions & 2 deletions tests/test_insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def test_insights_binary_app(analysis_data):
assert 'generating static report' in output
assert_insights_from_report_file()

# Polarion TC 3503, 3504, 3505, 3506
# Polarion TC 576, 577, 578, 589, 606
@pytest.mark.parametrize('analysis_mode', ["source-only", "full"])
def test_custom_rules(analysis_data, analysis_mode):
def test_insights_custom_rules_bug_mta_3352(analysis_data, analysis_mode):
application_data = analysis_data['tackle-testapp-project']
custom_rule_path = os.path.join(os.getenv(constants.PROJECT_PATH), 'data/yaml',
'custom_rule_insights.yaml')
Expand Down Expand Up @@ -58,3 +58,6 @@ def test_custom_rules(analysis_data, analysis_mode):
'Properties file (Insights TC1)', 'Properties file (Insights TC2)'):
# Assert insight occurrence is > 0 for each insight
assert len(insight['incidents']) > 0, "No insights were generated"
else:
assert insight['description'] != 'Properties file (Insights TC3)', \
"Insight incorrectly generated"

0 comments on commit a50ae61

Please sign in to comment.