Skip to content

Commit 806d212

Browse files
authored
Lint fixes (#1363)
* Lint fixes Signed-off-by: Prabhu Subramanian <[email protected]> * Lint fixes Signed-off-by: Prabhu Subramanian <[email protected]> * Added pixi repo tests Signed-off-by: Prabhu Subramanian <[email protected]> --------- Signed-off-by: Prabhu Subramanian <[email protected]>
1 parent 38cd3df commit 806d212

24 files changed

+88
-52
lines changed

.github/workflows/repotests.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,15 @@ jobs:
311311
run: |
312312
bin/cdxgen.js -t python repotests/impacket -o bomresults/impacket.json
313313
shell: bash
314+
- name: repotests pixi
315+
run: |
316+
mkdir pixi-sample
317+
cd pixi-sample
318+
curl -LO https://raw.githubusercontent.com/prefix-dev/pixi/main/pixi.lock
319+
curl -LO https://raw.githubusercontent.com/prefix-dev/pixi/main/pixi.toml
320+
cd ..
321+
bin/cdxgen.js -t python pixi-sample -o bomresults/bom-pixi.json -p
322+
shell: bash
314323
- name: repotests shiftleft-java-example
315324
run: |
316325
bin/cdxgen.js -p -r -t java repotests/shiftleft-java-example -o bomresults/bom-java.json --generate-key-and-sign
@@ -506,14 +515,6 @@ jobs:
506515
run: |
507516
ls -ltr bomresults
508517
shell: bash
509-
- name: buntests
510-
run: |
511-
rm -rf node_modules
512-
bun install
513-
bun --bun bin/cdxgen.js -p -t java repotests/java-sec-code -o bomresults/bom-java-sec-code-bun.json --deep
514-
bun --bun bin/cdxgen.js -p -t python repotests/django-DefectDojo -o bomresults/django-DefectDojo-bun.json
515-
continue-on-error: true
516-
shell: bash
517518
- name: denotests
518519
run: |
519520
rm -rf node_modules
@@ -524,6 +525,14 @@ jobs:
524525
env:
525526
FETCH_LICENSE: true
526527
shell: bash
528+
- name: buntests
529+
run: |
530+
rm -rf node_modules
531+
bun install
532+
bun --bun bin/cdxgen.js -p -t java repotests/java-sec-code -o bomresults/bom-java-sec-code-bun.json --deep
533+
bun --bun bin/cdxgen.js -p -t python repotests/django-DefectDojo -o bomresults/django-DefectDojo-bun.json
534+
continue-on-error: true
535+
shell: bash
527536
- uses: actions/upload-artifact@v4
528537
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest'
529538
with:

analyzer.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ const getAllFiles = (deep, dir, extn, files, result, regex) => {
7373
result,
7474
regex,
7575
);
76-
} catch (error) {}
76+
} catch (error) {
77+
// ignore
78+
}
7779
} else {
7880
if (regex.test(file)) {
7981
result.push(file);
@@ -197,16 +199,16 @@ const fileToParseableCode = (file) => {
197199
)
198200
.replace(
199201
vueBindRegex,
200-
(match, grA, grB, grC) =>
202+
(_match, grA, grB, grC) =>
201203
grA.replaceAll(/\S/g, " ") + grB + grC.replaceAll(/\S/g, " "),
202204
)
203205
.replace(
204206
vuePropRegex,
205-
(match, grA, grB) => ` ${grA.replace(/[.:@]/g, " ")}${grB}`,
207+
(_match, grA, grB) => ` ${grA.replace(/[.:@]/g, " ")}${grB}`,
206208
)
207209
.replace(
208210
vueTemplateRegex,
209-
(match, grA, grB, grC) =>
211+
(_match, grA, grB, grC) =>
210212
grA + grB.replaceAll("{{", "{ ").replaceAll("}}", " }") + grC,
211213
);
212214
}

biome.json

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,40 @@
55
},
66
"linter": {
77
"enabled": true,
8-
"ignore": ["types/**"],
8+
"ignore": ["types/**", "contrib/**"],
99
"rules": {
1010
"recommended": true,
1111
"complexity": {
1212
"noForEach": "off",
13-
"useLiteralKeys": "off"
13+
"useLiteralKeys": "off",
14+
"noUselessTernary": "warn"
15+
},
16+
"correctness": {
17+
"noUndeclaredVariables": "error",
18+
"noUnnecessaryContinue": "warn",
19+
"noConstAssign": "error",
20+
"noConstantCondition": "error",
21+
"noUnreachable": "info"
1422
},
1523
"performance": {
1624
"noDelete": "off"
1725
},
1826
"style": {
19-
"noParameterAssign": "off"
27+
"noParameterAssign": "off",
28+
"noShoutyConstants": "warn",
29+
"noUselessElse": "warn"
2030
},
2131
"suspicious": {
22-
"noAssignInExpressions": "off"
32+
"noAssignInExpressions": "off",
33+
"noDoubleEquals": "warn",
34+
"noAsyncPromiseExecutor": "warn",
35+
"noControlCharactersInRegex": "warn",
36+
"noDebugger": "error",
37+
"noEmptyBlockStatements": "warn"
38+
},
39+
"nursery": {
40+
"noUnusedFunctionParameters": "warn",
41+
"noDuplicateElseIf": "warn"
2342
}
2443
}
2544
},

docker.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,9 @@ export const extractTar = async (fullImageName, dir) => {
760760
strict: true,
761761
C: dir,
762762
portable: true,
763-
onwarn: () => {},
763+
onwarn: () => {
764+
// ignore
765+
},
764766
filter: (path, entry) => {
765767
// Some files are known to cause issues with extract
766768
if (
@@ -1078,7 +1080,9 @@ export const exportImage = async (fullImageName) => {
10781080
strict: true,
10791081
C: tempDir,
10801082
portable: true,
1081-
onwarn: () => {},
1083+
onwarn: () => {
1084+
// ignore
1085+
},
10821086
}),
10831087
);
10841088
} catch (err) {
@@ -1095,7 +1099,9 @@ export const exportImage = async (fullImageName) => {
10951099
strict: true,
10961100
C: tempDir,
10971101
portable: true,
1098-
onwarn: () => {},
1102+
onwarn: () => {
1103+
// ignore
1104+
},
10991105
}),
11001106
);
11011107
} catch (err) {

envcontext.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function getOriginUrl(dir) {
5757
*
5858
* @returns Output from git config or undefined
5959
*/
60-
export function getBranch(configKey, dir) {
60+
export function getBranch(_configKey, dir) {
6161
return execGitCommand(dir, ["rev-parse", "--abbrev-ref", "HEAD"]);
6262
}
6363

evinser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ export const detectServicesFromUDT = (
915915
}
916916
};
917917

918-
export const constructServiceName = (language, slice) => {
918+
export const constructServiceName = (_language, slice) => {
919919
let serviceName = "service";
920920
if (slice?.fullName) {
921921
serviceName = slice.fullName.split(":")[0].replace(/\./g, "-");
@@ -1149,7 +1149,7 @@ export const collectDataFlowFrames = async (
11491149
userDefinedTypesMap,
11501150
dataFlowSlice,
11511151
dbObjMap,
1152-
purlLocationMap,
1152+
_purlLocationMap,
11531153
purlImportsMap,
11541154
) => {
11551155
const nodes = dataFlowSlice?.graph?.nodes || [];
@@ -1268,7 +1268,7 @@ export const collectDataFlowFrames = async (
12681268
* @param {string} language Application language
12691269
* @param {Object} reachablesSlice Reachables slice object from atom
12701270
*/
1271-
export const collectReachableFrames = (language, reachablesSlice) => {
1271+
export const collectReachableFrames = (_language, reachablesSlice) => {
12721272
const reachableNodes = reachablesSlice?.reachables || [];
12731273
// purl key and an array of frames array
12741274
// CycloneDX 1.5 currently accepts only 1 frame as evidence

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import {
5555
executeParallelGradleProperties,
5656
extractJarArchive,
5757
frameworksList,
58+
generatePixiLockFile,
5859
getAllFiles,
5960
getCppModules,
6061
getGradleCommand,
@@ -4268,7 +4269,7 @@ export function createCloudBuildBom(path, options) {
42684269
* @param {string} path to the project
42694270
* @param {Object} options Parse options from the cli
42704271
*/
4271-
export function createOSBom(path, options) {
4272+
export function createOSBom(_path, options) {
42724273
console.warn(
42734274
"About to generate OBOM for the current OS installation. This will take several minutes ...",
42744275
);

postgen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function postProcess(bomNSData, options) {
3737
*
3838
* @returns {Object} Filtered BOM JSON
3939
*/
40-
export function applyMetadata(bomJson, options) {
40+
export function applyMetadata(bomJson, _options) {
4141
if (!bomJson?.components) {
4242
return bomJson;
4343
}
@@ -265,7 +265,7 @@ export function filterBom(bomJson, options) {
265265
/**
266266
* Clean up
267267
*/
268-
export function cleanupEnv(options) {
268+
export function cleanupEnv(_options) {
269269
if (process.env?.PIP_TARGET?.startsWith(tmpdir())) {
270270
rmSync(process.env.PIP_TARGET, { recursive: true, force: true });
271271
}

pregen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function prepareSdkmanBuild(projectType) {
5454
* @param {String} filePath Path
5555
* @param {Object} options CLI Options
5656
*/
57-
export function preparePythonEnv(filePath, options) {
57+
export function preparePythonEnv(_filePath, options) {
5858
if (hasAnyProjectType("python", options, false)) {
5959
if (arch() !== "x64") {
6060
console.log(

types/analyzer.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)