parseAsOptionalBoolean,
parseAsOptionalString,
parseAsString,
- parseImpactSeverityQuery,
queriesEqual,
serializeDateShort,
serializeOptionalBoolean,
),
compareToProfile: parseAsOptionalString(query.compareToProfile),
cwe: parseAsArray(query.cwe, parseAsString),
- impactSeverities: parseImpactSeverityQuery(query.impactSeverities, query.severities),
+ impactSeverities: parseAsArray<SoftwareImpactSeverity>(query.impactSeverities, parseAsString),
impactSoftwareQualities: parseAsArray<SoftwareQuality>(
query.impactSoftwareQualities,
parseAsString
qprofile: serializeString(query.profile),
repositories: serializeStringArray(query.repositories),
rule_key: serializeString(query.ruleKey),
- severities: undefined,
+ severities: serializeStringArray(query.severities),
sonarsourceSecurity: serializeStringArray(query.sonarsourceSecurity),
statuses: serializeStringArray(query.statuses),
tags: serializeStringArray(query.tags),
s: 'rules',
scopes: 'a,b',
inNewCodePeriod: 'true',
+ severities: 'a,b',
sonarsourceSecurity: 'a,b',
statuses: 'a,b',
tags: 'a,b',
cwe: [],
directories: [],
files: [],
- impactSeverities: [
- SoftwareImpactSeverity.Low,
- SoftwareImpactSeverity.High,
- SoftwareImpactSeverity.Medium,
- ],
+ impactSeverities: [SoftwareImpactSeverity.Low],
impactSoftwareQualities: [SoftwareQuality.Maintainability],
inNewCodePeriod: false,
issues: [],
resolved: true,
rules: [],
scopes: [],
- severities: [],
+ severities: ['CRITICAL', 'MAJOR'],
sonarsourceSecurity: [],
sort: '',
statuses: [],
parseAsBoolean,
parseAsDate,
parseAsString,
- parseImpactSeverityQuery,
queriesEqual,
serializeDateShort,
serializeString,
cwe: parseAsArray(query.cwe, parseAsString),
directories: parseAsArray(query.directories, parseAsString),
files: parseAsArray(query.files, parseAsString),
- impactSeverities: parseImpactSeverityQuery(query.impactSeverities, query.severities),
+ impactSeverities: parseAsArray<SoftwareImpactSeverity>(query.impactSeverities, parseAsString),
impactSoftwareQualities: parseAsArray<SoftwareQuality>(
query.impactSoftwareQualities,
parseAsString
resolved: parseAsBoolean(query.resolved),
rules: parseAsArray(query.rules, parseAsString),
scopes: parseAsArray(query.scopes, parseAsString),
- severities: [],
+ severities: parseAsArray(query.severities, parseAsString),
sonarsourceSecurity: parseAsArray(query.sonarsourceSecurity, parseAsString),
sort: parseAsSort(query.s),
statuses: parseAsArray(query.statuses, parseAsString),
rules: serializeStringArray(query.rules),
s: serializeString(query.sort),
scopes: serializeStringArray(query.scopes),
- severities: undefined,
+ severities: serializeStringArray(query.severities),
impactSeverities: serializeStringArray(query.impactSeverities),
impactSoftwareQualities: serializeStringArray(query.impactSoftwareQualities),
inNewCodePeriod: query.inNewCodePeriod ? 'true' : undefined,
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { compact, isEqual, isNil, omitBy, uniq } from 'lodash';
-import { SoftwareImpactSeverity } from '../types/clean-code-taxonomy';
+import { isEqual, isNil, omitBy } from 'lodash';
import { RawQuery } from '../types/types';
import { isValidDate, parseDate, toISO8601WithOffsetString, toShortISO8601String } from './dates';
}
return undefined;
}
-
-export function parseImpactSeverityQuery(
- newSeverities: string,
- oldSeverities?: string
-): SoftwareImpactSeverity[] {
- const OLD_TO_NEW_MAPPER = {
- BLOCKER: SoftwareImpactSeverity.High,
- CRITICAL: SoftwareImpactSeverity.High,
- MAJOR: SoftwareImpactSeverity.Medium,
- MINOR: SoftwareImpactSeverity.Low,
- INFO: SoftwareImpactSeverity.Low,
- };
-
- // Merging new and old severities includes mapping for old to new
- return compact(
- uniq([
- ...parseAsArray<SoftwareImpactSeverity>(newSeverities, parseAsString),
- ...parseAsArray(oldSeverities, parseAsString).map(
- (oldSeverity: string) => OLD_TO_NEW_MAPPER[oldSeverity as keyof typeof OLD_TO_NEW_MAPPER]
- ),
- ])
- );
-}