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