Skip to content

Commit

Permalink
#1966 - Fix sonarcloud critical and major issues (part 1) (#1969)
Browse files Browse the repository at this point in the history
* #1966 - Fix sonarcloud critical issues (part 1)

* Updated code with review comments
  • Loading branch information
sh16011993 authored May 29, 2023
1 parent e827b1c commit 7c0bca4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export class BCeIDService {
);

try {
var client = await createClientAsync(this.bceidConfig.wsdlEndpoint, {
const client = await createClientAsync(this.bceidConfig.wsdlEndpoint, {
wsdl_headers: wsdlAuthHeader,
});
client.setSecurity(clientSecurity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export abstract class SFTPIntegrationBase<DownloadType> {

return filesToProcess
.map((file) => path.join(remoteDownloadFolder, file.name))
.sort();
.sort((a, b) => a.localeCompare(b));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ searchExceptions(dynamicData);
var applicationExceptionsPayload = applicationExceptions.map(arrayToPayload);
execution.setVariable(
"applicationExceptions",
JSON.stringify(applicationExceptionsPayload)
JSON.stringify(applicationExceptionsPayload),
);
// Set hasApplicationExceptions for easy verification on the workflow decisions.
execution.setVariable(
"hasApplicationExceptions",
applicationExceptions.length > 0
applicationExceptions.length > 0,
);
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function setValuesFromPayload(payload, fieldName, fieldsNamesPath) {
} else if (payload === null) {
// If parent does not exists just set null to the variable.
fieldsNamesPath = fieldsNamesPath.concat(
fieldName.split(INPUT_HIERARCHY_SEPARATOR)
fieldName.split(INPUT_HIERARCHY_SEPARATOR),
);
setVariableWithFullName(fieldsNamesPath, null);
} else {
Expand Down
10 changes: 5 additions & 5 deletions testing/src/uploadResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const TQ_USERNAME = process.env.TQ_USER_NAME;
const TQ_PASSWORD = process.env.TQ_PASSWORD;
const TQ_SECRET = process.env.TQ_SECRET;
const TQ_RUN_ID = process.env.TQ_RUN_ID; //( default id is 26606. Will need to change once we have integrated TQ account for the team)
const TQ_API_URL = 'https://api.testquality.com/api'
const TQ_API_URL = "https://api.testquality.com/api";

async function getAuthToken (): Promise<AxiosResponse<String>> {
async function getAuthToken(): Promise<AxiosResponse<String>> {
const auth_url = `${TQ_API_URL}/oauth/access_token`;
const body = {
grant_type: "password",
Expand All @@ -31,13 +31,13 @@ async function getAuthToken (): Promise<AxiosResponse<String>> {
console.error(error);
throw error;
}
};
}

async function uploadResultFile() {
const auth = await getAuthToken();
const url = `${TQ_API_URL}/plan/${TQ_RUN_ID}/junit_xml`;
var formData = new FormData();
var resultFile = fs.createReadStream("test-results.xml");
const formData = new FormData();
const resultFile = fs.createReadStream("test-results.xml");
formData.append("file", resultFile, "test-results.xml");
try {
const settings = {
Expand Down

0 comments on commit 7c0bca4

Please sign in to comment.