ComplianceAsCode / content-test-filtering

System for Automatic Filtering of Tests for ComplianceAsCode project
8 stars 6 forks source link

Fix traceback when that was triggered when id is was empty. #32

Closed ggbecker closed 2 years ago

ggbecker commented 2 years ago

Fix:

DEBUG   OVALAnalysis           - network_ipv6_static_address rule affected by the change.
DEBUG   OVALAnalysis           - rule_dir rule affected by the change.
Traceback (most recent call last):
  File "/__w/content/content/./ctf/content_test_filtering.py", line 44, in <module>
    diff_structure = diff_analysis.analyse_file(file_record)
  File "/__w/content/content/ctf/ctf/diff_analysis.py", line 54, in analyse_file
    return file_analyzer.process_analysis()
  File "/__w/content/content/ctf/ctf/analysis/OVALAnalysis.py", line 244, in process_analysis
    self.analyse_oval()
  File "/__w/content/content/ctf/ctf/analysis/OVALAnalysis.py", line 217, in analyse_oval
    self.analyse_oval_change(change)
  File "/__w/content/content/ctf/ctf/analysis/OVALAnalysis.py", line 151, in analyse_oval_change
    self.update_attr_change(change)
  File "/__w/content/content/ctf/ctf/analysis/OVALAnalysis.py", line 131, in update_attr_change
    self.add_rule_test("Attribute value changed in OVAL check.")
  File "/__w/content/content/ctf/ctf/analysis/OVALAnalysis.py", line 73, in add_rule_test
    affected_rules = self.find_affected_rules()
  File "/__w/content/content/ctf/ctf/analysis/OVALAnalysis.py", line 65, in find_affected_rules
    rule_name = rule_match.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
Error: Process completed with exit code 1.

https://github.com/ComplianceAsCode/content/runs/7179163417?check_suite_focus=true

ggbecker commented 2 years ago

@mildas FYI