Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@myunisoft/httpie": "^5.0.0",
"@nodesecure/size-satisfies": "^1.1.0",
"@nodesecure/vis-network": "^1.4.0",
"@openally/config.eslint": "^1.1.0",
"@openally/config.eslint": "^1.3.0",
"@types/node": "^22.2.0",
"c8": "^10.1.2",
"cross-env": "^7.0.3",
Expand Down
16 changes: 6 additions & 10 deletions src/commands/scorecard.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,23 @@ export async function main(repo, opts) {
const vcs = opts.vcs.toLowerCase();
const result = typeof repo === "string" ? Ok([repo, vcs]) : getCurrentRepository(vcs);

let repository;
let platform;
try {
const [repo, vcs] = result.unwrap();
repository = repo;
platform = vcs.slice(-4) === ".com" ? vcs : `${vcs}.com`;
}
catch (error) {
console.log(white().bold(result.err));
if (result.err) {
console.log(white().bold(result.val));

process.exit();
}

const [repository, repoVcs] = result.unwrap();
const platform = repoVcs.slice(-4) === ".com" ? vcs : `${vcs}.com`;

let data;
try {
data = await scorecard.result(repository, {
resolveOnVersionControl: Boolean(process.env.GITHUB_TOKEN || opts.resolveOnVersionControl),
platform
});
}
catch (error) {
catch {
console.log(
kleur
.white()
Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import send from "@polka/send-type";
import * as config from "../config.js";
import { bodyParser } from "../bodyParser.js";

export async function get(req, res) {
export async function get(_req, res) {
const result = await config.get();

send(res, 200, result);
Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { logger } from "../logger.js";
// CONSTANTS
const kDefaultPayloadPath = path.join(process.cwd(), "nsecure-result.json");

export async function get(req, res) {
export async function get(_req, res) {
try {
const { current, lru } = await appCache.payloadsList();
logger.info(`[data|get](current: ${current})`);
Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getManifest, lazyFetchFlagFile, getFlags } from "@nodesecure/flags";
// CONSTANTS
const kNodeSecureFlags = getFlags();

export function getAll(req, res) {
export function getAll(_req, res) {
send(res, 200, getManifest());
}

Expand Down
2 changes: 1 addition & 1 deletion src/http-server/endpoints/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import send from "@polka/send-type";
import english from "../../../i18n/english.js";
import french from "../../../i18n/french.js";

export async function get(req, res) {
export async function get(_req, res) {
send(res, 200, { english: english.ui, french: french.ui });
}
2 changes: 1 addition & 1 deletion src/http-server/endpoints/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function buildHtml() {
return templateStr;
}

export async function get(req, res) {
export async function get(_req, res) {
try {
res.writeHead(200, {
"Content-Type": "text/html"
Expand Down
2 changes: 1 addition & 1 deletion src/http-server/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import sirv from "sirv";
import { context } from "./context.js";

export function buildContextMiddleware(dataFilePath) {
return function addContext(req, res, next) {
return function addContext(_req, _res, next) {
const store = { dataFilePath };
context.run(store, next);
};
Expand Down
4 changes: 2 additions & 2 deletions test/httpServer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe("httpServer", { concurrency: 1 }, () => {
const errors = [];
const module = await esmock("../src/http-server/endpoints/root.js", {
"@polka/send-type": {
default: (res, status, { error }) => errors.push(error)
default: (_res, _status, { error }) => errors.push(error)
}
});

Expand Down Expand Up @@ -124,7 +124,7 @@ describe("httpServer", { concurrency: 1 }, () => {
test("'/flags/description/:title' should fail", async() => {
const module = await esmock("../src/http-server/endpoints/flags.js", {
stream: {
pipeline: (stream, res, err) => err("fake error")
pipeline: (_stream, _res, err) => err("fake error")
},
fs: {
createReadStream: () => "foo"
Expand Down
2 changes: 1 addition & 1 deletion test/process/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as verify from "../../src/commands/verify.js";
import { prepareProcess } from "../helpers/cliCommandRunner.js";

function mockVerify(packageName) {
function mockVerify() {
return ({
files: {
list: ["index.js", "package.json"],
Expand Down
8 changes: 1 addition & 7 deletions workspaces/documentation-ui/example/master.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import * as documentationUI from "../index.js";

document.addEventListener("DOMContentLoaded", async() => {
const result = documentationUI.render(document.getElementById("main"), {
documentationUI.render(document.getElementById("main"), {
prefetch: true
});

// setTimeout(() => {
// result.header.setNewActiveView("warnings");

// result.navigation.warnings.setNewActiveMenu("unsafe-stmt");
// }, 3_000);
});
4 changes: 2 additions & 2 deletions workspaces/documentation-ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ const kWikiMenus = {
flags: {
name: "Flags",
data: Object.entries(getManifest()).map(([name, { title, emoji }]) => ({ name, title, icon: emoji })),
callback(name, menuElement) {
callback(_name, menuElement) {
fetchAndRenderByMenu(menuElement, "flags").catch(console.error);
}
},
warnings: {
name: "SAST Warnings",
data: kSASTWarnings,
callback(name, menuElement) {
callback(_name, menuElement) {
fetchAndRenderByMenu(menuElement, "warnings").catch(console.error);
}
}
Expand Down
Loading