Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ The structure of the `warnings` is as follows:
* @property {string} warnings[name] - The default warning name (parsingError, unsafeImport etc...).
* @property {string} warnings[name].i18n - i18n token.
* @property {string} warnings[name].code - Used to perform unit tests.
* @property {string} warnings[name].severity - Warning severity.
*/

export const warnings = Object.freeze({
parsingError: {
i18n: "sast_warnings.ast_error"
code: "ast-error",
severity: "Information"
},
...otherWarnings
});
Expand Down
27 changes: 18 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,39 +57,48 @@ declare namespace JSXRay {
interface WarningsNames {
parsingError: {
code: "ast-error",
i18n: "sast_warnings.ast_error"
i18n: "sast_warnings.ast_error",
severity: "Information"
},
unsafeImport: {
code: "unsafe-import",
i18n: "sast_warnings.unsafe_import"
i18n: "sast_warnings.unsafe_import",
severity: "Warning"
},
unsafeRegex: {
code: "unsafe-regex",
i18n: "sast_warnings.unsafe_regex"
i18n: "sast_warnings.unsafe_regex",
severity: "Warning"
},
unsafeStmt: {
code: "unsafe-stmt",
i18n: "sast_warnings.unsafe_stmt"
i18n: "sast_warnings.unsafe_stmt",
severity: "Warning"
},
unsafeAssign: {
code: "unsafe-assign",
i18n: "sast_warnings.unsafe_assign"
i18n: "sast_warnings.unsafe_assign",
severity: "Warning"
},
encodedLiteral: {
code: "encoded-literal",
i18n: "sast_warnings.encoded_literal"
i18n: "sast_warnings.encoded_literal",
severity: "Information"
},
shortIdentifiers: {
code: "short-identifiers",
i18n: "sast_warnings.short_identifiers"
i18n: "sast_warnings.short_identifiers",
severity: "Warning"
},
suspiciousLiteral: {
code: "suspicious-literal",
i18n: "sast_warnings.suspicious_literal"
i18n: "sast_warnings.suspicious_literal",
severity: "Warning"
},
obfuscatedCode: {
code: "obfuscated-code",
i18n: "sast_warnings.obfuscated_code"
i18n: "sast_warnings.obfuscated_code",
severity: "Critical"
}
}

Expand Down
27 changes: 18 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,39 +86,48 @@ export async function runASTAnalysisOnFile(pathToFile, options = {}) {
export const warnings = Object.freeze({
parsingError: {
code: "ast-error",
i18n: "sast_warnings.ast_error"
i18n: "sast_warnings.ast_error",
severity: "Information"
},
unsafeImport: {
code: "unsafe-import",
i18n: "sast_warnings.unsafe_import"
i18n: "sast_warnings.unsafe_import",
severity: "Warning"
},
unsafeRegex: {
code: "unsafe-regex",
i18n: "sast_warnings.unsafe_regex"
i18n: "sast_warnings.unsafe_regex",
severity: "Warning"
},
unsafeStmt: {
code: "unsafe-stmt",
i18n: "sast_warnings.unsafe_stmt"
i18n: "sast_warnings.unsafe_stmt",
severity: "Warning"
},
unsafeAssign: {
code: "unsafe-assign",
i18n: "sast_warnings.unsafe_assign"
i18n: "sast_warnings.unsafe_assign",
severity: "Warning"
},
encodedLiteral: {
code: "encoded-literal",
i18n: "sast_warnings.encoded_literal"
i18n: "sast_warnings.encoded_literal",
severity: "Information"
},
shortIdentifiers: {
code: "short-identifiers",
i18n: "sast_warnings.short_identifiers"
i18n: "sast_warnings.short_identifiers",
severity: "Warning"
},
suspiciousLiteral: {
code: "suspicious-literal",
i18n: "sast_warnings.suspicious_literal"
i18n: "sast_warnings.suspicious_literal",
severity: "Warning"
},
obfuscatedCode: {
code: "obfuscated-code",
i18n: "sast_warnings.obfuscated_code"
i18n: "sast_warnings.obfuscated_code",
severity: "Critical"
}
});

Expand Down
Loading