RULEAPI-626 Fix the crash when choosing terraform, rust, solidity, html - any non covered language
This commit is contained in:
parent
8a2a77321f
commit
a228658b91
3
frontend/.gitignore
vendored
3
frontend/.gitignore
vendored
@ -22,4 +22,5 @@ npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
.eslintcache
|
||||
.eslintcache
|
||||
incomplete-rules-repo/
|
||||
|
@ -70,6 +70,8 @@ const languageToJiraProject = new Map(Object.entries({
|
||||
"TSQL": "SONARTSQL",
|
||||
"VB6": "SONARVBSIX",
|
||||
"XML": "SONARXML",
|
||||
"CLOUDFORMATION": "SONARIAC",
|
||||
"TERRAFORM": "SONARIAC",
|
||||
}));
|
||||
|
||||
const languageToGithubProject = new Map(Object.entries({
|
||||
@ -91,13 +93,15 @@ const languageToGithubProject = new Map(Object.entries({
|
||||
"PLI": "sonar-pli",
|
||||
"CFAMILY": "sonar-cpp",
|
||||
"CSS": "sonar-css",
|
||||
"FLEX": "sonar-flex",
|
||||
"PHP": "sonar-php",
|
||||
"PL/SQL": "sonar-plsql",
|
||||
"Python": "sonar-python",
|
||||
"PLSQL": "sonar-plsql",
|
||||
"PYTHON": "sonar-python",
|
||||
"RPG": "sonar-rpg",
|
||||
"Swift": "sonar-swift",
|
||||
"T-SQL": "sonar-tsql",
|
||||
"TSQL": "sonar-tsql",
|
||||
"XML": "sonar-xml",
|
||||
"CLOUDFORMATION": "sonar-iac",
|
||||
"TERRAFORM": "sonar-iac",
|
||||
}));
|
||||
|
||||
|
||||
|
@ -30,7 +30,10 @@ export function useRuleCoverage() {
|
||||
'tsql': ['TSQL'],
|
||||
'vb6': ['VB'],
|
||||
'WEB': ['WEB'],
|
||||
'xml': ['XML']
|
||||
'xml': ['XML'],
|
||||
'html': ['HTML'],
|
||||
'cloudformation': ['CLOUDFORMATION'],
|
||||
'terraform': ['TERRAFORM']
|
||||
}));
|
||||
function ruleCoverage(language: string, ruleKeys: string[], mapper: any) {
|
||||
if (coveredRulesError) {
|
||||
@ -47,11 +50,12 @@ export function useRuleCoverage() {
|
||||
// const keys = coveredRules.keys;
|
||||
const languageKeys = languageToSonarpedia.get(language);
|
||||
if (!languageKeys) {
|
||||
throw new Error(`Unknown key ${language}`)
|
||||
return 'Nonsupported language';
|
||||
}
|
||||
languageKeys.forEach(sonarpediaKey => {
|
||||
ruleKeys.forEach(ruleKey => {
|
||||
if (ruleKey in coveredRules[sonarpediaKey]) {
|
||||
if (sonarpediaKey in coveredRules &&
|
||||
ruleKey in coveredRules[sonarpediaKey]) {
|
||||
result.push(mapper(sonarpediaKey, coveredRules[sonarpediaKey][ruleKey]))
|
||||
}
|
||||
});
|
||||
@ -64,4 +68,4 @@ export function useRuleCoverage() {
|
||||
}
|
||||
|
||||
return ruleCoverage;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user