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

docs(cli): update help string for file and dir skipping #4872

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

wyardley
Copy link
Contributor

@wyardley wyardley commented Jul 27, 2023

Description

  • Update the contextual help messages
  • Add some additional examples (and clarify YAML file configuration) for globbing
  • Update docs
  • Fix broken link in skipping docs

Happy to adjust the wording or make other tweaks as necessary, but to me, this seems at least a little bit clearer

Related issues

Related PRs

Before:
image

After:
image

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@CLAassistant
Copy link

CLAassistant commented Jul 27, 2023

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@wyardley wyardley force-pushed the wyardley/docs/skipconf branch 2 times, most recently from 2b1ef41 to a13d18e Compare July 27, 2023 05:39
@@ -11,12 +11,19 @@ This section details ways to specify the files and directories that Trivy should
| License | ✓ |

By default, Trivy traverses directories and searches for all necessary files for scanning.
You can skip files that you don't maintain using the `--skip-files` flag.
You can skip files that you don't maintain using the `--skip-files` flag, or the equivalent YAML config option.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we say "or using the equivalent Trivy YAML configuration." instead?
To make it clear that we don't mean Kubernetes YAML or similar

@@ -34,12 +47,19 @@ Will skip any file named `bar` in the subdirectories of testdata.
| License | ✓ |

By default, Trivy traverses directories and searches for all necessary files for scanning.
You can skip directories that you don't maintain using the `--skip-dirs` flag.
You can skip directories that you don't maintain using the `--skip-dirs` flag, or the equivalent YAML config option.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: can we say "or using the equivalent Trivy YAML configuration." instead?


```
```bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a little subtitle *not bold or anything but just:

Using the --skip-dirs flag:

EXAMPLE

Using the Trivy YAML configuration:

EXAMPLE

@@ -48,12 +68,19 @@ $ trivy image --skip-dirs "./testdata/*" .

Will skip all subdirectories of the testdata directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This will skip.."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was following the existing examples, but yes, can definitely update

$ trivy config --skip-dirs "**/.terraform" .
```

Will skip subdirectories at any depth named `.terraform/`. (Note: this will match `./foo/.terraform` or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This will skip" ...

Copy link
Member

@AnaisUrlichs AnaisUrlichs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a few minor comments, thank you for the work

- Update the contextual help messages
- Add some additional examples (and clarify YAML file configuration) for
  globbing
- Update docs
- Fix broken link in skipping docs

See also aquasecurity#3754

Signed-off-by: William Yardley <wyardley@users.noreply.github.com>
@wyardley
Copy link
Contributor Author

Hi @AnaisUrlichs - does that look good now?

@@ -82,4 +113,4 @@ A file pattern contains the analyzer it is used for, and the pattern itself, joi
--file-patterns "dockerfile:.*.docker" --file-patterns "kubernetes:*.tpl" --file-patterns "pip:requirements-.*\.txt"
```

The prefixes are listed [here](https://github.com/aquasecurity/trivy/tree/{{ git.commit }}/pkg/fanal/analyzer/const.go)
The prefixes are listed [here](../../../pkg/fanal/analyzer/const.go)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be deployed via MkDocs, so it doesn't work. I've reverted.
https://aquasecurity.github.io/trivy/v0.44/docs/configuration/skipping/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue I was trying to fix is that the current docs have a broken link when viewed via https://github.com/aquasecurity/trivy/blob/main/docs/docs/configuration/skipping.md (which gets linked to from various places IIRC)

@knqyf263 knqyf263 added this pull request to the merge queue Aug 2, 2023
Merged via the queue into aquasecurity:main with commit 6d3ae3b Aug 2, 2023
17 checks passed
@wyardley wyardley deleted the wyardley/docs/skipconf branch August 2, 2023 14:43
AnaisUrlichs pushed a commit to AnaisUrlichs/trivy that referenced this pull request Aug 10, 2023
…#4872)

* docs(cli): update help string for file and dir skipping

- Update the contextual help messages
- Add some additional examples (and clarify YAML file configuration) for
  globbing
- Update docs
- Fix broken link in skipping docs

See also aquasecurity#3754

Signed-off-by: William Yardley <wyardley@users.noreply.github.com>

* docs: revert

---------

Signed-off-by: William Yardley <wyardley@users.noreply.github.com>
Co-authored-by: knqyf263 <knqyf263@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants