ComplianceAsCode / content-test-filtering

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

Fix wrong recognizing built and raw files #26

Closed mildas closed 2 years ago

mildas commented 2 years ago

Bash, Ansible, and OVAL analysis can be started either by changing "raw" file (mostly those files are in linux_os/ directory with shared.(xml|yml|sh) filename) or by changing Jinja macro which invokes build and then built file analysis (files in build/ directory).

Analysis needs to get a rule name. In the "raw" file change case, it is name of folder. In the second case, it is name of a script (e.g. build/rhel8/fixes/bash/zipl_vsyscall_argument.sh).

The problem was that recognizing was done based on shared filename. But this doesn't work when the filename is e.g. ubuntu. So this PR changes the recognition to a folder name - if a file is in fixes (or checks in OVAL analysis) folder, then we are analyzing built file, otherwise "raw" file is being analyzed.

Fixes #24