Skip to content

Commit

Permalink
Use suppression_reason instead of suppressed (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylewillmon authored Oct 7, 2024
1 parent 529610b commit 90c171f
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Changed

- Use `suppression_reason` instead of deprecated `suppressed` field

## 7.1.0 - 2024-09-24

### Added
Expand Down
2 changes: 1 addition & 1 deletion cli/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ mod tests {
description: None,
reason: None,
},
suppressed: false,
suppression_reason: None,
}],
}],
job_link: Some("job_link".into()),
Expand Down
12 changes: 6 additions & 6 deletions cli/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ impl Format for PolicyEvaluationResponseRaw {
}

// Write summary for each issue.
for package in self
.dependencies
.iter()
.filter(|package| package.rejections.iter().any(|rejection| !rejection.suppressed))
{
for package in self.dependencies.iter().filter(|package| {
package.rejections.iter().any(|rejection| rejection.suppression_reason.is_none())
}) {
let _ = writeln!(writer, "[{}] {}@{}", package.registry, package.name, package.version);

for rejection in package.rejections.iter().filter(|rejection| !rejection.suppressed) {
for rejection in
package.rejections.iter().filter(|rejection| rejection.suppression_reason.is_none())
{
let domain = rejection
.source
.domain
Expand Down
2 changes: 1 addition & 1 deletion cli/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub struct EvaluatedDependency {
pub struct PolicyRejection {
pub title: String,
pub source: RejectionSource,
pub suppressed: bool,
pub suppression_reason: Option<String>,
}

/// Policy rejection source.
Expand Down
2 changes: 1 addition & 1 deletion extensions/bundle/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function logPackageAnalysisResults(result: PolicyEvaluationResponseRaw) {

for (const rejection of pkg.rejections) {
// Skip suppressed issues.
if (rejection.suppressed) {
if (rejection.suppression_reason !== null) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/cargo/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function logPackageAnalysisResults(result: PolicyEvaluationResponseRaw) {

for (const rejection of pkg.rejections) {
// Skip suppressed issues.
if (rejection.suppressed) {
if (rejection.suppression_reason !== null) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/npm/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ function logPackageAnalysisResults(result: PolicyEvaluationResponseRaw) {

for (const rejection of pkg.rejections) {
// Skip suppressed issues.
if (rejection.suppressed) {
if (rejection.suppression_reason !== null) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/phylum.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type EvaluatedDependencies = {

type PolicyRejection = {
title: string;
suppressed: boolean;
suppression_reason: string | null;
source: RejectionSource;
};

Expand Down Expand Up @@ -207,7 +207,7 @@ declare namespace Phylum {
* version: "0.2.1",
* rejections: [
* title: "Commercial license risk detected in [email protected]",
* suppressed: false,
* suppression_reason: null,
* source: {
* type: "Issue",
* tag: "HL0030",
Expand Down
2 changes: 1 addition & 1 deletion extensions/pip/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function logPackageAnalysisResults(result: PolicyEvaluationResponseRaw) {

for (const rejection of pkg.rejections) {
// Skip suppressed issues.
if (rejection.suppressed) {
if (rejection.suppression_reason !== null) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/poetry/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function logPackageAnalysisResults(result: PolicyEvaluationResponseRaw) {

for (const rejection of pkg.rejections) {
// Skip suppressed issues.
if (rejection.suppressed) {
if (rejection.suppression_reason !== null) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/yarn/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function logPackageAnalysisResults(result: PolicyEvaluationResponseRaw) {

for (const rejection of pkg.rejections) {
// Skip suppressed issues.
if (rejection.suppressed) {
if (rejection.suppression_reason !== null) {
continue;
}

Expand Down

0 comments on commit 90c171f

Please sign in to comment.