Skip to content

Commit

Permalink
fix: [#287] fix semgrep linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Jul 26, 2022
1 parent 1f87057 commit c745209
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"ncipollo",
"noproxy",
"noreply",
"nosemgrep",
"nuxt",
"oidc",
"Oidc",
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ jobs:
# Import test GPG key
# secretlint-disable
{
# nosemgrep
echo -e "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"
cat __tests__/fixtures/test-key-committer.pgp
echo -e "\n-----END PGP PRIVATE KEY BLOCK-----\n"
Expand Down
3 changes: 3 additions & 0 deletions .semgrepignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cinder/
dist/
megalinter-reports/
1 change: 1 addition & 0 deletions __tests__/unit/queue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ describe('Queue', () => {

const output = gitLogForLatestCommit(gitRepo.getDirPath())

// nosemgrep
expect(RegExp(`gpg:.+RSA.+${signingKeyFingerprint}`).test(output)).toBe(
true
)
Expand Down
2 changes: 2 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/__tests__/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function testConfiguration(): TestConfig {
)

// secretlint-disable
// nosemgrep
const gpgPrivateKey = `-----BEGIN PGP PRIVATE KEY BLOCK-----\n\n${gpgPrivateKeyBody}\n-----END PGP PRIVATE KEY BLOCK-----`
// secretlint-enable

Expand Down
1 change: 1 addition & 0 deletions src/__tests__/gpg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const overwriteAgentConfiguration = async (
config: string,
homedir: string
): Promise<void> => {
// nosemgrep
const gpgAgentConfPath: string = path.join(homedir, 'gpg-agent.conf')

fs.writeFile(gpgAgentConfPath, config, function (err) {
Expand Down
5 changes: 3 additions & 2 deletions src/git-repo-dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ export class GitRepoDir {
this.dirPath = this.normalizePath(dirPath)
}

guardThatDirExists(dirPath): void {
guardThatDirExists(dirPath: string): void {
if (!existsSync(dirPath)) {
throw new GitDirNotFoundError(dirPath)
}
}

normalizePath(dirPath): string {
normalizePath(dirPath: string): string {
// nosemgrep
return isAbsolute(dirPath) ? dirPath : resolve(dirPath)
}

Expand Down
3 changes: 2 additions & 1 deletion src/queue-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export class QueueName implements Nullable {
return this.value === other.value
}

guardThatNameIsValid(value): void {
guardThatNameIsValid(value: string): void {
// nosemgrep
if (!RegExp(`^[a-z-_ ]{1,${MAX_QUEUE_NAME_LENGTH}}$`).test(value)) {
throw new QueueNameNotValidError(value)
}
Expand Down

0 comments on commit c745209

Please sign in to comment.