Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Show full path to file #410

Closed
nathanpeck opened this issue Sep 12, 2023 · 3 comments
Closed

[Enhancement] Show full path to file #410

nathanpeck opened this issue Sep 12, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@nathanpeck
Copy link

nathanpeck commented Sep 12, 2023

Is your feature request related to a problem? Please describe.

When I run cfn-guard against a directory path full of many files it is hard to tell which file is the source of an error.

For example:

cfn-guard validate --data ./pattern/**/files/*.yml --rules ./lint/guard

I am running the linter against all files with the .yml extension across a range of paths. There are multiple files with the same name in each subpath.

The output of the linter just shows:

cluster.yml Status = FAIL
FAILED rules
task-execution-role.guard/iam_policies_with_ecs_trust_policy_have_condition    FAIL

I know the error is in a file named cluster.yml, but which cluster.yml in which path?

Describe the solution you'd like

Compare to the output from cfn-lint:

E3001 Invalid or unsupported Type AWS::IAM::Rol for resource ECSTaskExecutionRole in us-east-1
./pattern/ecs-example-iam-roles/files/ecs-task-execution-role.yml:3:5

Because cfn-lint shows the full path to the file it is very easy for me to locate the file that needs a fix.

@nathanpeck nathanpeck added the enhancement New feature or request label Sep 12, 2023
@Nr18
Copy link

Nr18 commented Sep 13, 2023

When I started using cfn-guard a few years ago you could only feed it one file. Back then I created https://github.com/nr18/cfn-guard-test it tests a set of test files against a set of rules. Just like the cfn-guard tool does today. But back then I implemented the display of what rule got triggered for the error.

This way you could tell what caused the execution to fail.

Tltr; I think this is a good addition

@joshfried-aws
Copy link
Contributor

Hi @nathanpeck, thanks for the suggestion! This seems like a really convenient enhancement, we will track this and update the issue as we make progress.

@Nr18 thanks for sharing your tool, we love to see how users are building upon guard helping it to meet their specific needs.

dannyvassallo added a commit that referenced this issue Feb 13, 2024
* show full paths in output

* dont sanitize expected output because fixtures should not have paths

* use ? instead of unwrap
@dannyvassallo
Copy link
Contributor

Hello @nathanpeck & @Nr18,

This has been updated. Thank you for the suggestion!

Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants