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

Support Suppressions for file types without comments #594

Open
gfs opened this issue Dec 4, 2023 · 1 comment
Open

Support Suppressions for file types without comments #594

gfs opened this issue Dec 4, 2023 · 1 comment

Comments

@gfs
Copy link
Contributor

gfs commented Dec 4, 2023

Is your feature request related to a problem? Please describe.
Some file types (in particular JSON) do not support comments and so it is not feasible to include suppressions directly in the files.

Describe the solution you'd like
A mechanism to specify suppressions for those files using an additional file. This can either be a new suppressions file either globally for the project or for each file or additional options either via options-json or via a second suppressions-json argument.

Additional Context
One possible implementation is with a json ignore format like this, which could either be added to options-json or as a separate suppressions-json argument.

{
    "ignore": [
        {
            "path": "relative/path/to/file.json",
            "issue_id": ["DS173237"],
            "description": "This ignores all the issues DS173237 in the file relative/path/to/file.json"
        },
        {
            "path": "relative/path/to/some/other/file.cc",
            "line": 10,
            "issue_id": ["DS173237"],
            "description": "This ignores all the issues DS173237 in the file relative/path/to/some/other/file.cc at line 10"
        },
        {
            "path": "relative/path/dir",
            "issue_id": ["DS173237"],
            "description": "This ignores all the issues DS173237 in the directory relative/path/dir"
        }
    ]
}

Additional considerations
When running the suppress command it would be nice (but is not essential for this) to be able to either generate the new entries to be added to this config file or to directly update it. To detect if issues are already suppressed, the suppression file should also be an argument to the suppress command.

Primary implementation would be in the CLI, but ideally can add an option for the IDE to specify a suppressions file. If the IDE is configured to use a suppressions file, perhaps new suppressions should be written into it, or have an option to put new suppressions into it.

@gfs gfs added the enhancement label Dec 4, 2023
@gfs
Copy link
Contributor Author

gfs commented Dec 4, 2023

Suggestion Received from Denis: Support placing a suppressions file with a known name - for example .devskim.suppressions.json in the top level of a repo to be automatically picked up if running DevSkim from a pipeline across multiple repos where it would be preferable not to modify the devskim command itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant