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

Add additional Analyzer flag for exclusion patterns #243

Open
kevinconaway opened this issue Mar 4, 2024 · 4 comments
Open

Add additional Analyzer flag for exclusion patterns #243

kevinconaway opened this issue Mar 4, 2024 · 4 comments

Comments

@kevinconaway
Copy link

@kisielk we currently use errcheck as an Analyzer as part of the nogo bazel build rule.

As of now, the only way to pass in a list of pattern exclusions is in a file via the exclude flag. Unfortunately, hard coded paths like are very difficult to use with nogo+bazel.

We'd like to see if an additional option could be added to pass the exclude patterns as a list directly in an argument, like -excludepatterns fmt.Printf,fmt.Println

This seems similar to the now deprecated -ignore value but I believe that used regular expressions for the values instead of straight patterns.

I see there was some discussion in the original issue that spawned the exclude functionality about doing this directly on the command line but I'd like to revisit this if we can.

If you agree on the approach I am happy to do the work

@kisielk
Copy link
Owner

kisielk commented Mar 4, 2024

That seems like it could work but I didn't do it that way originally because of concerns around limits of command line length. How about the alternative of using a temporary file?

@kevinconaway
Copy link
Author

How about the alternative of using a temporary file?

Would you help me understand how a temporary file would work whereas a regular file does not? The issue here is mostly bazel in that it really does not like dealing with full paths so I'm not sure how we would get the path of the temporary file to pass to the analyzer

@kisielk
Copy link
Owner

kisielk commented Mar 4, 2024

I see, I'm not familiar with bazel so I thought the issue of "hardcoded paths" was just not being able to reference particular files, but that something like temporaries could be generated during the build process. If the maximum command line length limitation is not going to be an issue I don't have a problem with adding an option to pass excludes as a flag of comma-separated entries.

@dtcaciuc
Copy link
Collaborator

bazel in that it really does not like dealing with full paths

Could you clarify what "full" path means here? Is the difficulty here not knowing where "cd" is when bazel runs the analyzer? Surely you can reference a relative path to the exclusion file in analyzer_flags?

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

No branches or pull requests

3 participants