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

fix: packages starting with go/golang are not being ignored #53

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/providers/golang_gomodules.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { execSync } from "node:child_process"
import fs from 'node:fs'
import os from "node:os";
import {EOL} from "os";

Check warning on line 5 in src/providers/golang_gomodules.js

View workflow job for this annotation

GitHub Actions / Lint and test project (18)

Imports should be sorted alphabetically

Check warning on line 5 in src/providers/golang_gomodules.js

View workflow job for this annotation

GitHub Actions / Lint and test project (latest)

Imports should be sorted alphabetically
import { getCustomPath } from "../tools.js";
import path from 'node:path'
import Sbom from '../sbom.js'

Check warning on line 8 in src/providers/golang_gomodules.js

View workflow job for this annotation

GitHub Actions / Lint and test project (18)

Imports should be sorted alphabetically

Check warning on line 8 in src/providers/golang_gomodules.js

View workflow job for this annotation

GitHub Actions / Lint and test project (latest)

Imports should be sorted alphabetically
import {PackageURL} from 'packageurl-js'

Check warning on line 9 in src/providers/golang_gomodules.js

View workflow job for this annotation

GitHub Actions / Lint and test project (18)

Imports should be sorted alphabetically

Check warning on line 9 in src/providers/golang_gomodules.js

View workflow job for this annotation

GitHub Actions / Lint and test project (latest)

Imports should be sorted alphabetically

export default { isSupported, provideComponent, provideStack }

Expand Down Expand Up @@ -116,8 +116,8 @@
if(line.match(".+//\\s*exhortignore") || line.match(".+//\\sindirect (//)?\\s*exhortignore"))
{
let trimmedRow = line.trim()
if(!trimmedRow.startsWith("module") && !trimmedRow.startsWith("go") && !trimmedRow.startsWith("require (") && !trimmedRow.startsWith("require(")
&& !trimmedRow.startsWith("exclude") && !trimmedRow.startsWith("replace") && !trimmedRow.startsWith("retract") && !trimmedRow.startsWith("use")
if(!trimmedRow.startsWith("module ") && !trimmedRow.startsWith("go ") && !trimmedRow.startsWith("require (") && !trimmedRow.startsWith("require(")
&& !trimmedRow.startsWith("exclude ") && !trimmedRow.startsWith("replace ") && !trimmedRow.startsWith("retract ") && !trimmedRow.startsWith("use ")
&& !trimmedRow.includes("=>"))
{
if( trimmedRow.startsWith("require ") || trimmedRow.match("^[a-z./-]+\\s[vV][0-9]\\.[0-9](\\.[0-9])?.*"))
Expand Down
3 changes: 2 additions & 1 deletion test/providers/golang_gomodules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ suite('testing the golang-go-modules data provider', () => {
[
"go_mod_light_no_ignore",
"go_mod_no_ignore",
"go_mod_with_ignore"
"go_mod_with_ignore",
"go_mod_test_ignore"
].forEach(testCase => {
let scenario = testCase.replace('go_mod_', '').replaceAll('_', ' ')
test(`verify go.mod sbom provided for stack analysis with scenario ${scenario}`, async () => {
Expand Down
Loading
Loading