ansible / ansible-risk-insight

Ansible Risk Insight (ARI) is the tool to evaluate the quality and risk of the ansible content.
https://ansible.github.io/ansible-risk-insight/
Apache License 2.0
33 stars 17 forks source link

ARI --scan-per-target resulting into ARI suggestion for multiple targets under one parent target #249

Open justjais opened 2 months ago

justjais commented 2 months ago

ARI --scan-per-target resulting into ARI suggestion for multiple targets under one parent target

This issue results in discrepancy where parsing logic for --fix results in failure and starts resulting into unexpected result.

Screenshot 2024-06-24 at 11 50 46 AM

Steps to reproduce:

  1. Clone parent repo, where the issue is observed: https://github.com/craig-br/workshops
  2. Run the ARI scan as:
    ari project ansible-workshops --out-dir /tmp/AW --save-only-rule-result --scan-per-target --task-num-threshold 100
  3. Parse the output result for the taskfile under path: https://github.com/craig-br/workshops/tree/devel/roles/manage_ec2_instances/tasks/ami_find
justjais commented 2 months ago

As discussed with @hirokuni-kitahara for fixing the inline replace functionality, I'll include a fix under --fix implementation logic, to parse and mutate only for parent target file and skip ARI suggestions for files other than the parent target name.