-
Notifications
You must be signed in to change notification settings - Fork 29
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
Optional chain useless var assignment #1181
Conversation
…nt' into optionalChain_uselessVarAssignment
api/source/service/STIGService.js
Outdated
@@ -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) |
There was a problem hiding this comment.
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.
api/source/index.js
Outdated
// Handle the error | ||
console.error('Error during server startup:', error); | ||
} | ||
|
There was a problem hiding this comment.
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.
api/source/service/STIGService.js
Outdated
@@ -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) |
There was a problem hiding this comment.
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.
api/source/service/STIGService.js
Outdated
@@ -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) |
There was a problem hiding this comment.
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.
api/source/service/STIGService.js
Outdated
@@ -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) |
There was a problem hiding this comment.
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.
api/source/service/AssetService.js
Outdated
@@ -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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
api/source/service/MetricsService.js
Outdated
|
||
let [rows, fields] = await dbUtils.pool.query( | ||
|
||
//let [rows, fields] = await dbUtils.pool.query( |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
api/source/service/ReviewService.js
Outdated
@@ -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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented out code
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
Optional chain useless var assignment completed from sonar cloud scan so far