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

Avoid duplicate findings from multiple sarif files #927

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

drdavella
Copy link
Member

@drdavella drdavella commented Nov 21, 2024

Overview

Avoid duplicating preexisting findings when processing multiple (potentially duplicate) SARIF files for a given tool

Description

  • The basic solution is to use IndexedSet to enforce uniqueness when combining ResultSets
    • IndexedSet preserves ordering 👍
  • In order to make this possible, the Result type needs to be hashable. This required the following changes
    • Using frozen datatypes
    • Using frozen pydantic classes
    • Replacing all instances of list (not hashable) in these types with tuple (hashable)
  • The type changes introduce a few downstream breaking API changes, but they should be easy to absorb

@@ -11,6 +11,7 @@ readme = "README.md"
license = {file = "LICENSE"}
description = "A pluggable framework for building codemods in Python"
dependencies = [
"boltons~=21.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL! Will become my new favorite utility, I"m sure

@drdavella drdavella force-pushed the avoid-duplicate-findings branch from e0115e8 to a77025c Compare November 22, 2024 14:33
@drdavella drdavella enabled auto-merge November 22, 2024 14:34
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
22.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@drdavella drdavella added this pull request to the merge queue Nov 22, 2024
Merged via the queue into main with commit 7e5a741 Nov 22, 2024
12 of 13 checks passed
@drdavella drdavella deleted the avoid-duplicate-findings branch November 22, 2024 16:14
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.

3 participants