Skip to content

Commit

Permalink
Add docs for utils/find_unused_rules.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Mab879 committed Jul 1, 2024
1 parent 44b81bb commit 4f94a57
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/manual/developer/05_tools_and_utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -743,3 +743,24 @@ An example of how to execute the script to generate roles locally:
$ ./build_product rhel9
$ ./utils/ansible_playbook_to_role.py --dry-run output
```
### `utils/find_unused_rules.py` – List Rules That Are Not Used In Any Datastream
This script will output rules are not in any datastreams.
To prevent false positives the script will not run if the number of build datastreams less than the total number of products in the project.
The script assumes that `./build_project --derivatives` will be ran before the script is used.
This script does require that `./utils/rule_dir_json.py` be run before this script is used as well.
This script works by comparing rules in the datastreams to the rules in the `rule_dirs.json` file.
The script works by adding off the rule ids from the data streams to a `set`.
Then the script converts the keys of `rule_dirs.json` to a set.
The set of rules in the data stream is subtraced to from the set of rules in `rule_dirs.json`.
The differnce is then output to the user.
Example useage:
```bash
$ ./build_project --derivatives
$ ./utils/rule_dir_json.py
$ ./utils/find_unused_rules.py
```

0 comments on commit 4f94a57

Please sign in to comment.