Revert line number implementation
This commit is contained in:
+1
-1025
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
-19
@@ -1069,25 +1069,6 @@ Apache License
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
graceful-fs
|
|
||||||
ISC
|
|
||||||
The ISC License
|
|
||||||
|
|
||||||
Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
||||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
indent-string
|
indent-string
|
||||||
MIT
|
MIT
|
||||||
MIT License
|
MIT License
|
||||||
|
|||||||
-56
@@ -367,30 +367,6 @@ async function createScorecardWarnings(
|
|||||||
dependency.scorecard?.score &&
|
dependency.scorecard?.score &&
|
||||||
dependency.scorecard?.score < config.warn_on_openssf_scorecard_level
|
dependency.scorecard?.score < config.warn_on_openssf_scorecard_level
|
||||||
) {
|
) {
|
||||||
const lineColNumbers: {
|
|
||||||
lineNumber: number
|
|
||||||
startCol: number
|
|
||||||
endCol: number
|
|
||||||
} = await findLineColNumbers(
|
|
||||||
dependency.change.manifest,
|
|
||||||
dependency.change.name
|
|
||||||
)
|
|
||||||
core.debug(
|
|
||||||
`LineColNumbers: ${JSON.stringify(lineColNumbers)}; Manifest: ${dependency.change.manifest}; Name: ${dependency.change.name}`
|
|
||||||
)
|
|
||||||
if (lineColNumbers.lineNumber > 0 && lineColNumbers.startCol > 0) {
|
|
||||||
core.warning(
|
|
||||||
`${dependency.change.ecosystem}/${dependency.change.name} has an OpenSSF Scorecard of ${dependency.scorecard?.score}, which is less than this repository's threshold of ${config.warn_on_openssf_scorecard_level}.`,
|
|
||||||
{
|
|
||||||
title: 'OpenSSF Scorecard Warning',
|
|
||||||
file: dependency.change.manifest,
|
|
||||||
startLine: lineColNumbers.lineNumber,
|
|
||||||
endLine: lineColNumbers.lineNumber,
|
|
||||||
startColumn: lineColNumbers.startCol,
|
|
||||||
endColumn: lineColNumbers.endCol
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
core.warning(
|
core.warning(
|
||||||
`${dependency.change.ecosystem}/${dependency.change.name} has an OpenSSF Scorecard of ${dependency.scorecard?.score}, which is less than this repository's threshold of ${config.warn_on_openssf_scorecard_level}.`,
|
`${dependency.change.ecosystem}/${dependency.change.name} has an OpenSSF Scorecard of ${dependency.scorecard?.score}, which is less than this repository's threshold of ${config.warn_on_openssf_scorecard_level}.`,
|
||||||
{
|
{
|
||||||
@@ -400,37 +376,5 @@ async function createScorecardWarnings(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Finds the line number of the package in the manifest file
|
|
||||||
async function findLineColNumbers(
|
|
||||||
manifest: string,
|
|
||||||
packageName: string
|
|
||||||
): Promise<{lineNumber: number; startCol: number; endCol: number}> {
|
|
||||||
// Concatenate the GITHUB_WORKSPACE to the manifest file
|
|
||||||
const fileName = path.join(process.env.GITHUB_WORKSPACE || '', manifest)
|
|
||||||
|
|
||||||
// Open the file
|
|
||||||
fs.readFile(fileName, 'utf8', function (err, data) {
|
|
||||||
if (err) {
|
|
||||||
core.error(`Error reading file: ${fileName}`)
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
|
|
||||||
core.debug(`File: ${fileName}, contents: ${data}`)
|
|
||||||
// split the file into lines
|
|
||||||
const lines = data.split('\n')
|
|
||||||
// search for the package name in the file
|
|
||||||
for (let lineNumber = 0; lineNumber < lines.length; lineNumber++) {
|
|
||||||
if (lines[lineNumber].includes(packageName)) {
|
|
||||||
const startCol = lines[lineNumber].indexOf(packageName)
|
|
||||||
const endCol = startCol + packageName.length
|
|
||||||
return {lineNumber, startCol, endCol}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {lineNumber: -1, startCol: -1, endCol: -1}
|
|
||||||
})
|
|
||||||
return {lineNumber: -1, startCol: -1, endCol: -1}
|
|
||||||
}
|
|
||||||
|
|
||||||
run()
|
run()
|
||||||
|
|||||||
Reference in New Issue
Block a user