Skip to content

Commit

Permalink
Revert ":art: resolve remaining repo code scanning warnings (#1113)"
Browse files Browse the repository at this point in the history
This reverts commit 6a0091d.
  • Loading branch information
ff137 authored Oct 10, 2024
1 parent 6a0091d commit 39c7b98
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion scripts/k6/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function setup() {
}
}

return bearerToken, issuers;
return { bearerToken, issuers };

Check warning

Code scanning / Pmd (reported by Codacy)

Unnecessary block. Warning

Unnecessary block.
}

// Helper function to calculate the wallet index based on VU and iteration
Expand Down
2 changes: 1 addition & 1 deletion scripts/k6/scenarios/create-invitations.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function setup() {
console.error("Failed to bootstrap issuers.");
}

return bearerToken, issuers, holders;
return { bearerToken, issuers, holders };

Check warning

Code scanning / Pmd (reported by Codacy)

Unnecessary block. Warning

Unnecessary block.
}

function getIssuerIndex(vu, iter) {
Expand Down
6 changes: 3 additions & 3 deletions scripts/k6/scenarios/create-issuers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const options = {
scenarios: {
default: {
executor: "per-vu-iterations",
vus,
iterations,
vus: vus,
iterations: iterations,
maxDuration: "24h",
},
},
Expand Down Expand Up @@ -66,7 +66,7 @@ const wallets = new SharedArray("wallets", () => {
export function setup() {
const bearerToken = getBearerToken();
file.writeString(outputFilepath, "");
return bearerToken;
return { bearerToken };

Check warning

Code scanning / Pmd (reported by Codacy)

Unnecessary block. Warning

Unnecessary block.
}

const iterationsPerVU = options.scenarios.default.iterations;
Expand Down
31 changes: 14 additions & 17 deletions scripts/k6/scenarios/create-schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const schemas = new SharedArray("schemas", () => {
export function setup() {
file.writeString(outputFilepath, "");
const governanceBearerToken = getGovernanceBearerToken();
return governanceBearerToken; // eslint-disable-line no-eval
return { governanceBearerToken }; // eslint-disable-line no-eval

Check warning

Code scanning / Pmd (reported by Codacy)

Unnecessary block. Warning

Unnecessary block.
}

const iterationsPerVU = options.scenarios.default.iterations;
Expand Down Expand Up @@ -95,23 +95,20 @@ export default function (data) {
schema.schemaName,
schema.schemaVersion
);

function isSchemaValid(response) {
if (response.status !== 200 || response.body === "[]") {
return false;
}

try {
const schemaData = JSON.parse(response.body);
return schemaData.length > 0 && schemaData[0].id != null;
} catch (e) {
console.error("Failed to parse schema data:", e);
return false;
}
}

check(getSchemaResponse, {
"getSchema check passes": (r) => isSchemaValid(r),
"getSchema check passes": (r) => {
if (r.status !== 200 || r.body === "[]") {
return false;
}

try {
const schemaData = JSON.parse(r.body);
return schemaData.length > 0 && schemaData[0].id != null;
} catch (e) {
console.error("Failed to parse schema data:", e);
return false;
}
},
});

const { id: schemaId } = JSON.parse(getSchemaResponse.body)[0];
Expand Down
2 changes: 1 addition & 1 deletion scripts/k6/scenarios/delete-holders.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const filepath = "output/create-holders.json";

export function setup() {
const bearerToken = getBearerToken();
return bearerToken;
return { bearerToken };

Check warning

Code scanning / Pmd (reported by Codacy)

Unnecessary block. Warning

Unnecessary block.
}

const iterationsPerVU = options.scenarios.default.iterations;
Expand Down

0 comments on commit 39c7b98

Please sign in to comment.