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

Optional chain useless var assignment #1181

Merged

Conversation

rajesh-shres
Copy link
Contributor

Optional chain useless var assignment completed from sonar cloud scan so far

@rajesh-shres rajesh-shres reopened this Jan 10, 2024
@cd-rite cd-rite self-requested a review January 10, 2024 23:51
@@ -1161,7 +1161,7 @@ exports.getCcisByRevision = async function(benchmarkId, revisionStr, userObject)
if (revisionStr != 'latest') {
joins = ['revision r']

let [results, version, release] = /V(\d+)R(\d+(\.\d+)?)/.exec(revisionStr)
let [version, release] = /V(\d+)R(\d+(\.\d+)?)/.exec(revisionStr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regex returns what it captures positionally, so we need "results" here, even though it is not used.

// Handle the error
console.error('Error during server startup:', error);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

startServer is called within a try/catch block, so we don't need to do it here.

@@ -148,7 +148,7 @@ exports.queryGroups = async function ( inProjection, inPredicates ) {

if (inPredicates.revisionStr != 'latest') {
joins = ['revision r']
let [results, version, release] = /V(\d+)R(\d+(\.\d+)?)/.exec(inPredicates.revisionStr)
let [version, release] = /V(\d+)R(\d+(\.\d+)?)/.exec(inPredicates.revisionStr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regex returns what it captures positionally, so we need "results" here, even though it is not used.

@@ -232,7 +232,7 @@ exports.queryBenchmarkRules = async function ( benchmarkId, revisionStr, inProje

if (revisionStr != 'latest') {
joins = ['revision rev']
let [input, version, release] = /V(\d+)R(\d+(\.\d+)?)/.exec(revisionStr)
let [version, release] = /V(\d+)R(\d+(\.\d+)?)/.exec(revisionStr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regex returns what it captures positionally, so we need "input" here, even though it is not used.

@@ -907,7 +907,7 @@ exports.deleteRevisionByString = async function(benchmarkId, revisionStr, svcSta

let connection;
try {
let [input, version, release] = /V(\d+)R(\d+(\.\d+)?)/.exec(revisionStr)
let [version, release] = /V(\d+)R(\d+(\.\d+)?)/.exec(revisionStr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regex returns what it captures positionally, so we need "input" here, even though it is not used.

@@ -971,7 +971,9 @@ exports.cklbFromAssetStigs = async function cklbFromAssetStigs (assetId, stigs)
cklb.target_data.target_type = resultGetAsset[0].noncomputing ? 'Non-Computing' : 'Computing'
cklb.target_data.role = resultGetAsset[0].metadata.cklRole ?? 'None'
cklb.target_data.technology_area = resultGetAsset[0].metadata.cklTechArea ?? ''
cklb.target_data.is_web_database = resultGetAsset[0].metadata.cklHostName ? true : false
//cklb.target_data.is_web_database = resultGetAsset[0].metadata.cklHostName ? true : false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good change, but remove commented code

@@ -1658,6 +1659,8 @@ async function queryUnreviewedByCollection ({
predicates.statements.push('rgr.severity IN ?')
predicates.binds.push([severities])
}

//const sql = dbUtils.makeQueryString({columns, joins, predicates, groupBy, orderBy}) // conflict possbility with groupBy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment


let [rows, fields] = await dbUtils.pool.query(

//let [rows, fields] = await dbUtils.pool.query(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

// const statusStats = await dbUtils.updateStatsAssetStig( connection, {} )
// hrend = process.hrtime(hrstart)
// stats.stats = `${statusStats.affectedRows} in ${hrend[0]}s ${hrend[1] / 1000000}ms`

// // Commit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove other commented out code

@@ -493,7 +493,8 @@ from
await connection.query(sqlTempTable)

let validationErrors = []
let [table] = await connection.query('select * from validated_reviews')
// let [table] = await connection.query('select * from validated_reviews')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented out code

@cd-rite cd-rite merged commit 30a35ac into NUWCDIVNPT:main Jan 16, 2024
6 of 7 checks passed
csmig added a commit to csmig/stig-manager that referenced this pull request Jan 25, 2024
commit 9072578
Author: csmig <33138761+csmig@users.noreply.github.com>
Date:   Wed Jan 24 21:55:41 2024 +0000

    chore: remove duplicate ext-base-debug.js (NUWCDIVNPT#1201)

    Co-authored-by: csmig <csmig@csmig.com>

commit d74e934
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Wed Jan 24 16:54:33 2024 -0500

    added .zip of STIGs required for sample data; Added a couple Pinned Revisions to sample data Collections; updated README (NUWCDIVNPT#1199)

commit d9130ad
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Wed Jan 24 16:46:07 2024 -0500

    Updates docs to better describe building the client, testing, and related repos. Added readme to client folder. (NUWCDIVNPT#1200)

commit d8c5f6e
Author: csmig <33138761+csmig@users.noreply.github.com>
Date:   Wed Jan 24 03:28:49 2024 +0000

    feat: meta dashboard (NUWCDIVNPT#1193)

    * feat: meta dashboard

    * fix OAS regression using wrong schema

    ---------

    Co-authored-by: csmig <csmig@csmig.com>

commit 30a35ac
Author: rajesh-shres <137445547+rajesh-shres@users.noreply.github.com>
Date:   Tue Jan 16 14:16:38 2024 -0800

    Optional chain useless var assignment (NUWCDIVNPT#1181)

    * use optional chain expression; remove unused variable

    * revert to one level up for cert

    * missing paren

    * remove unused variable & comment

    * more optional chaining and unused vars stuff

    * revert changes per PR comment

    * remove comment

    * reomve comment

    ---------

    Co-authored-by: Rajesh Shrestha <rshrestha@rite-solutions.com>

    Merging with test coverage workflow failure; changes do not affect coverage, all other tests passed

commit 82dd0ca
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sun Jan 14 21:07:07 2024 -0500

    chore(deps): bump jinja2 from 3.1.2 to 3.1.3 in /docs (NUWCDIVNPT#1185)

    Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
    - [Release notes](https://github.com/pallets/jinja/releases)
    - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
    - [Commits](pallets/jinja@3.1.2...3.1.3)

    ---
    updated-dependencies:
    - dependency-name: jinja2
      dependency-type: direct:production
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit ba469ba
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Sun Jan 14 21:01:18 2024 -0500

    chore(deps): bump follow-redirects from 1.15.2 to 1.15.4 in /api/source (NUWCDIVNPT#1180)

    Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
    - [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
    - [Commits](follow-redirects/follow-redirects@v1.15.2...v1.15.4)

    ---
    updated-dependencies:
    - dependency-name: follow-redirects
      dependency-type: indirect
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit a0de443
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Fri Jan 5 11:09:35 2024 -0500

    chore: 1.4.1 (NUWCDIVNPT#1172)

commit 44f8f57
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Fri Jan 5 10:24:02 2024 -0500

    sslconfig needs to look only one level up instead of two for certs after service folder restructuring (NUWCDIVNPT#1171)

    * sslconfig needs to look only one level up instead of two for certs after service folder restructuring

    * write error details to log when dependency setup fails

commit fbf6a96
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Tue Jan 2 13:04:13 2024 -0500

    chore: Update copyright dates; 1.4.0 updates (NUWCDIVNPT#1169)

commit df3300e
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Mon Dec 18 23:06:18 2023 -0500

    Change ib base image tag to 18.18 (NUWCDIVNPT#1167)

commit b14d838
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Wed Dec 13 12:30:27 2023 -0500

    fix: Change STIGMAN_JWT_SERVICENAME_CLAIM to conform w/ standard. Don't create null user if no username claim found. (NUWCDIVNPT#1163)

    * servicename fallback, reject request if no username can be found

    * Add userObject to request object first

    * made changes as suggested by reviewer

commit abd4e65
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Thu Dec 7 12:51:28 2023 -0500

    remove iron bank from matrix testing due to unreliable access (NUWCDIVNPT#1164)

commit 66fcba6
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Wed Dec 6 16:50:01 2023 -0500

    docs: build updates  (NUWCDIVNPT#1162)

    * chore: update docs dependencies

    * wip

    * tweaked build materials a bit

    * added versions

    * updates to docs build process

commit 8a69ec2
Author: cd-rite <61710958+cd-rite@users.noreply.github.com>
Date:   Wed Dec 6 12:14:35 2023 -0500

    chore: Remove STIGMAN_DB_TYPE configuration option (NUWCDIVNPT#1157)

    * remove STIGMAN_DB_TYPE configuration option

    * move services up one level, remove mysql directory

    * remove remaining /mysql paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants