diff options
author | Philippe Perrin <philippe.perrin@sonarsource.com> | 2022-11-02 11:08:39 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-11-02 20:03:01 +0000 |
commit | 2ab6fc273ecbf405f7c126fab11ddc0b9bf516da (patch) | |
tree | a6e005b4f57fb488d3e551b7df52399e69b0674c /server/sonar-web/src/main/js/helpers | |
parent | 60e4b88e4567c1af3051b6cdc4c8858f8b0fca21 (diff) | |
download | sonarqube-2ab6fc273ecbf405f7c126fab11ddc0b9bf516da.tar.gz sonarqube-2ab6fc273ecbf405f7c126fab11ddc0b9bf516da.zip |
SONAR-13368 Bump to prettier@2.7.1
Diffstat (limited to 'server/sonar-web/src/main/js/helpers')
81 files changed, 820 insertions, 826 deletions
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts index 314efb1c3b5..cbadf4e0461 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts @@ -55,21 +55,21 @@ describe('#getBrancheLikesAsTree', () => { branch2Pr2, branch2Pr1, branch1Pr2, - branch1Pr1 + branch1Pr1, ]) ).toEqual({ mainBranchTree: { branch: main, - pullRequests: [mainPr2, mainPr1] + pullRequests: [mainPr2, mainPr1], }, branchTree: [ { branch: branch1, pullRequests: [branch1Pr2, branch1Pr1] }, { branch: branch2, pullRequests: [branch2Pr2, branch2Pr1] }, { branch: branch3, pullRequests: [] }, - { branch: branch4, pullRequests: [] } + { branch: branch4, pullRequests: [] }, ], parentlessPullRequests: [parentlessPR2, parentlessPR1], - orphanPullRequests: [orphanPR2, orphanPR1] + orphanPullRequests: [orphanPR2, orphanPR1], }); }); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx b/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx index 098a88cc325..cbb53517335 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx +++ b/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx @@ -150,7 +150,7 @@ function renderDom(codeSnippet: string) { className="markdown" // eslint-disable-next-line react/no-danger dangerouslySetInnerHTML={{ - __html: codeSnippet + __html: codeSnippet, }} /> ); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts index b053ff7746f..22ab410531b 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts @@ -21,7 +21,7 @@ import { throwGlobalError } from '../error'; import { addGlobalErrorMessage } from '../globalMessages'; jest.mock('../../helpers/globalMessages', () => ({ - addGlobalErrorMessage: jest.fn() + addGlobalErrorMessage: jest.fn(), })); beforeAll(() => { diff --git a/server/sonar-web/src/main/js/helpers/__tests__/extensions-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/extensions-test.ts index 4198e8e1241..7d1c05fa62d 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/extensions-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/extensions-test.ts @@ -25,8 +25,8 @@ jest.mock('../../app/components/extensions/exposeLibraries', () => jest.fn()); beforeEach(() => { jest.clearAllMocks(); - document.body.childNodes.forEach(node => document.body.removeChild(node)); - document.head.childNodes.forEach(node => document.head.removeChild(node)); + document.body.childNodes.forEach((node) => document.body.removeChild(node)); + document.head.childNodes.forEach((node) => document.head.removeChild(node)); }); describe('installScript', () => { @@ -52,17 +52,14 @@ describe('getExtensionStart', () => { beforeEach(() => { Object.defineProperty(document, 'createElement', { writable: true, - value: jest - .fn() - .mockReturnValueOnce(scriptTag) - .mockReturnValueOnce(linkTag) + value: jest.fn().mockReturnValueOnce(scriptTag).mockReturnValueOnce(linkTag), }); }); afterEach(() => { Object.defineProperty(document, 'createElement', { writable: true, - value: originalCreateElement + value: originalCreateElement, }); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/extensionsHandler-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/extensionsHandler-test.ts index 39c4a4b324f..9d5f031a310 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/extensionsHandler-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/extensionsHandler-test.ts @@ -21,7 +21,7 @@ import { getExtensionFromCache, getWebAnalyticsPageHandlerFromCache, installExtensionsHandler, - installWebAnalyticsHandler + installWebAnalyticsHandler, } from '../extensionsHandler'; describe('installExtensionsHandler & extensions.getExtensionFromCache', () => { diff --git a/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts index afd4a547a5a..f4396eb62a7 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts @@ -21,7 +21,7 @@ import { MessageLevel } from '../../types/globalMessages'; import { addGlobalErrorMessage, addGlobalSuccessMessage, - registerListener + registerListener, } from '../globalMessages'; it('should work as expected', () => { diff --git a/server/sonar-web/src/main/js/helpers/__tests__/handleRequiredAuthentication-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/handleRequiredAuthentication-test.ts index eb637128ec4..713472f3b4f 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/handleRequiredAuthentication-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/handleRequiredAuthentication-test.ts @@ -29,18 +29,18 @@ beforeAll(() => { pathname: '/path', search: '?id=12', hash: '#tag', - replace + replace, }; Object.defineProperty(window, 'location', { writable: true, - value: location + value: location, }); }); afterAll(() => { Object.defineProperty(window, 'location', { writable: true, - value: originalLocation + value: originalLocation, }); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts index fa22f0c1d17..75044ae08ce 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts @@ -39,8 +39,8 @@ it('should populate comments data', () => { active: true, avatar: 'c1244e6857f7be3dc4549d9e9d51c631', login: 'admin', - name: 'Admin Admin' - } + name: 'Admin Admin', + }, ]; const issue = { comments: [ @@ -50,9 +50,9 @@ it('should populate comments data', () => { key: 'AVtcKbZkQmGLa7yW8J71', login: 'admin', markdown: 'comment!', - updatable: true - } - ] + updatable: true, + }, + ], } as any; expect(parseIssueFromResponse(issue, undefined, users, undefined).comments).toEqual([ { @@ -66,8 +66,8 @@ it('should populate comments data', () => { key: 'AVtcKbZkQmGLa7yW8J71', login: undefined, markdown: 'comment!', - updatable: true - } + updatable: true, + }, ]); }); @@ -78,60 +78,60 @@ it('orders secondary locations', () => { locations: [ { component: 'foo', - textRange: { startLine: 68, startOffset: 5, endLine: 68, endOffset: 7 } - } - ] + textRange: { startLine: 68, startOffset: 5, endLine: 68, endOffset: 7 }, + }, + ], }, { locations: [ { component: 'unknown', - textRange: { startLine: 43, startOffset: 8, endLine: 43, endOffset: 12 } - } - ] + textRange: { startLine: 43, startOffset: 8, endLine: 43, endOffset: 12 }, + }, + ], }, { locations: [ { component: 'bar', - textRange: { startLine: 43, startOffset: 6, endLine: 43, endOffset: 8 } - } - ] + textRange: { startLine: 43, startOffset: 6, endLine: 43, endOffset: 8 }, + }, + ], }, { locations: [ { component: 'foo', - textRange: { startLine: 70, startOffset: 12, endLine: 70, endOffset: 16 } - } - ] - } - ] + textRange: { startLine: 70, startOffset: 12, endLine: 70, endOffset: 16 }, + }, + ], + }, + ], } as any; const components = [ { key: 'foo', name: 'src/foo.js' }, - { key: 'bar', name: 'src/bar.js' } + { key: 'bar', name: 'src/bar.js' }, ]; expect(parseIssueFromResponse(issue, components).secondaryLocations).toEqual([ { component: 'bar', componentName: 'src/bar.js', - textRange: { endLine: 43, endOffset: 8, startLine: 43, startOffset: 6 } + textRange: { endLine: 43, endOffset: 8, startLine: 43, startOffset: 6 }, }, { component: 'unknown', componentName: undefined, - textRange: { endLine: 43, endOffset: 12, startLine: 43, startOffset: 8 } + textRange: { endLine: 43, endOffset: 12, startLine: 43, startOffset: 8 }, }, { component: 'foo', componentName: 'src/foo.js', - textRange: { endLine: 68, endOffset: 7, startLine: 68, startOffset: 5 } + textRange: { endLine: 68, endOffset: 7, startLine: 68, startOffset: 5 }, }, { component: 'foo', componentName: 'src/foo.js', - textRange: { endLine: 70, endOffset: 16, startLine: 70, startOffset: 12 } - } + textRange: { endLine: 70, endOffset: 16, startLine: 70, startOffset: 12 }, + }, ]); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts index 346d097dce8..04f09640897 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts @@ -27,7 +27,7 @@ import { getWeekDayName, hasMessage, translate, - translateWithParameters + translateWithParameters, } from '../l10n'; import { getMessages } from '../l10nBundle'; @@ -36,7 +36,7 @@ const MSG = 'my_message'; jest.unmock('../l10n'); jest.mock('../l10nBundle', () => ({ - getMessages: jest.fn().mockReturnValue({}) + getMessages: jest.fn().mockReturnValue({}), })); const resetMessages = (messages: Dict<string>) => @@ -50,7 +50,7 @@ describe('hasMessage', () => { it('should return that the message exists', () => { resetMessages({ foo: 'foo', - 'foo.bar': 'foobar' + 'foo.bar': 'foobar', }); expect(hasMessage('foo')).toBe(true); expect(hasMessage('foo', 'bar')).toBe(true); @@ -101,7 +101,7 @@ describe('translateWithParameters', () => { it('should translate message with several parameters', () => { resetMessages({ - x_apples: '{0}: I have {2} apples in my {1} baskets - {3}' + x_apples: '{0}: I have {2} apples in my {1} baskets - {3}', }); expect(translateWithParameters('x_apples', 1, 2, 3, 4)).toBe( '1: I have 3 apples in my 2 baskets - 4' @@ -130,7 +130,7 @@ describe('getLocalizedMetricName', () => { it('should return the metric short name', () => { resetMessages({ - 'metric.new_code.short_name': 'metric.new_code.short_name_t' + 'metric.new_code.short_name': 'metric.new_code.short_name_t', }); expect(getLocalizedMetricName(metric, true)).toBe('metric.new_code.short_name_t'); }); @@ -152,7 +152,7 @@ describe('getLocalizedMetricName', () => { describe('getLocalizedCategoryMetricName', () => { it('should return metric category name translation', () => { resetMessages({ - 'metric.new_code.extra_short_name': 'metric.new_code.extra_short_name_t' + 'metric.new_code.extra_short_name': 'metric.new_code.extra_short_name_t', }); expect(getLocalizedCategoryMetricName({ key: 'new_code' })).toBe( 'metric.new_code.extra_short_name_t' diff --git a/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts index 58c1e603b51..b152187debd 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts @@ -28,8 +28,8 @@ beforeEach(() => { jest.mock('../../api/l10n', () => ({ fetchL10nBundle: jest.fn().mockResolvedValue({ effectiveLocale: 'de', - messages: { foo: 'Foo', 'foo.bar': 'Foo Bar' } - }) + messages: { foo: 'Foo', 'foo.bar': 'Foo Bar' }, + }), })); describe('#loadL10nBundle', () => { @@ -41,7 +41,7 @@ describe('#loadL10nBundle', () => { it('should ftech bundle without local storage timestamp if locales are different', async () => { const cachedBundle = { timestamp: 'timestamp', locale: 'fr', messages: { cache: 'cache' } }; - ((window as unknown) as any).sonarQubeL10nBundle = cachedBundle; + (window as unknown as any).sonarQubeL10nBundle = cachedBundle; await loadL10nBundle(); @@ -50,7 +50,7 @@ describe('#loadL10nBundle', () => { it('should fetch bundle with cached bundle timestamp and browser locale', async () => { const cachedBundle = { timestamp: 'timestamp', locale: 'de', messages: { cache: 'cache' } }; - ((window as unknown) as any).sonarQubeL10nBundle = cachedBundle; + (window as unknown as any).sonarQubeL10nBundle = cachedBundle; await loadL10nBundle(); @@ -60,7 +60,7 @@ describe('#loadL10nBundle', () => { it('should fallback to cached bundle if the server respond with 304', async () => { const cachedBundle = { timestamp: 'timestamp', locale: 'fr', messages: { cache: 'cache' } }; (fetchL10nBundle as jest.Mock).mockRejectedValueOnce({ status: 304 }); - ((window as unknown) as any).sonarQubeL10nBundle = cachedBundle; + (window as unknown as any).sonarQubeL10nBundle = cachedBundle; const bundle = await loadL10nBundle(); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts index 840d92d4bde..2c7d78e0dd4 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts @@ -24,7 +24,7 @@ import { enhanceConditionWithMeasure, formatMeasure, getMinDecimalsCountToBeDistinctFromThreshold, - isPeriodBestValue + isPeriodBestValue, } from '../measures'; import { mockQualityGateStatusCondition } from '../mocks/quality-gates'; import { mockMeasureEnhanced, mockMetric } from '../testMocks'; @@ -33,7 +33,7 @@ jest.unmock('../l10n'); jest.mock('../l10nBundle', () => ({ getCurrentLocale: jest.fn().mockReturnValue('us'), - getMessages: jest.fn().mockReturnValue({}) + getMessages: jest.fn().mockReturnValue({}), })); const resetMessages = (messages: Dict<string>) => @@ -50,7 +50,7 @@ beforeAll(() => { 'metric.level.OK': 'Ok', 'short_number_suffix.g': 'G', 'short_number_suffix.k': 'k', - 'short_number_suffix.m': 'M' + 'short_number_suffix.m': 'M', }); }); @@ -63,22 +63,22 @@ describe('enhanceConditionWithMeasure', () => { it('should correctly map enhance conditions with measure data', () => { const measures = [ mockMeasureEnhanced({ metric: mockMetric({ key: 'bugs' }), period: undefined }), - mockMeasureEnhanced({ metric: mockMetric({ key: 'new_bugs' }) }) + mockMeasureEnhanced({ metric: mockMetric({ key: 'new_bugs' }) }), ]; expect( enhanceConditionWithMeasure(mockQualityGateStatusCondition({ metric: 'bugs' }), measures) ).toMatchObject({ - measure: expect.objectContaining({ metric: expect.objectContaining({ key: 'bugs' }) }) + measure: expect.objectContaining({ metric: expect.objectContaining({ key: 'bugs' }) }), }); expect( enhanceConditionWithMeasure(mockQualityGateStatusCondition({ metric: 'new_bugs' }), measures) ).toMatchObject({ measure: expect.objectContaining({ - metric: expect.objectContaining({ key: 'new_bugs' }) + metric: expect.objectContaining({ key: 'new_bugs' }), }), - period: 1 + period: 1, }); }); @@ -261,7 +261,7 @@ describe('getMinDecimalsCountToBeDistinctFromThreshold', () => { }); it('should return 1 if the delta is larger than 0.1', () => { - [0.1, 0.15, 0.2, 0.5, 0.8, 1].forEach(delta => { + [0.1, 0.15, 0.2, 0.5, 0.8, 1].forEach((delta) => { expect(getMinDecimalsCountToBeDistinctFromThreshold(2.5 + delta, 2.5)).toBe(1); expect(getMinDecimalsCountToBeDistinctFromThreshold(2.5 - delta, 2.5)).toBe(1); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/pages-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/pages-test.ts index e4086984f96..c79eebc57aa 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/pages-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/pages-test.ts @@ -23,14 +23,14 @@ import { addWhitePageClass, removeNoFooterPageClass, removeSideBarClass, - removeWhitePageClass + removeWhitePageClass, } from '../pages'; describe('class adders', () => { it.each([ [addSideBarClass, 'sidebar-page'], [addNoFooterPageClass, 'no-footer-page'], - [addWhitePageClass, 'white-page'] + [addWhitePageClass, 'white-page'], ])('%s should add the class', (fct, cls) => { const toggle = jest.spyOn(document.body.classList, 'toggle'); fct(); @@ -42,7 +42,7 @@ describe('class removers', () => { it.each([ [removeSideBarClass, 'sidebar-page'], [removeNoFooterPageClass, 'no-footer-page'], - [removeWhitePageClass, 'white-page'] + [removeWhitePageClass, 'white-page'], ])('%s should add the class', (fct, cls) => { const toggle = jest.spyOn(document.body.classList, 'toggle'); fct(); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts index 6f67bde8efe..43c853c0552 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts @@ -23,7 +23,7 @@ import { cutLongWords, fileFromPath, limitComponentName, - splitPath + splitPath, } from '../path'; describe('#collapsedDirFromPath()', () => { @@ -109,7 +109,7 @@ describe('splitPath', () => { expect(splitPath('my/super/path')).toEqual({ head: 'my/super', tail: 'path' }); expect(splitPath('my/super/very/long/path')).toEqual({ head: 'my/super/very/long', - tail: 'path' + tail: 'path', }); }); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/periods-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/periods-test.ts index 05ddee8a84c..1b0aeb6a41c 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/periods-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/periods-test.ts @@ -20,7 +20,7 @@ import { getPeriodLabel } from '../periods'; import { mockPeriod } from '../testMocks'; -const formatter = jest.fn(v => v); +const formatter = jest.fn((v) => v); beforeEach(() => { formatter.mockClear(); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts index e54ee2d5a9c..270074f0b4b 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts @@ -19,11 +19,11 @@ */ import { mockQualityGateApplicationStatus, - mockQualityGateProjectStatus + mockQualityGateProjectStatus, } from '../mocks/quality-gates'; import { extractStatusConditionsFromApplicationStatusChildProject, - extractStatusConditionsFromProjectStatus + extractStatusConditionsFromProjectStatus, } from '../qualityGates'; describe('extractStatusConditionsFromProjectStatus', () => { @@ -35,8 +35,8 @@ describe('extractStatusConditionsFromProjectStatus', () => { level: 'OK', metric: 'new_bugs', op: 'GT', - period: 1 - } + period: 1, + }, ]); }); }); @@ -54,7 +54,7 @@ describe('extractStatusConditionsFromApplicationStatusChildProject', () => { level: 'ERROR', metric: 'coverage', op: 'GT', - period: undefined + period: undefined, }, { actual: '5', @@ -62,8 +62,8 @@ describe('extractStatusConditionsFromApplicationStatusChildProject', () => { level: 'ERROR', metric: 'new_bugs', op: 'GT', - period: 1 - } + period: 1, + }, ]); }); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/query-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/query-test.ts index ca05d0dea2a..144718d7437 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/query-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/query-test.ts @@ -67,7 +67,7 @@ describe('parseAsOptionalArray', () => { expect(query.parseAsOptionalArray('true,false,false', query.parseAsBoolean)).toEqual([ true, false, - false + false, ]); expect(query.parseAsOptionalArray(undefined, query.parseAsString)).toBeUndefined(); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/ratings-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/ratings-test.ts index 43ba52a543a..43fa5074cbc 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/ratings-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/ratings-test.ts @@ -23,7 +23,7 @@ import { getDuplicationsRatingAverageValue, getDuplicationsRatingLabel, getSizeRatingAverageValue, - getSizeRatingLabel + getSizeRatingLabel, } from '../ratings'; describe('getCoverageRatingLabel', () => { @@ -37,7 +37,7 @@ describe('getCoverageRatingLabel', () => { [2, '70% - 80%'], [3, '50% - 70%'], [4, '30% - 50%'], - [5, '< 30%'] + [5, '< 30%'], ])('should return the correct label for %s', (rating, label) => { expect(getCoverageRatingLabel(rating)).toBe(label); }); @@ -49,7 +49,7 @@ describe('getCoverageRatingAverageValue', () => { [2, 75], [3, 60], [4, 40], - [5, 15] + [5, 15], ])('should return the correct value', (rating, value) => { expect(getCoverageRatingAverageValue(rating)).toBe(value); }); @@ -66,7 +66,7 @@ describe('getDuplicationsRatingLabel', () => { [2, '3% - 5%'], [3, '5% - 10%'], [4, '10% - 20%'], - [5, '> 20%'] + [5, '> 20%'], ])('should return the correct label for %s', (rating, label) => { expect(getDuplicationsRatingLabel(rating)).toBe(label); }); @@ -78,7 +78,7 @@ describe('getDuplicationsRatingAverageValue', () => { [2, 4], [3, 7.5], [4, 15], - [5, 30] + [5, 30], ])('should return the correct value', (rating, value) => { expect(getDuplicationsRatingAverageValue(rating)).toBe(value); }); @@ -95,7 +95,7 @@ describe('getSizeRatingLabel', () => { [2, '1k - 10k'], [3, '10k - 100k'], [4, '100k - 500k'], - [5, '> 500k'] + [5, '> 500k'], ])('should return the correct label for %s', (rating, label) => { expect(getSizeRatingLabel(rating)).toBe(label); }); @@ -107,7 +107,7 @@ describe('getSizeRatingAverageValue', () => { [2, 5000], [3, 50000], [4, 250000], - [5, 750000] + [5, 750000], ])('should return the correct value', (rating, value) => { expect(getSizeRatingAverageValue(rating)).toBe(value); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts index 99be07950fa..3475758f87a 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts @@ -34,7 +34,7 @@ import { post, postJSON, postJSONBody, - requestTryAndRepeatUntil + requestTryAndRepeatUntil, } from '../request'; jest.mock('../handleRequiredAuthentication', () => jest.fn()); @@ -89,7 +89,7 @@ describe('getText', () => { describe('parseError', () => { it('should parse error and return the message', async () => { const response = new Response(JSON.stringify({ errors: [{ msg: 'Error1' }] }), { - status: HttpStatus.BadRequest + status: HttpStatus.BadRequest, }); await expect(parseError(response)).resolves.toBe('Error1'); }); @@ -168,7 +168,7 @@ describe('postJSONBody', () => { expect.objectContaining({ headers: { Accept: 'application/json', 'Content-Type': 'application/json' }, body: '{"nested":{"data":"test","withArray":[1,2]}}', - method: 'POST' + method: 'POST', }) ); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/scrolling-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/scrolling-test.ts index 47272979ca4..cf224a6255c 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/scrolling-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/scrolling-test.ts @@ -222,5 +222,5 @@ const mockGetBoundingClientRect = (overrides: Partial<ClientRect>) => () => right: 0, top: 0, width: 0, - ...overrides + ...overrides, } as DOMRect); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts index 1032221e971..1cf4415e658 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts @@ -26,18 +26,18 @@ import { renderPciDss32Category, renderPciDss40Category, renderSansTop25Category, - renderSonarSourceSecurityCategory + renderSonarSourceSecurityCategory, } from '../security-standard'; describe('renderCWECategory', () => { const standards: Standards = { cwe: { '1004': { - title: "Sensitive Cookie Without 'HttpOnly' Flag" + title: "Sensitive Cookie Without 'HttpOnly' Flag", }, unknown: { - title: 'No CWE associated' - } + title: 'No CWE associated', + }, }, owaspTop10: {}, 'owaspTop10-2021': {}, @@ -45,7 +45,7 @@ describe('renderCWECategory', () => { sonarsourceSecurity: {}, 'pciDss-3.2': {}, 'pciDss-4.0': {}, - 'owaspAsvs-4.0': {} + 'owaspAsvs-4.0': {}, }; it('should render cwe categories correctly', () => { expect(renderCWECategory(standards, '1004')).toEqual( @@ -61,15 +61,15 @@ describe('renderOwaspTop10Category', () => { cwe: {}, owaspTop10: { a1: { - title: 'Injection' - } + title: 'Injection', + }, }, 'owaspTop10-2021': {}, sansTop25: {}, sonarsourceSecurity: {}, 'pciDss-3.2': {}, 'pciDss-4.0': {}, - 'owaspAsvs-4.0': {} + 'owaspAsvs-4.0': {}, }; it('should render owasp categories correctly', () => { expect(renderOwaspTop10Category(standards, 'a1')).toEqual('A1 - Injection'); @@ -85,14 +85,14 @@ describe('renderOwaspTop102021Category', () => { owaspTop10: {}, 'owaspTop10-2021': { a1: { - title: 'Injection' - } + title: 'Injection', + }, }, sansTop25: {}, sonarsourceSecurity: {}, 'pciDss-3.2': {}, 'pciDss-4.0': {}, - 'owaspAsvs-4.0': {} + 'owaspAsvs-4.0': {}, }; it('should render owasp categories correctly', () => { expect(renderOwaspTop102021Category(standards, 'a1')).toEqual('A1 - Injection'); @@ -111,11 +111,11 @@ describe('renderPciDss32Category', () => { sonarsourceSecurity: {}, 'pciDss-3.2': { '1': { - title: 'Install and maintain a firewall configuration to protect cardholder data' - } + title: 'Install and maintain a firewall configuration to protect cardholder data', + }, }, 'pciDss-4.0': {}, - 'owaspAsvs-4.0': {} + 'owaspAsvs-4.0': {}, }; it('should render Pci Dss 3.2 correctly', () => { expect(renderPciDss32Category(standards, '1')).toEqual( @@ -135,10 +135,10 @@ describe('renderPciDss40Category', () => { 'pciDss-3.2': {}, 'pciDss-4.0': { '1': { - title: 'Install and maintain a firewall configuration to protect cardholder data' - } + title: 'Install and maintain a firewall configuration to protect cardholder data', + }, }, - 'owaspAsvs-4.0': {} + 'owaspAsvs-4.0': {}, }; it('should render Pci Dss 4.0 correctly', () => { expect(renderPciDss40Category(standards, '1')).toEqual( @@ -159,13 +159,13 @@ describe('renderOwaspAsvs40Category', () => { 'pciDss-4.0': {}, 'owaspAsvs-4.0': { '1': { - title: 'Main category' + title: 'Main category', }, '1.1': { title: 'Sub category', - level: '2' - } - } + level: '2', + }, + }, }; it('should render OwaspAsvs 4.0 correctly', () => { expect(renderOwaspAsvs40Category(standards, '1')).toEqual('1 - Main category'); @@ -180,13 +180,13 @@ describe('renderSansTop25Category', () => { 'owaspTop10-2021': {}, sansTop25: { 'insecure-interaction': { - title: 'Insecure Interaction Between Components' - } + title: 'Insecure Interaction Between Components', + }, }, sonarsourceSecurity: {}, 'pciDss-3.2': {}, 'pciDss-4.0': {}, - 'owaspAsvs-4.0': {} + 'owaspAsvs-4.0': {}, }; it('should render sans categories correctly', () => { expect(renderSansTop25Category(standards, 'insecure-interaction')).toEqual( @@ -208,15 +208,15 @@ describe('renderSonarSourceSecurityCategory', () => { sansTop25: {}, sonarsourceSecurity: { xss: { - title: 'Cross-Site Scripting (XSS)' + title: 'Cross-Site Scripting (XSS)', }, others: { - title: 'Others' - } + title: 'Others', + }, }, 'pciDss-3.2': {}, 'pciDss-4.0': {}, - 'owaspAsvs-4.0': {} + 'owaspAsvs-4.0': {}, }; it('should render sonarsource categories correctly', () => { expect(renderSonarSourceSecurityCategory(standards, 'xss')).toEqual( diff --git a/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts index bb961c22932..0b1627a11c5 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts @@ -24,7 +24,7 @@ import { openHotspot, portIsValid, probeSonarLintServers, - sendUserToken + sendUserToken, } from '../sonarlint'; describe('buildPortRange', () => { @@ -79,7 +79,7 @@ describe('portIsValid', () => { [64120, true], [64125, true], [64130, true], - [64131, false] + [64131, false], ])('should validate port %s is within the expected range', (port, expectation) => { expect(portIsValid(port)).toBe(expectation); }); @@ -93,7 +93,7 @@ describe('sendUserToken', () => { createdAt: '12-12-2018', expirationDate: '17-02-2019', token: '78gfh78d6gf8h', - type: TokenType.User + type: TokenType.User, }; const resp = new Response(); @@ -119,7 +119,7 @@ describe('sendUserToken', () => { createdAt: '12-12-2018', expirationDate: '17-02-2019', token: '78gfh78d6gf8h', - type: TokenType.User + type: TokenType.User, }; const resp = new Response('Meh', { status: HttpStatus.BadRequest, statusText: 'I no likez' }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts index ccda3a4150e..aa26829af90 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts @@ -27,7 +27,7 @@ describe('stringify', () => { prop3: true, prop4: '', prop5: [9, 8, 7], - prop6: { test: 'test' } + prop6: { test: 'test' }, }; expect(stringify(obj)).toEqual( diff --git a/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts index 7eb89b9d88a..4f9e9fbb180 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts @@ -26,7 +26,7 @@ describe('#decodeJwt', () => { exp: 1541062205, iat: 1541058605, iss: 'ari:cloud:bitbucket::app/{327713ed-f1b2-4659-9c91-c8ecf8be7f3e}/sonarcloud-greg', - qsh: 'a6c93addd971c05d08da1e1669c2640fba529e98fbb5b2b9effadf00bf484277' + qsh: 'a6c93addd971c05d08da1e1669c2640fba529e98fbb5b2b9effadf00bf484277', }; expect( decodeJwt( diff --git a/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts index 8b871e5b839..f09b1c6da07 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts @@ -27,19 +27,19 @@ import { computeTokenExpirationDate, EXPIRATION_OPTIONS, getAvailableExpirationOptions, - getNextTokenName + getNextTokenName, } from '../tokens'; jest.mock('../../api/settings', () => { return { - getAllValues: jest.fn().mockResolvedValue([]) + getAllValues: jest.fn().mockResolvedValue([]), }; }); jest.mock('../dates', () => { return { ...jest.requireActual('../dates'), - now: jest.fn(() => new Date('2022-06-01T12:00:00Z')) + now: jest.fn(() => new Date('2022-06-01T12:00:00Z')), }; }); @@ -50,21 +50,21 @@ describe('getAvailableExpirationOptions', () => { it('should correctly return all options if the max setting is no expiration', async () => { (getAllValues as jest.Mock).mockResolvedValueOnce([ - mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: 'No expiration' }) + mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: 'No expiration' }), ]); expect(await getAvailableExpirationOptions()).toEqual(EXPIRATION_OPTIONS); }); it('should correctly limit options if the max setting is 1 year', async () => { (getAllValues as jest.Mock).mockResolvedValueOnce([ - mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '1 year' }) + mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '1 year' }), ]); expect(await getAvailableExpirationOptions()).toEqual( [TokenExpiration.OneMonth, TokenExpiration.ThreeMonths, TokenExpiration.OneYear].map( - value => { + (value) => { return { value, - label: `users.tokens.expiration.${value.toString()}` + label: `users.tokens.expiration.${value.toString()}`, }; } ) @@ -73,13 +73,13 @@ describe('getAvailableExpirationOptions', () => { it('should correctly limit options if the max setting is 3 months', async () => { (getAllValues as jest.Mock).mockResolvedValueOnce([ - mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '90 days' }) + mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '90 days' }), ]); expect(await getAvailableExpirationOptions()).toEqual( - [TokenExpiration.OneMonth, TokenExpiration.ThreeMonths].map(value => { + [TokenExpiration.OneMonth, TokenExpiration.ThreeMonths].map((value) => { return { value, - label: `users.tokens.expiration.${value.toString()}` + label: `users.tokens.expiration.${value.toString()}`, }; }) ); @@ -87,13 +87,13 @@ describe('getAvailableExpirationOptions', () => { it('should correctly limit options if the max setting is 30 days', async () => { (getAllValues as jest.Mock).mockResolvedValueOnce([ - mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '30 days' }) + mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '30 days' }), ]); expect(await getAvailableExpirationOptions()).toEqual([ { value: TokenExpiration.OneMonth, - label: `users.tokens.expiration.${TokenExpiration.OneMonth.toString()}` - } + label: `users.tokens.expiration.${TokenExpiration.OneMonth.toString()}`, + }, ]); }); }); @@ -102,7 +102,7 @@ describe('computeTokenExpirationDate', () => { it.each([ [TokenExpiration.OneMonth, '2022-07-01'], [TokenExpiration.ThreeMonths, '2022-08-30'], - [TokenExpiration.OneYear, '2023-06-01'] + [TokenExpiration.OneYear, '2023-06-01'], ])('should correctly compute the proper expiration date for %s days', (days, expected) => { expect(computeTokenExpirationDate(days)).toBe(expected); }); @@ -122,7 +122,7 @@ describe('getNextTokenName', () => { mockUserToken({ name: `${tokenName}` }), mockUserToken({ name: `${tokenName}-1` }), mockUserToken({ name: `${tokenName}-2` }), - mockUserToken({ name: `${tokenName}-4` }) + mockUserToken({ name: `${tokenName}-4` }), ]; expect(getNextTokenName(tokenName, tokens)).toBe(`${tokenName}-3`); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts index 8842d94dfed..2eb3c084b2e 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts @@ -44,7 +44,7 @@ import { isRelativeUrl, queryToSearch, searchParamsToQuery, - stripTrailingSlash + stripTrailingSlash, } from '../urls'; const SIMPLE_COMPONENT_KEY = 'sonarqube'; @@ -73,17 +73,17 @@ describe('getComponentAdminUrl', () => { [ 'Portfolio', ComponentQualifier.Portfolio, - { pathname: '/project/admin/extension/governance/console', search: '?id=key&qualifier=VW' } + { pathname: '/project/admin/extension/governance/console', search: '?id=key&qualifier=VW' }, ], [ 'Application', ComponentQualifier.Application, { pathname: '/project/admin/extension/developer-server/application-console', - search: '?id=key' - } + search: '?id=key', + }, ], - ['Project', ComponentQualifier.Project, { pathname: '/dashboard', search: '?id=key' }] + ['Project', ComponentQualifier.Project, { pathname: '/dashboard', search: '?id=key' }], ])('should work for %s', (_qualifierName, qualifier, result) => { expect(getComponentAdminUrl('key', qualifier)).toEqual(result); }); @@ -94,7 +94,7 @@ describe('#getComponentIssuesUrl', () => { expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY)).toEqual( expect.objectContaining({ pathname: '/project/issues', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }), }) ); }); @@ -103,7 +103,7 @@ describe('#getComponentIssuesUrl', () => { expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY, { resolved: 'false' })).toEqual( expect.objectContaining({ pathname: '/project/issues', - search: queryToSearch({ resolved: 'false', id: SIMPLE_COMPONENT_KEY }) + search: queryToSearch({ resolved: 'false', id: SIMPLE_COMPONENT_KEY }), }) ); }); @@ -114,7 +114,7 @@ describe('#getComponentSecurityHotspotsUrl', () => { expect(getComponentSecurityHotspotsUrl(SIMPLE_COMPONENT_KEY)).toEqual( expect.objectContaining({ pathname: '/security_hotspots', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }), }) ); }); @@ -130,7 +130,7 @@ describe('#getComponentSecurityHotspotsUrl', () => { [SecurityStandard.SONARSOURCE]: 'command-injection', [SecurityStandard.PCI_DSS_3_2]: '4.2', [SecurityStandard.PCI_DSS_4_0]: '4.1', - ignoredParam: '1234' + ignoredParam: '1234', }) ).toEqual( expect.objectContaining({ @@ -144,8 +144,8 @@ describe('#getComponentSecurityHotspotsUrl', () => { [SecurityStandard.SANS_TOP25]: 'insecure-interaction', [SecurityStandard.CWE]: '213', [SecurityStandard.PCI_DSS_3_2]: '4.2', - [SecurityStandard.PCI_DSS_4_0]: '4.1' - }) + [SecurityStandard.PCI_DSS_4_0]: '4.1', + }), }) ); }); @@ -156,7 +156,7 @@ describe('#getComponentOverviewUrl', () => { expect(getComponentOverviewUrl(SIMPLE_COMPONENT_KEY, ComponentQualifier.Portfolio)).toEqual( expect.objectContaining({ pathname: '/portfolio', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }), }) ); }); @@ -164,7 +164,7 @@ describe('#getComponentOverviewUrl', () => { expect(getComponentOverviewUrl(SIMPLE_COMPONENT_KEY, ComponentQualifier.SubPortfolio)).toEqual( expect.objectContaining({ pathname: '/portfolio', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }), }) ); }); @@ -172,7 +172,7 @@ describe('#getComponentOverviewUrl', () => { expect(getComponentOverviewUrl(SIMPLE_COMPONENT_KEY, ComponentQualifier.Project)).toEqual( expect.objectContaining({ pathname: '/dashboard', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }), }) ); }); @@ -187,7 +187,7 @@ describe('#getComponentOverviewUrl', () => { ).toEqual( expect.objectContaining({ pathname: '/dashboard', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'new' }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'new' }), }) ); }); @@ -202,7 +202,7 @@ describe('#getComponentOverviewUrl', () => { ).toEqual( expect.objectContaining({ pathname: '/dashboard', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'overall' }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'overall' }), }) ); }); @@ -210,7 +210,7 @@ describe('#getComponentOverviewUrl', () => { expect(getComponentOverviewUrl(SIMPLE_COMPONENT_KEY, ComponentQualifier.Application)).toEqual( expect.objectContaining({ pathname: '/dashboard', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }), }) ); }); @@ -223,7 +223,7 @@ describe('#getComponentDrilldownUrl', () => { ).toEqual( expect.objectContaining({ pathname: '/component_measures', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC }), }) ); }); @@ -234,7 +234,7 @@ describe('#getComponentDrilldownUrl', () => { ).toEqual( expect.objectContaining({ pathname: '/component_measures', - search: queryToSearch({ id: COMPLEX_COMPONENT_KEY, metric: METRIC }) + search: queryToSearch({ id: COMPLEX_COMPONENT_KEY, metric: METRIC }), }) ); }); @@ -245,7 +245,7 @@ describe('#getComponentDrilldownUrl', () => { ).toEqual( expect.objectContaining({ pathname: '/component_measures', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC }), }) ); @@ -254,7 +254,7 @@ describe('#getComponentDrilldownUrl', () => { componentKey: SIMPLE_COMPONENT_KEY, metric: METRIC, listView: true, - asc: false + asc: false, }) ).toEqual( expect.objectContaining({ @@ -263,8 +263,8 @@ describe('#getComponentDrilldownUrl', () => { id: SIMPLE_COMPONENT_KEY, metric: METRIC, view: 'list', - asc: 'false' - }) + asc: 'false', + }), }) ); }); @@ -280,8 +280,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => { search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC, - selected: COMPLEX_COMPONENT_KEY - }) + selected: COMPLEX_COMPONENT_KEY, + }), }) ); }); @@ -301,8 +301,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => { id: SIMPLE_COMPONENT_KEY, metric: METRIC, branch: 'foo', - selected: COMPLEX_COMPONENT_KEY - }) + selected: COMPLEX_COMPONENT_KEY, + }), }) ); }); @@ -323,8 +323,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => { id: SIMPLE_COMPONENT_KEY, metric: METRIC, view: 'list', - selected: COMPLEX_COMPONENT_KEY - }) + selected: COMPLEX_COMPONENT_KEY, + }), }) ); @@ -343,8 +343,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => { id: SIMPLE_COMPONENT_KEY, metric: METRIC, view: 'treemap', - selected: COMPLEX_COMPONENT_KEY - }) + selected: COMPLEX_COMPONENT_KEY, + }), }) ); @@ -363,8 +363,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => { id: SIMPLE_COMPONENT_KEY, metric: METRIC, pullRequest: '1', - selected: COMPLEX_COMPONENT_KEY - }) + selected: COMPLEX_COMPONENT_KEY, + }), }) ); }); @@ -374,13 +374,13 @@ describe('getDeprecatedActiveRulesUrl', () => { it('should include query params', () => { expect(getDeprecatedActiveRulesUrl({ languages: 'js' })).toEqual({ pathname: '/coding_rules', - search: '?languages=js&activation=true&statuses=DEPRECATED' + search: '?languages=js&activation=true&statuses=DEPRECATED', }); }); it('should handle empty query', () => { expect(getDeprecatedActiveRulesUrl()).toEqual({ pathname: '/coding_rules', - search: '?activation=true&statuses=DEPRECATED' + search: '?activation=true&statuses=DEPRECATED', }); }); }); @@ -397,7 +397,7 @@ describe('#getIssuesUrl', () => { const type = IssueType.Bug; expect(getIssuesUrl({ type })).toEqual({ pathname: '/issues', - search: queryToSearch({ type }) + search: queryToSearch({ type }), }); }); }); @@ -406,11 +406,11 @@ describe('#getGlobalSettingsUrl', () => { it('should work as expected', () => { expect(getGlobalSettingsUrl('foo')).toEqual({ pathname: '/admin/settings', - search: queryToSearch({ category: 'foo' }) + search: queryToSearch({ category: 'foo' }), }); expect(getGlobalSettingsUrl('foo', { alm: AlmKeys.GitHub })).toEqual({ pathname: '/admin/settings', - search: queryToSearch({ category: 'foo', alm: AlmKeys.GitHub }) + search: queryToSearch({ category: 'foo', alm: AlmKeys.GitHub }), }); }); }); @@ -419,11 +419,11 @@ describe('#getProjectSettingsUrl', () => { it('should work as expected', () => { expect(getProjectSettingsUrl('foo')).toEqual({ pathname: '/project/settings', - search: queryToSearch({ id: 'foo' }) + search: queryToSearch({ id: 'foo' }), }); expect(getProjectSettingsUrl('foo', 'bar')).toEqual({ pathname: '/project/settings', - search: queryToSearch({ id: 'foo', category: 'bar' }) + search: queryToSearch({ id: 'foo', category: 'bar' }), }); }); }); @@ -433,7 +433,7 @@ describe('#getPathUrlAsString', () => { expect( getPathUrlAsString({ pathname: '/dashboard', - search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }) + search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }), }) ).toBe('/dashboard?id=' + SIMPLE_COMPONENT_KEY); }); @@ -442,7 +442,7 @@ describe('#getPathUrlAsString', () => { expect( getPathUrlAsString({ pathname: '/dashboard', - search: queryToSearch({ id: COMPLEX_COMPONENT_KEY }) + search: queryToSearch({ id: COMPLEX_COMPONENT_KEY }), }) ).toBe('/dashboard?id=' + COMPLEX_COMPONENT_KEY_ENCODED); }); @@ -476,7 +476,7 @@ describe('#getHostUrl', () => { }); it('should return host url on client side', () => { jest.mock('../system', () => ({ - getBaseUrl: () => '' + getBaseUrl: () => '', })); const mockedUrls = require('../urls'); expect(mockedUrls.getHostUrl()).toBe('http://localhost'); @@ -489,7 +489,7 @@ describe('searchParamsToQuery', () => { ['a', 'v1'], ['a', 'v2'], ['b', 'awesome'], - ['a', 'v3'] + ['a', 'v3'], ]); const result = searchParamsToQuery(searchParams); @@ -506,7 +506,7 @@ describe('queryToSearch', () => { b2: false, emptyArray: [], normalString: 'hello', - undef: undefined + undef: undefined, }; expect(queryToSearch(query)).toBe( @@ -523,7 +523,7 @@ describe('convertToTo', () => { it('should handle locations with a query', () => { expect(convertToTo(mockLocation({ pathname: '/account', query: { id: 1 } }))).toEqual({ pathname: '/account', - search: '?id=1' + search: '?id=1', }); }); diff --git a/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts index 69575d5b216..d6dda61f4de 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts @@ -27,12 +27,12 @@ describe('isSameHomePage', () => { { type: 'APPLICATION', branch: 'test-branch', - component: 'test-component' + component: 'test-component', }, { type: 'APPLICATION', branch: 'test-branch', - component: 'test-component' + component: 'test-component', } ) ).toBe(true); @@ -42,10 +42,10 @@ describe('isSameHomePage', () => { { type: 'APPLICATION', branch: 'test-branch', - component: 'test-component' + component: 'test-component', }, { - type: 'ISSUES' + type: 'ISSUES', } ) ).toBe(false); @@ -55,12 +55,12 @@ describe('isSameHomePage', () => { { type: 'APPLICATION', branch: 'test-branch', - component: 'test-component' + component: 'test-component', }, { type: 'APPLICATION', branch: 'test-branch-1', - component: 'test-component' + component: 'test-component', } ) ).toBe(false); @@ -70,12 +70,12 @@ describe('isSameHomePage', () => { { type: 'APPLICATION', branch: 'test-branch', - component: 'test-component' + component: 'test-component', }, { type: 'APPLICATION', branch: 'test-branch', - component: 'test-component-1' + component: 'test-component-1', } ) ).toBe(false); diff --git a/server/sonar-web/src/main/js/helpers/branch-like.ts b/server/sonar-web/src/main/js/helpers/branch-like.ts index 261bea49cae..2f7a766fc94 100644 --- a/server/sonar-web/src/main/js/helpers/branch-like.ts +++ b/server/sonar-web/src/main/js/helpers/branch-like.ts @@ -25,7 +25,7 @@ import { BranchParameters, BranchStatusData, MainBranch, - PullRequest + PullRequest, } from '../types/branch-like'; import { Dict } from '../types/types'; @@ -38,7 +38,7 @@ export function isMainBranch(branchLike?: BranchLike): branchLike is MainBranch } export function sortBranches(branches: Branch[]) { - return orderBy(branches, [b => b.isMain, b => b.name], ['desc', 'asc']); + return orderBy(branches, [(b) => b.isMain, (b) => b.name], ['desc', 'asc']); } export function isPullRequest(branchLike?: BranchLike): branchLike is PullRequest { @@ -46,7 +46,7 @@ export function isPullRequest(branchLike?: BranchLike): branchLike is PullReques } export function sortPullRequests(pullRequests: PullRequest[]) { - return orderBy(pullRequests, pr => getPullRequestDisplayName(pr)); + return orderBy(pullRequests, (pr) => getPullRequestDisplayName(pr)); } export function getPullRequestDisplayName(pullRequest: PullRequest) { @@ -84,34 +84,34 @@ export function isSameBranchLike(a: BranchLike | undefined, b: BranchLike | unde export function getBrancheLikesAsTree(branchLikes: BranchLike[]): BranchLikeTree { const mainBranch = branchLikes.find(isMainBranch); const branches = orderBy( - branchLikes.filter(isBranch).filter(b => !isMainBranch(b)), - b => b.name + branchLikes.filter(isBranch).filter((b) => !isMainBranch(b)), + (b) => b.name ); - const pullRequests = orderBy(branchLikes.filter(isPullRequest), b => parseInt(b.key, 10), [ - 'desc' + const pullRequests = orderBy(branchLikes.filter(isPullRequest), (b) => parseInt(b.key, 10), [ + 'desc', ]); const parentlessPullRequests = pullRequests.filter( - pr => !pr.isOrphan && ![mainBranch, ...branches].find(b => !!b && b.name === pr.base) + (pr) => !pr.isOrphan && ![mainBranch, ...branches].find((b) => !!b && b.name === pr.base) ); - const orphanPullRequests = pullRequests.filter(pr => pr.isOrphan); + const orphanPullRequests = pullRequests.filter((pr) => pr.isOrphan); const tree: BranchLikeTree = { - branchTree: branches.map(b => ({ branch: b, pullRequests: getPullRequests(b) })), + branchTree: branches.map((b) => ({ branch: b, pullRequests: getPullRequests(b) })), parentlessPullRequests, - orphanPullRequests + orphanPullRequests, }; if (mainBranch) { tree.mainBranchTree = { branch: mainBranch, - pullRequests: getPullRequests(mainBranch) + pullRequests: getPullRequests(mainBranch), }; } return tree; function getPullRequests(branch: Branch) { - return pullRequests.filter(pr => !pr.isOrphan && pr.base === branch.name); + return pullRequests.filter((pr) => !pr.isOrphan && pr.base === branch.name); } } @@ -132,7 +132,7 @@ export function fillBranchLike( if (branch) { return { isMain: false, - name: branch + name: branch, } as Branch; } else if (pullRequest) { return { base: '', branch: '', key: pullRequest, title: '' } as PullRequest; diff --git a/server/sonar-web/src/main/js/helpers/browser.ts b/server/sonar-web/src/main/js/helpers/browser.ts index 1b6991bfbe9..a5db26c1fa9 100644 --- a/server/sonar-web/src/main/js/helpers/browser.ts +++ b/server/sonar-web/src/main/js/helpers/browser.ts @@ -20,5 +20,5 @@ import { EnhancedWindow } from '../types/browser'; export function getEnhancedWindow() { - return (window as unknown) as EnhancedWindow; + return window as unknown as EnhancedWindow; } diff --git a/server/sonar-web/src/main/js/helpers/code-difference.ts b/server/sonar-web/src/main/js/helpers/code-difference.ts index e190d1b7e92..b57f44e442e 100644 --- a/server/sonar-web/src/main/js/helpers/code-difference.ts +++ b/server/sonar-web/src/main/js/helpers/code-difference.ts @@ -52,14 +52,15 @@ function getExamplesFromDom(element: Element) { return ( Object.values( groupBy( - pres.filter(e => e.getAttribute('data-diff-id') !== undefined), - e => e.getAttribute('data-diff-id') + pres.filter((e) => e.getAttribute('data-diff-id') !== undefined), + (e) => e.getAttribute('data-diff-id') ) ) // If we have 1 or 3+ example we can't display any differences - .filter(diffsBlock => diffsBlock.length === NUMBER_OF_EXAMPLES) + .filter((diffsBlock) => diffsBlock.length === NUMBER_OF_EXAMPLES) .map( - diffBlock => keyBy(diffBlock, block => block.getAttribute('data-diff-type')) as DiffBlock + (diffBlock) => + keyBy(diffBlock, (block) => block.getAttribute('data-diff-type')) as DiffBlock ) ); } @@ -70,7 +71,7 @@ function differentiateCode(compliant: string, nonCompliant: string) { let nonCompliantCode = ''; let compliantCode = ''; - hunks.forEach(hunk => { + hunks.forEach((hunk) => { const value = sanitizeString(hunk.value); if (!hunk.added && !hunk.removed) { nonCompliantCode += `<div>${value}</div>`; diff --git a/server/sonar-web/src/main/js/helpers/component.ts b/server/sonar-web/src/main/js/helpers/component.ts index 2a5283d0266..9c9d0ee05ba 100644 --- a/server/sonar-web/src/main/js/helpers/component.ts +++ b/server/sonar-web/src/main/js/helpers/component.ts @@ -22,5 +22,5 @@ import { ComponentMeasure, ComponentMeasureEnhanced } from '../types/types'; export function getComponentMeasureUniqueKey( component?: ComponentMeasure | ComponentMeasureEnhanced ) { - return component ? [component.key, component.branch].filter(s => !!s).join('/') : undefined; + return component ? [component.key, component.branch].filter((s) => !!s).join('/') : undefined; } diff --git a/server/sonar-web/src/main/js/helpers/constants.ts b/server/sonar-web/src/main/js/helpers/constants.ts index ea1b9c08df8..bdbe8ef30c5 100644 --- a/server/sonar-web/src/main/js/helpers/constants.ts +++ b/server/sonar-web/src/main/js/helpers/constants.ts @@ -29,11 +29,11 @@ export const ISSUE_TYPES: IssueType[] = [ IssueType.Bug, IssueType.Vulnerability, IssueType.CodeSmell, - IssueType.SecurityHotspot + IssueType.SecurityHotspot, ]; export const SOURCE_SCOPES = [ { scope: IssueScope.Main, qualifier: ComponentQualifier.File }, - { scope: IssueScope.Test, qualifier: ComponentQualifier.TestFile } + { scope: IssueScope.Test, qualifier: ComponentQualifier.TestFile }, ]; export const RULE_TYPES: RuleType[] = ['BUG', 'VULNERABILITY', 'CODE_SMELL', 'SECURITY_HOTSPOT']; export const RULE_STATUSES = ['READY', 'BETA', 'DEPRECATED']; @@ -43,15 +43,15 @@ export const RATING_COLORS = [ { fill: colors.successVariant, fillTransparent: colors.successVarianta20, - stroke: colors.successVariantDark + stroke: colors.successVariantDark, }, { fill: colors.warningVariant, fillTransparent: colors.warningVarianta20, - stroke: colors.warningVariantDark + stroke: colors.warningVariantDark, }, { fill: colors.warningAccent, fillTransparent: colors.warningAccenta20, stroke: colors.warning }, - { fill: colors.error400, fillTransparent: colors.error400a20, stroke: colors.error700 } + { fill: colors.error400, fillTransparent: colors.error400a20, stroke: colors.error700 }, ]; export const PROJECT_KEY_MAX_LEN = 400; @@ -61,7 +61,7 @@ export const ALM_DOCUMENTATION_PATHS = { [AlmKeys.BitbucketServer]: '/analysis/bitbucket-integration/', [AlmKeys.BitbucketCloud]: '/analysis/bitbucket-cloud-integration/', [AlmKeys.GitHub]: '/analysis/github-integration/', - [AlmKeys.GitLab]: '/analysis/gitlab-integration/' + [AlmKeys.GitLab]: '/analysis/gitlab-integration/', }; export const IMPORT_COMPATIBLE_ALMS = [ @@ -69,12 +69,12 @@ export const IMPORT_COMPATIBLE_ALMS = [ AlmKeys.BitbucketServer, AlmKeys.BitbucketCloud, AlmKeys.GitHub, - AlmKeys.GitLab + AlmKeys.GitLab, ]; // Count both Bitbuckets as a single ALM. export const IMPORT_COMPATIBLE_ALM_COUNT = IMPORT_COMPATIBLE_ALMS.filter( - a => a !== AlmKeys.BitbucketCloud + (a) => a !== AlmKeys.BitbucketCloud ).length; export const GRADLE_SCANNER_VERSION = '3.5.0.2730'; diff --git a/server/sonar-web/src/main/js/helpers/cookies.ts b/server/sonar-web/src/main/js/helpers/cookies.ts index 8b949b95c22..d0d226abdec 100644 --- a/server/sonar-web/src/main/js/helpers/cookies.ts +++ b/server/sonar-web/src/main/js/helpers/cookies.ts @@ -20,17 +20,15 @@ import { memoize } from 'lodash'; import { Dict } from '../types/types'; -const parseCookies = memoize( - (documentCookie: string): Dict<string> => { - const rawCookies = documentCookie.split('; '); - const cookies: Dict<string> = {}; - rawCookies.forEach(candidate => { - const [key, value] = candidate.split('='); - cookies[key] = value; - }); - return cookies; - } -); +const parseCookies = memoize((documentCookie: string): Dict<string> => { + const rawCookies = documentCookie.split('; '); + const cookies: Dict<string> = {}; + rawCookies.forEach((candidate) => { + const [key, value] = candidate.split('='); + cookies[key] = value; + }); + return cookies; +}); export function getCookie(name: string): string | undefined { return parseCookies(document.cookie)[name]; diff --git a/server/sonar-web/src/main/js/helpers/editions.ts b/server/sonar-web/src/main/js/helpers/editions.ts index 359f7d4bebf..5b15741cd82 100644 --- a/server/sonar-web/src/main/js/helpers/editions.ts +++ b/server/sonar-web/src/main/js/helpers/editions.ts @@ -26,26 +26,26 @@ const EDITIONS: { [x in EditionKey]: Edition } = { key: EditionKey.community, name: 'Community Edition', homeUrl: 'https://redirect.sonarsource.com/editions/community.html', - downloadProperty: 'downloadUrl' + downloadProperty: 'downloadUrl', }, developer: { key: EditionKey.developer, name: 'Developer Edition', homeUrl: 'https://redirect.sonarsource.com/editions/developer.html', - downloadProperty: 'downloadDeveloperUrl' + downloadProperty: 'downloadDeveloperUrl', }, enterprise: { key: EditionKey.enterprise, name: 'Enterprise Edition', homeUrl: 'https://redirect.sonarsource.com/editions/enterprise.html', - downloadProperty: 'downloadEnterpriseUrl' + downloadProperty: 'downloadEnterpriseUrl', }, datacenter: { key: EditionKey.datacenter, name: 'Data Center Edition', homeUrl: 'https://redirect.sonarsource.com/editions/datacenter.html', - downloadProperty: 'downloadDatacenterUrl' - } + downloadProperty: 'downloadDatacenterUrl', + }, }; export function getEdition(editionKey: EditionKey) { @@ -54,7 +54,7 @@ export function getEdition(editionKey: EditionKey) { export function getAllEditionsAbove(currentEdition?: EditionKey) { const editions = Object.values(EDITIONS); - const currentEditionIdx = editions.findIndex(edition => edition.key === currentEdition); + const currentEditionIdx = editions.findIndex((edition) => edition.key === currentEdition); return editions.slice(currentEditionIdx + 1); } diff --git a/server/sonar-web/src/main/js/helpers/extensions.ts b/server/sonar-web/src/main/js/helpers/extensions.ts index 886152c2d42..ef1010b402f 100644 --- a/server/sonar-web/src/main/js/helpers/extensions.ts +++ b/server/sonar-web/src/main/js/helpers/extensions.ts @@ -24,7 +24,7 @@ import { getExtensionFromCache } from './extensionsHandler'; let librariesExposed = false; export function installStyles(url: string, target: 'body' | 'head' = 'head'): Promise<any> { - return new Promise(resolve => { + return new Promise((resolve) => { const linkTag = document.createElement('link'); linkTag.href = `${getBaseUrl()}${url}`; linkTag.rel = 'stylesheet'; @@ -34,7 +34,7 @@ export function installStyles(url: string, target: 'body' | 'head' = 'head'): Pr } export function installScript(url: string, target: 'body' | 'head' = 'body'): Promise<any> { - return new Promise(resolve => { + return new Promise((resolve) => { const scriptTag = document.createElement('script'); scriptTag.src = `${getBaseUrl()}${url}`; scriptTag.onload = resolve; diff --git a/server/sonar-web/src/main/js/helpers/globalMessages.ts b/server/sonar-web/src/main/js/helpers/globalMessages.ts index dc5f2f02ca5..823eb149130 100644 --- a/server/sonar-web/src/main/js/helpers/globalMessages.ts +++ b/server/sonar-web/src/main/js/helpers/globalMessages.ts @@ -37,11 +37,11 @@ export function unregisterListener(callback: (message: Message) => void) { } function addMessage(text: string, level: MessageLevel) { - listeners.forEach(listener => + listeners.forEach((listener) => listener({ id: uniqueId('global-message-'), level, - text + text, }) ); } diff --git a/server/sonar-web/src/main/js/helpers/issues.ts b/server/sonar-web/src/main/js/helpers/issues.ts index 2b0588f46a9..ae3d39f4d52 100644 --- a/server/sonar-web/src/main/js/helpers/issues.ts +++ b/server/sonar-web/src/main/js/helpers/issues.ts @@ -36,7 +36,7 @@ interface Component { } export function sortByType<T extends Pick<Issue, 'type'>>(issues: T[]): T[] { - return sortBy(issues, issue => ISSUE_TYPES.indexOf(issue.type as IssueType)); + return sortBy(issues, (issue) => ISSUE_TYPES.indexOf(issue.type as IssueType)); } function injectRelational( @@ -48,9 +48,9 @@ function injectRelational( const newFields: Dict<any> = {}; const baseValue = issue[baseField]; if (baseValue !== undefined && source !== undefined) { - const lookupValue = source.find(candidate => candidate[lookupField] === baseValue); + const lookupValue = source.find((candidate) => candidate[lookupField] === baseValue); if (lookupValue != null) { - Object.keys(lookupValue).forEach(key => { + Object.keys(lookupValue).forEach((key) => { const newKey = baseField + key.charAt(0).toUpperCase() + key.slice(1); newFields[newKey] = lookupValue[key]; }); @@ -63,11 +63,11 @@ function injectCommentsRelational(issue: RawIssue, users?: UserBase[]) { if (!issue.comments) { return {}; } - const comments = issue.comments.map(comment => { + const comments = issue.comments.map((comment) => { const commentWithAuthor = { ...comment, author: comment.login, login: undefined }; return { ...commentWithAuthor, - ...injectRelational(commentWithAuthor, users, 'author', 'login') + ...injectRelational(commentWithAuthor, users, 'author', 'login'), }; }); return { comments }; @@ -86,8 +86,8 @@ function ensureTextRange(issue: RawIssue): { textRange?: TextRange } { startLine: issue.line, endLine: issue.line, startOffset: 0, - endOffset: 999999 - } + endOffset: 999999, + }, } : {}; } @@ -102,40 +102,40 @@ function splitFlows( issue: RawIssue, components: Component[] = [] ): { secondaryLocations: FlowLocation[]; flows: FlowLocation[][]; flowsWithType: Flow[] } { - if (issue.flows?.some(flow => flow.type !== undefined)) { + if (issue.flows?.some((flow) => flow.type !== undefined)) { return { flows: [], - flowsWithType: issue.flows.filter(flow => flow.type !== undefined) as Flow[], - secondaryLocations: [] + flowsWithType: issue.flows.filter((flow) => flow.type !== undefined) as Flow[], + secondaryLocations: [], }; } const parsedFlows: FlowLocation[][] = (issue.flows || []) - .filter(flow => flow.locations !== undefined) - .map(flow => flow.locations!.filter(location => location.textRange != null)) - .map(flow => - flow.map(location => { - const component = components.find(component => component.key === location.component); + .filter((flow) => flow.locations !== undefined) + .map((flow) => flow.locations!.filter((location) => location.textRange != null)) + .map((flow) => + flow.map((location) => { + const component = components.find((component) => component.key === location.component); return { ...location, componentName: component && component.name }; }) ); - const onlySecondaryLocations = parsedFlows.every(flow => flow.length === 1); + const onlySecondaryLocations = parsedFlows.every((flow) => flow.length === 1); return onlySecondaryLocations ? { secondaryLocations: orderLocations(flatten(parsedFlows)), flowsWithType: [], flows: [] } : { secondaryLocations: [], flowsWithType: [], - flows: parsedFlows.map(reverseLocations) + flows: parsedFlows.map(reverseLocations), }; } function orderLocations(locations: FlowLocation[]) { return sortBy( locations, - location => location.textRange && location.textRange.startLine, - location => location.textRange && location.textRange.startOffset + (location) => location.textRange && location.textRange.startLine, + (location) => location.textRange && location.textRange.startOffset ); } @@ -154,7 +154,7 @@ export function parseIssueFromResponse( ...injectCommentsRelational(issue, users), ...splitFlows(issue, components), ...prepareClosed(issue), - ...ensureTextRange(issue) + ...ensureTextRange(issue), } as Issue; } @@ -165,7 +165,7 @@ export const ISSUETYPE_METRIC_KEYS_MAP = { rating: MetricKey.sqale_rating, newRating: MetricKey.new_maintainability_rating, ratingName: 'Maintainability', - iconClass: CodeSmellIcon + iconClass: CodeSmellIcon, }, [IssueType.Vulnerability]: { metric: MetricKey.vulnerabilities, @@ -173,7 +173,7 @@ export const ISSUETYPE_METRIC_KEYS_MAP = { rating: MetricKey.security_rating, newRating: MetricKey.new_security_rating, ratingName: 'Security', - iconClass: VulnerabilityIcon + iconClass: VulnerabilityIcon, }, [IssueType.Bug]: { metric: MetricKey.bugs, @@ -181,7 +181,7 @@ export const ISSUETYPE_METRIC_KEYS_MAP = { rating: MetricKey.reliability_rating, newRating: MetricKey.new_reliability_rating, ratingName: 'Reliability', - iconClass: BugIcon + iconClass: BugIcon, }, [IssueType.SecurityHotspot]: { metric: MetricKey.security_hotspots, @@ -189,6 +189,6 @@ export const ISSUETYPE_METRIC_KEYS_MAP = { rating: MetricKey.security_review_rating, newRating: MetricKey.new_security_review_rating, ratingName: 'SecurityReview', - iconClass: SecurityHotspotIcon - } + iconClass: SecurityHotspotIcon, + }, }; diff --git a/server/sonar-web/src/main/js/helpers/keycodes.ts b/server/sonar-web/src/main/js/helpers/keycodes.ts index bf6c0fc0533..d84f1b79475 100644 --- a/server/sonar-web/src/main/js/helpers/keycodes.ts +++ b/server/sonar-web/src/main/js/helpers/keycodes.ts @@ -43,5 +43,5 @@ export enum KeyboardKeys { KeyC = 'c', KeyT = 't', KeyS = 's', - KeyQuestionMark = '?' + KeyQuestionMark = '?', } diff --git a/server/sonar-web/src/main/js/helpers/l10n.ts b/server/sonar-web/src/main/js/helpers/l10n.ts index 149955f2844..bf1a5969784 100644 --- a/server/sonar-web/src/main/js/helpers/l10n.ts +++ b/server/sonar-web/src/main/js/helpers/l10n.ts @@ -42,7 +42,7 @@ export function translateWithParameters( const message = getMessages()[messageKey]; if (message) { return parameters - .map(parameter => String(parameter)) + .map((parameter) => String(parameter)) .reduce((acc, parameter, index) => acc.replace(`{${index}}`, () => parameter), message); } if (process.env.NODE_ENV === 'development') { @@ -88,7 +88,7 @@ export function getShortMonthName(index: number) { 'Sep', 'Oct', 'Nov', - 'Dec' + 'Dec', ]; return translate(months[index]); } diff --git a/server/sonar-web/src/main/js/helpers/l10nBundle.ts b/server/sonar-web/src/main/js/helpers/l10nBundle.ts index fc1a4414d57..0962637f029 100644 --- a/server/sonar-web/src/main/js/helpers/l10nBundle.ts +++ b/server/sonar-web/src/main/js/helpers/l10nBundle.ts @@ -25,7 +25,7 @@ import { toNotSoISOString } from './dates'; const DEFAULT_LOCALE = 'en'; const DEFAULT_MESSAGES = { // eslint-disable-next-line camelcase - default_error_message: 'The request cannot be processed. Try again later.' + default_error_message: 'The request cannot be processed. Try again later.', }; export function getMessages() { @@ -59,11 +59,11 @@ export async function loadL10nBundle() { } } - const { effectiveLocale, messages } = await fetchL10nBundle(params).catch(response => { + const { effectiveLocale, messages } = await fetchL10nBundle(params).catch((response) => { if (response && response.status === 304) { return { effectiveLocale: cachedBundle.locale || browserLocale || DEFAULT_LOCALE, - messages: cachedBundle.messages ?? {} + messages: cachedBundle.messages ?? {}, }; } throw new Error(`Unexpected status code: ${response.status}`); @@ -72,7 +72,7 @@ export async function loadL10nBundle() { const bundle = { timestamp: toNotSoISOString(new Date()), locale: effectiveLocale, - messages + messages, }; persistL10nBundleInCache(bundle); @@ -85,9 +85,9 @@ function getPreferredLanguage() { } function getL10nBundleFromCache() { - return ((window as unknown) as any).sonarQubeL10nBundle ?? {}; + return (window as unknown as any).sonarQubeL10nBundle ?? {}; } function persistL10nBundleInCache(bundle: L10nBundle) { - ((window as unknown) as any).sonarQubeL10nBundle = bundle; + (window as unknown as any).sonarQubeL10nBundle = bundle; } diff --git a/server/sonar-web/src/main/js/helpers/measures.ts b/server/sonar-web/src/main/js/helpers/measures.ts index 31aca41f983..6580495d6f3 100644 --- a/server/sonar-web/src/main/js/helpers/measures.ts +++ b/server/sonar-web/src/main/js/helpers/measures.ts @@ -20,7 +20,7 @@ import { MetricKey } from '../types/metrics'; import { QualityGateStatusCondition, - QualityGateStatusConditionEnhanced + QualityGateStatusConditionEnhanced, } from '../types/quality-gates'; import { Dict, Measure, MeasureEnhanced, Metric } from '../types/types'; import { translate, translateWithParameters } from './l10n'; @@ -32,8 +32,8 @@ export function enhanceMeasuresWithMetrics( metrics: Metric[] ): MeasureEnhanced[] { return measures - .map(measure => { - const metric = metrics.find(metric => metric.key === measure.metric); + .map((measure) => { + const metric = metrics.find((metric) => metric.key === measure.metric); return metric && { ...measure, metric }; }) .filter(isDefined); @@ -43,7 +43,7 @@ export function enhanceConditionWithMeasure( condition: QualityGateStatusCondition, measures: MeasureEnhanced[] ): QualityGateStatusConditionEnhanced | undefined { - const measure = measures.find(m => m.metric.key === condition.metric); + const measure = measures.find((m) => m.metric.key === condition.metric); // Make sure we have a period index. This is necessary when dealing with // applications. @@ -65,11 +65,11 @@ export function isDiffMetric(metricKey: MetricKey | string): boolean { } export function getDisplayMetrics(metrics: Metric[]) { - return metrics.filter(metric => !metric.hidden && !['DATA', 'DISTRIB'].includes(metric.type)); + return metrics.filter((metric) => !metric.hidden && !['DATA', 'DISTRIB'].includes(metric.type)); } export function findMeasure(measures: MeasureEnhanced[], metric: MetricKey | string) { - return measures.find(measure => measure.metric.key === metric); + return measures.find((measure) => measure.metric.key === metric); } const HOURS_IN_DAY = 8; @@ -145,7 +145,7 @@ function getFormatter(type: string): Formatter { SHORT_WORK_DUR: shortDurationFormatter, RATING: ratingFormatter, LEVEL: levelFormatter, - MILLISEC: millisecondsFormatter + MILLISEC: millisecondsFormatter, }; return FORMATTERS[type] || noFormatter; } @@ -157,7 +157,7 @@ function numberFormatter( ) { const { format } = new Intl.NumberFormat(getCurrentLocale(), { minimumFractionDigits, - maximumFractionDigits + maximumFractionDigits, }); if (typeof value === 'string') { return format(parseFloat(value)); @@ -179,7 +179,7 @@ const shortIntFormats = [ { unit: 1e7, formatUnit: 1e6, fraction: 0, suffix: 'short_number_suffix.m' }, { unit: 1e6, formatUnit: 1e6, fraction: 1, suffix: 'short_number_suffix.m' }, { unit: 1e4, formatUnit: 1e3, fraction: 0, suffix: 'short_number_suffix.k' }, - { unit: 1e3, formatUnit: 1e3, fraction: 1, suffix: 'short_number_suffix.k' } + { unit: 1e3, formatUnit: 1e3, fraction: 1, suffix: 'short_number_suffix.k' }, ]; function shortIntFormatter( diff --git a/server/sonar-web/src/main/js/helpers/mocks/alm-integrations.ts b/server/sonar-web/src/main/js/helpers/mocks/alm-integrations.ts index 9dd557b606b..5c7178525f6 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/alm-integrations.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/alm-integrations.ts @@ -24,14 +24,14 @@ import { BitbucketProject, BitbucketRepository, GithubRepository, - GitlabProject + GitlabProject, } from '../../types/alm-integration'; export function mockAzureProject(overrides: Partial<AzureProject> = {}): AzureProject { return { name: 'azure-project-1', description: 'Azure Project', - ...overrides + ...overrides, }; } @@ -39,7 +39,7 @@ export function mockAzureRepository(overrides: Partial<AzureRepository> = {}): A return { name: 'Azure repo 1', projectName: 'Azure Project', - ...overrides + ...overrides, }; } @@ -48,7 +48,7 @@ export function mockBitbucketProject(overrides: Partial<BitbucketProject> = {}): id: 1, key: 'project', name: 'Project', - ...overrides + ...overrides, }; } @@ -60,7 +60,7 @@ export function mockBitbucketRepository( slug: 'project__repo', name: 'Repo', projectKey: 'project', - ...overrides + ...overrides, }; } @@ -73,7 +73,7 @@ export function mockBitbucketCloudRepository( name: 'Repo', projectKey: 'project', workspace: 'worksapce', - ...overrides + ...overrides, }; } @@ -84,7 +84,7 @@ export function mockGitHubRepository(overrides: Partial<GithubRepository> = {}): name: 'repository 1', sqProjectKey: '', url: 'https://github.com/owner/repo1', - ...overrides + ...overrides, }; } @@ -97,6 +97,6 @@ export function mockGitlabProject(overrides: Partial<GitlabProject> = {}): Gitla pathSlug: 'company/best-projects', sqProjectKey: '', url: 'https://gitlab.company.com/best-projects/awesome-project-exclamation', - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts b/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts index 6a18e18b904..d49274ca6da 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts @@ -34,7 +34,7 @@ import { ProjectBitbucketBindingResponse, ProjectBitbucketCloudBindingResponse, ProjectGitHubBindingResponse, - ProjectGitLabBindingResponse + ProjectGitLabBindingResponse, } from '../../types/alm-settings'; export function mockAlmSettingsInstance( @@ -43,7 +43,7 @@ export function mockAlmSettingsInstance( return { alm: AlmKeys.GitHub, key: 'key', - ...overrides + ...overrides, }; } @@ -53,7 +53,7 @@ export function mockBitbucketCloudAlmSettingsInstance( return { alm: AlmKeys.BitbucketCloud, key: 'key', - ...overrides + ...overrides, }; } @@ -63,7 +63,7 @@ export function mockAzureBindingDefinition( return { key: 'key', personalAccessToken: 'asdf1234', - ...overrides + ...overrides, }; } @@ -74,7 +74,7 @@ export function mockBitbucketServerBindingDefinition( key: 'key', personalAccessToken: 'asdf1234', url: 'http://bbs.enterprise.com', - ...overrides + ...overrides, }; } @@ -86,7 +86,7 @@ export function mockBitbucketCloudBindingDefinition( clientId: 'client1', clientSecret: '**clientsecret**', workspace: 'workspace', - ...overrides + ...overrides, }; } @@ -101,7 +101,7 @@ export function mockGithubBindingDefinition( clientSecret: '**clientsecret**', privateKey: 'asdf1234', webhookSecret: 'verySecretText!!', - ...overrides + ...overrides, }; } @@ -111,7 +111,7 @@ export function mockGitlabBindingDefinition( return { key: 'foo', personalAccessToken: 'foobar', - ...overrides + ...overrides, }; } @@ -122,7 +122,7 @@ export function mockProjectAlmBindingResponse( alm: AlmKeys.GitHub, key: 'foo', monorepo: false, - ...overrides + ...overrides, }; } @@ -135,7 +135,7 @@ export function mockProjectBitbucketBindingResponse( repository: 'PROJECT_KEY', slug: 'repo-slug', monorepo: true, - ...overrides + ...overrides, }; } @@ -147,7 +147,7 @@ export function mockProjectBitbucketCloudBindingResponse( key: 'foo', repository: 'repo-slug', monorepo: true, - ...overrides + ...overrides, }; } @@ -159,7 +159,7 @@ export function mockProjectGithubBindingResponse( key: 'foo', repository: 'PROJECT_KEY', monorepo: true, - ...overrides + ...overrides, }; } @@ -172,7 +172,7 @@ export function mockProjectGitLabBindingResponse( repository: 'PROJECT_KEY', url: 'https://gitlab.com/api/v4', monorepo: true, - ...overrides + ...overrides, }; } @@ -186,7 +186,7 @@ export function mockProjectAzureBindingResponse( repository: 'REPOSITORY_NAME', url: 'https://ado.my_company.com/mycollection', monorepo: false, - ...overrides + ...overrides, }; } @@ -197,7 +197,7 @@ export function mockAlmSettingsBindingStatus( alertSuccess: false, failureMessage: '', type: AlmSettingsBindingStatusType.Validating, - ...overrides + ...overrides, }; } @@ -207,6 +207,6 @@ export function mockProjectAlmBindingConfigurationErrors( return { scope: ProjectAlmBindingConfigurationErrorScope.Global, errors: [{ msg: 'Foo bar is not correct' }, { msg: 'Bar baz has no permissions here' }], - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/application.ts b/server/sonar-web/src/main/js/helpers/mocks/application.ts index c74b481c16d..c7e83454a02 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/application.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/application.ts @@ -26,6 +26,6 @@ export function mockApplicationPeriod( date: '2017-10-01', project: 'foo', projectName: 'Foo', - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/branch-like.ts b/server/sonar-web/src/main/js/helpers/mocks/branch-like.ts index 15a2e52a562..01c97e841cc 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/branch-like.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/branch-like.ts @@ -25,7 +25,7 @@ export function mockBranch(overrides: Partial<Branch> = {}): Branch { excludedFromPurge: true, isMain: false, name: 'branch-6.7', - ...overrides + ...overrides, }; } @@ -33,7 +33,7 @@ export function mockMainBranch(overrides: Partial<MainBranch> = {}): MainBranch return mockBranch({ isMain: true, name: 'master', - ...overrides + ...overrides, }) as MainBranch; } @@ -45,7 +45,7 @@ export function mockPullRequest(overrides: Partial<PullRequest> = {}): PullReque key: '1001', target: 'master', title: 'Foo Bar feature', - ...overrides + ...overrides, }; } @@ -59,6 +59,6 @@ export function mockSetOfBranchAndPullRequest(): BranchLike[] { mockPullRequest({ key: '2', title: 'PR-2' }), mockBranch({ name: 'branch-3' }), mockBranch({ name: 'branch-2' }), - mockPullRequest({ key: '2', title: 'PR-2', target: 'llb-100', isOrphan: true }) + mockPullRequest({ key: '2', title: 'PR-2', target: 'llb-100', isOrphan: true }), ]; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/component-report.ts b/server/sonar-web/src/main/js/helpers/mocks/component-report.ts index 2db36253ad4..84017a4376a 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/component-report.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/component-report.ts @@ -30,6 +30,6 @@ export function mockComponentReportStatus( globalFrequency: '', globalRecipients: [], subscribed: false, - ...props + ...props, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/component.ts b/server/sonar-web/src/main/js/helpers/mocks/component.ts index 4919a31694e..cda74a493d7 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/component.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/component.ts @@ -34,11 +34,11 @@ export function mockComponent(overrides: Partial<Component> = {}): Component { deleted: false, key: 'my-qp', language: 'ts', - name: 'Sonar way' - } + name: 'Sonar way', + }, ], tags: [], - ...overrides + ...overrides, }; } @@ -48,7 +48,7 @@ export function mockTreeComponent(overrides: Partial<TreeComponent>): TreeCompon qualifier: ComponentQualifier.Project, name: 'component', visibility: Visibility.Public, - ...overrides + ...overrides, }; } @@ -63,7 +63,7 @@ export function mockComponentMeasure( qualifier: ComponentQualifier.File, path: 'src/index.tsx', measures: [{ metric: MetricKey.bugs, value: '1', bestValue: false }], - ...overrides + ...overrides, }; } return { @@ -71,7 +71,7 @@ export function mockComponentMeasure( name: 'Foo', qualifier: ComponentQualifier.Project, measures: [{ metric: MetricKey.bugs, value: '12', bestValue: false }], - ...overrides + ...overrides, }; } @@ -83,6 +83,6 @@ export function mockComponentMeasureEnhanced( leak: undefined, measures: [mockMeasureEnhanced()], value: undefined, - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/dom.ts b/server/sonar-web/src/main/js/helpers/mocks/dom.ts index e85d59f31c8..8559747c3ff 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/dom.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/dom.ts @@ -28,8 +28,8 @@ export function mockHtmlElement<T extends Element>(overrides: Partial<T> = {}): top: 10, x: 12, y: 23, - toJSON: () => '' + toJSON: () => '', }), - ...overrides + ...overrides, } as T; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/editions.ts b/server/sonar-web/src/main/js/helpers/mocks/editions.ts index 58fb0b759cb..806f6db11b1 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/editions.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/editions.ts @@ -36,6 +36,6 @@ export function mockLicense(override?: Partial<License>) { remainingLocThreshold: 490000, serverId: 'AU-TpxcA-iU5OvuD2FL0', type: 'production', - ...override + ...override, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/issues.ts b/server/sonar-web/src/main/js/helpers/mocks/issues.ts index d16f82425f2..27e0cc39914 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/issues.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/issues.ts @@ -24,7 +24,7 @@ export function mockReferencedRule(overrides: Partial<ReferencedRule> = {}): Ref return { langName: 'Javascript', name: 'RuleFoo', - ...overrides + ...overrides, }; } @@ -38,9 +38,9 @@ export function mockIssueChangelog(overrides: Partial<IssueChangelog> = {}): Iss { key: 'assign', newValue: 'darth.vader', - oldValue: 'luke.skywalker' - } + oldValue: 'luke.skywalker', + }, ], - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/metrics.ts b/server/sonar-web/src/main/js/helpers/mocks/metrics.ts index 57a8cc82fd3..6cf919fea76 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/metrics.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/metrics.ts @@ -28,7 +28,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, blocker_violations: { id: 'AXJMbIl_PAOIsUIE3gtt', @@ -39,7 +39,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, bugs: { id: 'AXJMbIl_PAOIsUIE3gt_', @@ -50,7 +50,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: -1, qualitative: false, - hidden: false + hidden: false, }, classes: { id: 'AXJMbImPPAOIsUIE3gu5', @@ -61,7 +61,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, code_smells: { id: 'AXJMbIl_PAOIsUIE3gt9', @@ -72,7 +72,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: -1, qualitative: false, - hidden: false + hidden: false, }, cognitive_complexity: { id: 'AXJMbIl9PAOIsUIE3gtZ', @@ -83,7 +83,7 @@ export const DEFAULT_METRICS = { domain: 'Complexity', direction: -1, qualitative: false, - hidden: false + hidden: false, }, comment_lines: { id: 'AXJMbImPPAOIsUIE3gup', @@ -94,7 +94,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: 1, qualitative: false, - hidden: false + hidden: false, }, comment_lines_data: { id: 'AXJMbImPPAOIsUIE3guV', @@ -104,7 +104,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: 0, qualitative: false, - hidden: true + hidden: true, }, comment_lines_density: { id: 'AXJMbImPPAOIsUIE3guq', @@ -116,7 +116,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, class_complexity: { id: 'AXJMbImPPAOIsUIE3guw', @@ -128,7 +128,7 @@ export const DEFAULT_METRICS = { direction: -1, qualitative: true, hidden: true, - decimalScale: 1 + decimalScale: 1, }, file_complexity: { id: 'AXJMbImPPAOIsUIE3guu', @@ -140,7 +140,7 @@ export const DEFAULT_METRICS = { direction: -1, qualitative: true, hidden: true, - decimalScale: 1 + decimalScale: 1, }, function_complexity: { id: 'AXJMbImPPAOIsUIE3guy', @@ -152,7 +152,7 @@ export const DEFAULT_METRICS = { direction: -1, qualitative: true, hidden: true, - decimalScale: 1 + decimalScale: 1, }, complexity_in_classes: { id: 'AXJMbImPPAOIsUIE3guv', @@ -163,7 +163,7 @@ export const DEFAULT_METRICS = { domain: 'Complexity', direction: -1, qualitative: false, - hidden: true + hidden: true, }, complexity_in_functions: { id: 'AXJMbImPPAOIsUIE3gux', @@ -174,7 +174,7 @@ export const DEFAULT_METRICS = { domain: 'Complexity', direction: -1, qualitative: false, - hidden: true + hidden: true, }, branch_coverage: { id: 'AXJMbIl9PAOIsUIE3gs-', @@ -186,7 +186,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, new_branch_coverage: { id: 'AXJMbIl9PAOIsUIE3gs_', @@ -198,7 +198,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, conditions_to_cover: { id: 'AXJMbIl9PAOIsUIE3gqt', @@ -209,7 +209,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: false, - hidden: false + hidden: false, }, new_conditions_to_cover: { id: 'AXJMbIl9PAOIsUIE3gs7', @@ -220,7 +220,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: false, - hidden: false + hidden: false, }, confirmed_issues: { id: 'AXJMbIl_PAOIsUIE3gt8', @@ -231,7 +231,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, coverage: { id: 'AXJMbIl9PAOIsUIE3gtg', @@ -243,7 +243,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, new_coverage: { id: 'AXJMbIl_PAOIsUIE3gth', @@ -255,7 +255,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, critical_violations: { id: 'AXJMbIl_PAOIsUIE3gtu', @@ -266,7 +266,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, complexity: { id: 'AXJMbImPPAOIsUIE3gut', @@ -277,7 +277,7 @@ export const DEFAULT_METRICS = { domain: 'Complexity', direction: -1, qualitative: false, - hidden: false + hidden: false, }, last_commit_date: { id: 'AXJMbImPPAOIsUIE3gua', @@ -287,7 +287,7 @@ export const DEFAULT_METRICS = { domain: 'SCM', direction: 0, qualitative: false, - hidden: true + hidden: true, }, development_cost: { id: 'AXJMbIl_PAOIsUIE3guI', @@ -298,7 +298,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: -1, qualitative: true, - hidden: true + hidden: true, }, new_development_cost: { id: 'AXJMbIl_PAOIsUIE3guJ', @@ -310,7 +310,7 @@ export const DEFAULT_METRICS = { direction: -1, qualitative: true, hidden: true, - decimalScale: 1 + decimalScale: 1, }, directories: { id: 'AXJMbImPPAOIsUIE3gu9', @@ -321,7 +321,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, duplicated_blocks: { id: 'AXJMbIl9PAOIsUIE3gsu', @@ -332,7 +332,7 @@ export const DEFAULT_METRICS = { domain: 'Duplications', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_duplicated_blocks: { id: 'AXJMbIl_PAOIsUIE3gto', @@ -343,7 +343,7 @@ export const DEFAULT_METRICS = { domain: 'Duplications', direction: -1, qualitative: true, - hidden: false + hidden: false, }, duplicated_files: { id: 'AXJMbImPPAOIsUIE3gvA', @@ -354,7 +354,7 @@ export const DEFAULT_METRICS = { domain: 'Duplications', direction: -1, qualitative: true, - hidden: false + hidden: false, }, duplicated_lines: { id: 'AXJMbIl9PAOIsUIE3gss', @@ -365,7 +365,7 @@ export const DEFAULT_METRICS = { domain: 'Duplications', direction: -1, qualitative: true, - hidden: false + hidden: false, }, duplicated_lines_density: { id: 'AXJMbIl_PAOIsUIE3gtp', @@ -377,7 +377,7 @@ export const DEFAULT_METRICS = { direction: -1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, new_duplicated_lines_density: { id: 'AXJMbIl_PAOIsUIE3gtq', @@ -389,7 +389,7 @@ export const DEFAULT_METRICS = { direction: -1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, new_duplicated_lines: { id: 'AXJMbIl9PAOIsUIE3gst', @@ -400,7 +400,7 @@ export const DEFAULT_METRICS = { domain: 'Duplications', direction: -1, qualitative: true, - hidden: false + hidden: false, }, duplications_data: { id: 'AXJMbIl_PAOIsUIE3gtr', @@ -411,7 +411,7 @@ export const DEFAULT_METRICS = { domain: 'Duplications', direction: 0, qualitative: false, - hidden: false + hidden: false, }, effort_to_reach_maintainability_rating_a: { id: 'AXJMbIl_PAOIsUIE3guM', @@ -422,7 +422,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, executable_lines_data: { id: 'AXJMbImPPAOIsUIE3guW', @@ -432,7 +432,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: 0, qualitative: false, - hidden: true + hidden: true, }, false_positive_issues: { id: 'AXJMbIl_PAOIsUIE3gt4', @@ -443,7 +443,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: false, - hidden: false + hidden: false, }, file_complexity_distribution: { id: 'AXJMbIl9PAOIsUIE3gtY', @@ -454,7 +454,7 @@ export const DEFAULT_METRICS = { domain: 'Complexity', direction: 0, qualitative: true, - hidden: true + hidden: true, }, files: { id: 'AXJMbImPPAOIsUIE3gu6', @@ -465,7 +465,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, function_complexity_distribution: { id: 'AXJMbIl9PAOIsUIE3gtX', @@ -476,7 +476,7 @@ export const DEFAULT_METRICS = { domain: 'Complexity', direction: 0, qualitative: true, - hidden: true + hidden: true, }, functions: { id: 'AXJMbImPPAOIsUIE3gu-', @@ -487,7 +487,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, generated_lines: { id: 'AXJMbImPPAOIsUIE3gu0', @@ -498,7 +498,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, generated_ncloc: { id: 'AXJMbImPPAOIsUIE3gu4', @@ -509,7 +509,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, info_violations: { id: 'AXJMbIl_PAOIsUIE3gtx', @@ -520,7 +520,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: 0, qualitative: true, - hidden: false + hidden: false, }, violations: { id: 'AXJMbImPPAOIsUIE3gul', @@ -531,7 +531,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, last_change_on_maintainability_rating: { id: 'AXJMbImPPAOIsUIE3gud', @@ -541,7 +541,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: 0, qualitative: false, - hidden: true + hidden: true, }, last_change_on_releasability_rating: { id: 'AXJMbImPPAOIsUIE3gue', @@ -551,7 +551,7 @@ export const DEFAULT_METRICS = { domain: 'Releasability', direction: 0, qualitative: false, - hidden: true + hidden: true, }, last_change_on_reliability_rating: { id: 'AXJMbImPPAOIsUIE3guf', @@ -561,7 +561,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: 0, qualitative: false, - hidden: true + hidden: true, }, last_change_on_security_rating: { id: 'AXJMbImPPAOIsUIE3gug', @@ -571,7 +571,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: 0, qualitative: false, - hidden: true + hidden: true, }, last_change_on_security_review_rating: { id: 'AXJMbIl9PAOIsUIE3gs4', @@ -581,7 +581,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: 0, qualitative: false, - hidden: true + hidden: true, }, line_coverage: { id: 'AXJMbIl_PAOIsUIE3gtl', @@ -593,7 +593,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, new_line_coverage: { id: 'AXJMbIl_PAOIsUIE3gtm', @@ -605,7 +605,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, lines: { id: 'AXJMbImPPAOIsUIE3guz', @@ -616,7 +616,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, ncloc: { id: 'AXJMbImPPAOIsUIE3gu1', @@ -627,7 +627,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, ncloc_language_distribution: { id: 'AXJMbImPPAOIsUIE3gu3', @@ -638,7 +638,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, lines_to_cover: { id: 'AXJMbImPPAOIsUIE3gu_', @@ -649,7 +649,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: false, - hidden: false + hidden: false, }, new_lines_to_cover: { id: 'AXJMbIl_PAOIsUIE3gti', @@ -660,7 +660,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: false, - hidden: false + hidden: false, }, leak_projects: { id: 'AXJMbImPPAOIsUIE3gvE', @@ -669,7 +669,7 @@ export const DEFAULT_METRICS = { name: 'List of technical projects with their leaks', direction: 0, qualitative: false, - hidden: true + hidden: true, }, sqale_rating: { id: 'AXJMbIl_PAOIsUIE3guF', @@ -680,7 +680,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: 0, qualitative: true, - hidden: false + hidden: false, }, maintainability_rating_distribution: { id: 'AX6QkqP7zEziun0YBqmh', @@ -691,7 +691,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: -1, qualitative: true, - hidden: true + hidden: true, }, new_maintainability_rating_distribution: { id: 'AX6QkqP8zEziun0YBqml', @@ -702,7 +702,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: -1, qualitative: true, - hidden: true + hidden: true, }, new_maintainability_rating: { id: 'AXJMbIl_PAOIsUIE3guH', @@ -713,7 +713,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, major_violations: { id: 'AXJMbIl_PAOIsUIE3gtv', @@ -724,7 +724,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, minor_violations: { id: 'AXJMbIl_PAOIsUIE3gtw', @@ -735,7 +735,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, ncloc_data: { id: 'AXJMbImPPAOIsUIE3guU', @@ -745,7 +745,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: 0, qualitative: false, - hidden: true + hidden: true, }, new_blocker_violations: { id: 'AXJMbIl_PAOIsUIE3gtz', @@ -756,7 +756,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_bugs: { id: 'AXJMbIl_PAOIsUIE3guA', @@ -767,7 +767,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_code_smells: { id: 'AXJMbIl_PAOIsUIE3gt-', @@ -778,7 +778,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_critical_violations: { id: 'AXJMbIl_PAOIsUIE3gt0', @@ -789,7 +789,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_info_violations: { id: 'AXJMbIl_PAOIsUIE3gt3', @@ -800,7 +800,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_violations: { id: 'AXJMbIl_PAOIsUIE3gty', @@ -811,7 +811,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_lines: { id: 'AXJMbImPPAOIsUIE3gu2', @@ -822,7 +822,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, new_major_violations: { id: 'AXJMbIl_PAOIsUIE3gt1', @@ -833,7 +833,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_minor_violations: { id: 'AXJMbIl_PAOIsUIE3gt2', @@ -844,7 +844,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_security_hotspots: { id: 'AXJMbIl9PAOIsUIE3gsw', @@ -855,7 +855,7 @@ export const DEFAULT_METRICS = { domain: 'SecurityReview', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_vulnerabilities: { id: 'AXJMbIl_PAOIsUIE3guC', @@ -866,7 +866,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: true, - hidden: false + hidden: false, }, unanalyzed_c: { id: 'AXTb6RMqLLQlB5osv3xN', @@ -876,7 +876,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: true + hidden: true, }, unanalyzed_cpp: { id: 'AXTb6RMtLLQlB5osv3xO', @@ -886,7 +886,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: true + hidden: true, }, open_issues: { id: 'AXJMbIl_PAOIsUIE3gt6', @@ -897,7 +897,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: false, - hidden: false + hidden: false, }, quality_profiles: { id: 'AXJMbImPPAOIsUIE3guZ', @@ -908,7 +908,7 @@ export const DEFAULT_METRICS = { domain: 'General', direction: 0, qualitative: false, - hidden: true + hidden: true, }, projects: { id: 'AXJMbImPPAOIsUIE3guo', @@ -919,7 +919,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, public_api: { id: 'AXJMbImPPAOIsUIE3gun', @@ -930,7 +930,7 @@ export const DEFAULT_METRICS = { domain: 'Documentation', direction: -1, qualitative: false, - hidden: true + hidden: true, }, public_documented_api_density: { id: 'AXJMbImPPAOIsUIE3gur', @@ -942,7 +942,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: true, - decimalScale: 1 + decimalScale: 1, }, public_undocumented_api: { id: 'AXJMbImPPAOIsUIE3gus', @@ -953,7 +953,7 @@ export const DEFAULT_METRICS = { domain: 'Documentation', direction: -1, qualitative: true, - hidden: true + hidden: true, }, quality_gate_details: { id: 'AXJMbImPPAOIsUIE3guY', @@ -964,7 +964,7 @@ export const DEFAULT_METRICS = { domain: 'General', direction: 0, qualitative: false, - hidden: false + hidden: false, }, alert_status: { id: 'AXJMbImPPAOIsUIE3guX', @@ -975,7 +975,7 @@ export const DEFAULT_METRICS = { domain: 'Releasability', direction: 1, qualitative: true, - hidden: false + hidden: false, }, releasability_rating: { id: 'AXJMbImPPAOIsUIE3guc', @@ -985,7 +985,7 @@ export const DEFAULT_METRICS = { domain: 'Releasability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, releasability_rating_distribution: { id: 'AX6QkqP7zEziun0YBqmg', @@ -996,7 +996,7 @@ export const DEFAULT_METRICS = { domain: 'Releasability', direction: -1, qualitative: true, - hidden: true + hidden: true, }, reliability_rating: { id: 'AXJMbIl_PAOIsUIE3guP', @@ -1007,7 +1007,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, reliability_rating_distribution: { id: 'AX6QkqP7zEziun0YBqmi', @@ -1018,7 +1018,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: -1, qualitative: true, - hidden: true + hidden: true, }, new_reliability_rating_distribution: { id: 'AX6QkqP8zEziun0YBqmm', @@ -1029,7 +1029,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: -1, qualitative: true, - hidden: true + hidden: true, }, new_reliability_rating: { id: 'AXJMbIl_PAOIsUIE3guQ', @@ -1040,7 +1040,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, reliability_remediation_effort: { id: 'AXJMbIl_PAOIsUIE3guN', @@ -1051,7 +1051,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_reliability_remediation_effort: { id: 'AXJMbIl_PAOIsUIE3guO', @@ -1062,7 +1062,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, reopened_issues: { id: 'AXJMbIl_PAOIsUIE3gt7', @@ -1073,7 +1073,7 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: true, - hidden: false + hidden: false, }, security_hotspots: { id: 'AXJMbIl9PAOIsUIE3gsv', @@ -1084,7 +1084,7 @@ export const DEFAULT_METRICS = { domain: 'SecurityReview', direction: -1, qualitative: false, - hidden: false + hidden: false, }, security_hotspots_reviewed: { id: 'AXJMbIl9PAOIsUIE3gs0', @@ -1096,7 +1096,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, new_security_hotspots_reviewed: { id: 'AXJMbIl9PAOIsUIE3gs1', @@ -1108,7 +1108,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, security_rating: { id: 'AXJMbIl_PAOIsUIE3guS', @@ -1119,7 +1119,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: true, - hidden: false + hidden: false, }, security_rating_distribution: { id: 'AX6QkqP7zEziun0YBqmj', @@ -1130,7 +1130,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: true, - hidden: true + hidden: true, }, new_security_rating_distribution: { id: 'AX6QkqP8zEziun0YBqmn', @@ -1141,7 +1141,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: true, - hidden: true + hidden: true, }, new_security_rating: { id: 'AXJMbImPPAOIsUIE3guT', @@ -1152,7 +1152,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: true, - hidden: false + hidden: false, }, security_remediation_effort: { id: 'AXJMbIl_PAOIsUIE3guG', @@ -1163,7 +1163,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: true, - hidden: false + hidden: false, }, new_security_remediation_effort: { id: 'AXJMbIl_PAOIsUIE3guR', @@ -1174,7 +1174,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: true, - hidden: false + hidden: false, }, security_review_rating: { id: 'AXJMbIl9PAOIsUIE3gsx', @@ -1185,7 +1185,7 @@ export const DEFAULT_METRICS = { domain: 'SecurityReview', direction: -1, qualitative: true, - hidden: false + hidden: false, }, security_review_rating_distribution: { id: 'AX6QkqP8zEziun0YBqmk', @@ -1196,7 +1196,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: true, - hidden: true + hidden: true, }, new_security_review_rating_distribution: { id: 'AX6QkqP8zEziun0YBqmo', @@ -1207,7 +1207,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: true, - hidden: true + hidden: true, }, new_security_review_rating: { id: 'AXJMbIl9PAOIsUIE3gtA', @@ -1218,7 +1218,7 @@ export const DEFAULT_METRICS = { domain: 'SecurityReview', direction: -1, qualitative: true, - hidden: false + hidden: false, }, security_hotspots_reviewed_status: { id: 'AXJMbIl9PAOIsUIE3gs2', @@ -1229,7 +1229,7 @@ export const DEFAULT_METRICS = { domain: 'SecurityReview', direction: -1, qualitative: false, - hidden: true + hidden: true, }, new_security_hotspots_reviewed_status: { id: 'AXJMbIl9PAOIsUIE3gtB', @@ -1240,7 +1240,7 @@ export const DEFAULT_METRICS = { domain: 'SecurityReview', direction: -1, qualitative: false, - hidden: true + hidden: true, }, security_hotspots_to_review_status: { id: 'AXJMbIl9PAOIsUIE3gs3', @@ -1251,7 +1251,7 @@ export const DEFAULT_METRICS = { domain: 'SecurityReview', direction: -1, qualitative: false, - hidden: true + hidden: true, }, new_security_hotspots_to_review_status: { id: 'AXJMbIl9PAOIsUIE3gs5', @@ -1262,7 +1262,7 @@ export const DEFAULT_METRICS = { domain: 'SecurityReview', direction: -1, qualitative: false, - hidden: true + hidden: true, }, skipped_tests: { id: 'AXJMbIl9PAOIsUIE3gtd', @@ -1273,7 +1273,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: true, - hidden: false + hidden: false, }, statements: { id: 'AXJMbImPPAOIsUIE3gum', @@ -1284,7 +1284,7 @@ export const DEFAULT_METRICS = { domain: 'Size', direction: -1, qualitative: false, - hidden: false + hidden: false, }, sqale_index: { id: 'AXJMbIl_PAOIsUIE3guD', @@ -1296,7 +1296,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: -1, qualitative: true, - hidden: false + hidden: false, }, sqale_debt_ratio: { id: 'AXJMbIl_PAOIsUIE3guK', @@ -1309,7 +1309,7 @@ export const DEFAULT_METRICS = { direction: -1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, new_sqale_debt_ratio: { id: 'AXJMbIl_PAOIsUIE3guL', @@ -1321,7 +1321,7 @@ export const DEFAULT_METRICS = { direction: -1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, maintainability_rating_effort: { id: 'AXJMbImPPAOIsUIE3gvD', @@ -1331,7 +1331,7 @@ export const DEFAULT_METRICS = { domain: 'Maintainability', direction: 0, qualitative: false, - hidden: true + hidden: true, }, reliability_rating_effort: { id: 'AXJMbImPPAOIsUIE3gvC', @@ -1341,7 +1341,7 @@ export const DEFAULT_METRICS = { domain: 'Reliability', direction: 0, qualitative: false, - hidden: true + hidden: true, }, security_rating_effort: { id: 'AXJMbImPPAOIsUIE3gvB', @@ -1351,7 +1351,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: 0, qualitative: false, - hidden: true + hidden: true, }, security_review_rating_effort: { id: 'AXJMbIl9PAOIsUIE3gs6', @@ -1361,7 +1361,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: 0, qualitative: false, - hidden: true + hidden: true, }, releasability_effort: { id: 'AXJMbImPPAOIsUIE3gub', @@ -1371,7 +1371,7 @@ export const DEFAULT_METRICS = { domain: 'Releasability', direction: -1, qualitative: true, - hidden: true + hidden: true, }, uncovered_conditions: { id: 'AXJMbIl9PAOIsUIE3gs8', @@ -1382,7 +1382,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: false, - hidden: false + hidden: false, }, new_uncovered_conditions: { id: 'AXJMbIl9PAOIsUIE3gs9', @@ -1393,7 +1393,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: false, - hidden: false + hidden: false, }, uncovered_lines: { id: 'AXJMbIl_PAOIsUIE3gtj', @@ -1404,7 +1404,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: false, - hidden: false + hidden: false, }, new_uncovered_lines: { id: 'AXJMbIl_PAOIsUIE3gtk', @@ -1415,7 +1415,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: false, - hidden: false + hidden: false, }, test_execution_time: { id: 'AXJMbIl9PAOIsUIE3gtb', @@ -1426,7 +1426,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: false, - hidden: false + hidden: false, }, test_errors: { id: 'AXJMbIl9PAOIsUIE3gtc', @@ -1437,7 +1437,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: true, - hidden: false + hidden: false, }, test_failures: { id: 'AXJMbIl9PAOIsUIE3gte', @@ -1448,7 +1448,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: -1, qualitative: true, - hidden: false + hidden: false, }, tests: { id: 'AXJMbIl9PAOIsUIE3gta', @@ -1459,7 +1459,7 @@ export const DEFAULT_METRICS = { domain: 'Coverage', direction: 1, qualitative: false, - hidden: false + hidden: false, }, test_success_density: { id: 'AXJMbIl9PAOIsUIE3gtf', @@ -1471,7 +1471,7 @@ export const DEFAULT_METRICS = { direction: 1, qualitative: true, hidden: false, - decimalScale: 1 + decimalScale: 1, }, vulnerabilities: { id: 'AXJMbIl_PAOIsUIE3guB', @@ -1482,7 +1482,7 @@ export const DEFAULT_METRICS = { domain: 'Security', direction: -1, qualitative: false, - hidden: false + hidden: false, }, wont_fix_issues: { id: 'AXJMbIl_PAOIsUIE3gt5', @@ -1493,6 +1493,6 @@ export const DEFAULT_METRICS = { domain: 'Issues', direction: -1, qualitative: false, - hidden: false - } + hidden: false, + }, }; diff --git a/server/sonar-web/src/main/js/helpers/mocks/permissions.ts b/server/sonar-web/src/main/js/helpers/mocks/permissions.ts index a3fc50e6cfe..594069e3ac1 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/permissions.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/permissions.ts @@ -24,7 +24,7 @@ export function mockPermissionGroup(overrides: Partial<PermissionGroup> = {}): P return { name: 'sonar-admins', permissions: ['provisioning'], - ...overrides + ...overrides, }; } @@ -34,6 +34,6 @@ export function mockPermissionUser(overrides: Partial<PermissionUser> = {}): Per active: true, name: 'johndoe', permissions: ['provisioning'], - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/plugins.ts b/server/sonar-web/src/main/js/helpers/mocks/plugins.ts index 654cea8d3c4..38d3f93f612 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/plugins.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/plugins.ts @@ -23,14 +23,14 @@ import { PendingPlugin, Plugin, Release, - Update + Update, } from '../../types/plugins'; export function mockPlugin(overrides: Partial<Plugin> = {}): Plugin { return { key: 'sonar-foo', name: 'Sonar Foo', - ...overrides + ...overrides, }; } @@ -40,7 +40,7 @@ export function mockPendingPlugin(overrides: Partial<PendingPlugin> = {}): Pendi name: 'Sonar Foo', version: '1.0', implementationBuild: '1.0.0.1234', - ...overrides + ...overrides, }; } @@ -54,7 +54,7 @@ export function mockInstalledPlugin(overrides: Partial<InstalledPlugin> = {}): I hash: 'hash', sonarLintSupported: false, updatedAt: 100, - ...overrides + ...overrides, }; } @@ -63,7 +63,7 @@ export function mockAvailablePlugin(overrides: Partial<AvailablePlugin> = {}): A release: mockRelease(), update: mockUpdate(), ...mockPlugin(), - ...overrides + ...overrides, }; } @@ -71,7 +71,7 @@ export function mockRelease(overrides: Partial<Release> = {}): Release { return { date: '2020-01-01', version: '8.2', - ...overrides + ...overrides, }; } @@ -79,6 +79,6 @@ export function mockUpdate(overrides: Partial<Update> = {}): Update { return { status: 'available', requires: [], - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts b/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts index c8c366bdea3..2c709a7759c 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts @@ -23,7 +23,7 @@ import { AnalysisEvent, HistoryItem, MeasureHistory, - ParsedAnalysis + ParsedAnalysis, } from '../../types/project-activity'; import { parseDate } from '../dates'; @@ -33,7 +33,7 @@ export function mockAnalysis(overrides: Partial<Analysis> = {}): Analysis { events: [], key: 'foo', projectVersion: '1.0', - ...overrides + ...overrides, }; } @@ -43,7 +43,7 @@ export function mockParsedAnalysis(overrides: Partial<ParsedAnalysis> = {}): Par events: [], key: 'foo', projectVersion: '1.0', - ...overrides + ...overrides, }; } @@ -60,16 +60,16 @@ export function mockAnalysisEvent(overrides: Partial<AnalysisEvent> = {}): Analy { key: 'foo', name: 'Foo', - branch: 'master' + branch: 'master', }, { key: 'bar', name: 'Bar', - branch: 'feature/bar' - } - ] + branch: 'feature/bar', + }, + ], }, - ...overrides + ...overrides, }; } @@ -79,9 +79,9 @@ export function mockMeasureHistory(overrides: Partial<MeasureHistory> = {}): Mea history: [ mockHistoryItem(), mockHistoryItem({ date: parseDate('2018-10-27T12:21:15+0200'), value: '1749' }), - mockHistoryItem({ date: parseDate('2020-10-27T16:33:50+0200'), value: '500' }) + mockHistoryItem({ date: parseDate('2020-10-27T16:33:50+0200'), value: '500' }), ], - ...overrides + ...overrides, }; } @@ -89,6 +89,6 @@ export function mockHistoryItem(overrides: Partial<HistoryItem> = {}): HistoryIt return { date: parseDate('2016-10-26T12:17:29+0200'), value: '2286', - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/projects.ts b/server/sonar-web/src/main/js/helpers/mocks/projects.ts index d4c58976920..93b715030f1 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/projects.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/projects.ts @@ -28,6 +28,6 @@ export function mockProject(overrides: Partial<Project> = {}): Project { qualifier: ComponentQualifier.Project, tags: [], visibility: 'public', - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts b/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts index addc3771126..57231e3b603 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts @@ -22,7 +22,7 @@ import { QualityGateProjectStatus, QualityGateStatus, QualityGateStatusCondition, - QualityGateStatusConditionEnhanced + QualityGateStatusConditionEnhanced, } from '../../types/quality-gates'; import { QualityGate } from '../../types/types'; import { mockMeasureEnhanced, mockMetric } from '../testMocks'; @@ -31,7 +31,7 @@ export function mockQualityGate(overrides: Partial<QualityGate> = {}): QualityGa return { id: '1', name: 'qualitygate', - ...overrides + ...overrides, }; } @@ -44,7 +44,7 @@ export function mockQualityGateStatus( key: 'foo', name: 'Foo', status: 'ERROR', - ...overrides + ...overrides, }; } @@ -57,7 +57,7 @@ export function mockQualityGateStatusCondition( level: 'ERROR', metric: 'foo', op: 'GT', - ...overrides + ...overrides, }; } @@ -71,7 +71,7 @@ export function mockQualityGateStatusConditionEnhanced( metric: 'foo', op: 'GT', measure: mockMeasureEnhanced({ ...(overrides.measure || {}) }), - ...overrides + ...overrides, }; } @@ -86,12 +86,12 @@ export function mockQualityGateProjectStatus( errorThreshold: '1.0', metricKey: 'new_bugs', periodIndex: 1, - status: 'OK' - } + status: 'OK', + }, ], ignoredConditions: false, status: 'OK', - ...overrides + ...overrides, }; } @@ -110,7 +110,7 @@ export function mockQualityGateApplicationStatus( errorThreshold: '1.0', metric: 'coverage', status: 'ERROR', - value: '10' + value: '10', }, { comparator: 'GT', @@ -118,10 +118,10 @@ export function mockQualityGateApplicationStatus( metric: 'new_bugs', periodIndex: 1, status: 'ERROR', - value: '5' - } + value: '5', + }, ], - status: 'ERROR' + status: 'ERROR', }, { key: 'bar', @@ -133,13 +133,13 @@ export function mockQualityGateApplicationStatus( metric: 'new_bugs', periodIndex: 1, status: 'ERROR', - value: '15' - } + value: '15', + }, ], - status: 'ERROR' - } + status: 'ERROR', + }, ], status: 'ERROR', - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/quality-profiles.ts b/server/sonar-web/src/main/js/helpers/mocks/quality-profiles.ts index 20d2a14a60b..9b85ae0480c 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/quality-profiles.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/quality-profiles.ts @@ -26,6 +26,6 @@ export function mockProfileOption(overrides: Partial<ProfileOption> = {}): Profi label: 'Profile 1', language: 'Java', isDisabled: false, - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/react-select.ts b/server/sonar-web/src/main/js/helpers/mocks/react-select.ts index 17f4562c437..6433f8247f7 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/react-select.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/react-select.ts @@ -23,7 +23,7 @@ import { IndicatorProps, InputProps, OptionProps, - OptionTypeBase + OptionTypeBase, } from 'react-select'; export function mockReactSelectOptionProps< @@ -36,7 +36,7 @@ export function mockReactSelectOptionProps< ): OptionProps<OptionType, IsMulti, GroupType> { return { ...overrides, - data + data, } as OptionProps<OptionType, IsMulti, GroupType>; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts b/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts index 6ce02172949..a23ee491071 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts @@ -29,7 +29,7 @@ import { RawHotspot, ReviewHistoryElement, ReviewHistoryType, - RiskExposure + RiskExposure, } from '../../types/security-hotspots'; import { mockFlowLocation, mockUser } from '../testMocks'; @@ -48,7 +48,7 @@ export function mockRawHotspot(overrides: Partial<RawHotspot> = {}): RawHotspot author: 'Developer 1', creationDate: '2013-05-13T17:55:39+0200', updateDate: '2013-05-13T17:55:39+0200', - ...overrides + ...overrides, }; } @@ -77,11 +77,11 @@ export function mockHotspot(overrides?: Partial<Hotspot>): Hotspot { startLine: 142, endLine: 142, startOffset: 26, - endOffset: 83 + endOffset: 83, }, updateDate: '2013-05-13T17:55:42+0200', users: [assigneeUser, authorUser], - ...overrides + ...overrides, }; } @@ -92,7 +92,7 @@ export function mockHotspotComponent(overrides?: Partial<HotspotComponent>): Hot longName: 'Hotspot component long name', qualifier: ComponentQualifier.File, path: 'path/to/component', - ...overrides + ...overrides, }; } @@ -105,7 +105,7 @@ export function mockHotspotComment(overrides?: Partial<HotspotComment>): Hotspot updatable: false, login: 'dude-2', user: mockUser({ login: 'dude-2' }), - ...overrides + ...overrides, }; } @@ -115,7 +115,7 @@ export function mockHotspotRule(overrides?: Partial<HotspotRule>): HotspotRule { name: 'That rule', vulnerabilityProbability: RiskExposure.HIGH, securityCategory: 'sql-injection', - ...overrides + ...overrides, }; } @@ -126,7 +126,7 @@ export function mockHotspotReviewHistoryElement( date: '2019-09-13T17:55:42+0200', type: ReviewHistoryType.Creation, user: mockUser(), - ...overrides + ...overrides, }; } @@ -134,70 +134,70 @@ export function mockStandards(): Standards { return { cwe: { unknown: { - title: 'No CWE associated' + title: 'No CWE associated', }, '1004': { - title: "Sensitive Cookie Without 'HttpOnly' Flag" - } + title: "Sensitive Cookie Without 'HttpOnly' Flag", + }, }, owaspTop10: { a1: { - title: 'Injection' + title: 'Injection', }, a2: { - title: 'Broken Authentication' + title: 'Broken Authentication', }, a3: { - title: 'Sensitive Data Exposure' - } + title: 'Sensitive Data Exposure', + }, }, 'owaspTop10-2021': { a1: { - title: 'Injection' + title: 'Injection', }, a2: { - title: 'Broken Authentication' + title: 'Broken Authentication', }, a3: { - title: 'Sensitive Data Exposure' - } + title: 'Sensitive Data Exposure', + }, }, sansTop25: { 'insecure-interaction': { - title: 'Insecure Interaction Between Components' + title: 'Insecure Interaction Between Components', }, 'risky-resource': { - title: 'Risky Resource Management' + title: 'Risky Resource Management', }, 'porous-defenses': { - title: 'Porous Defenses' - } + title: 'Porous Defenses', + }, }, sonarsourceSecurity: { 'buffer-overflow': { - title: 'Buffer Overflow' + title: 'Buffer Overflow', }, 'sql-injection': { - title: 'SQL Injection' + title: 'SQL Injection', }, rce: { - title: 'Code Injection (RCE)' - } + title: 'Code Injection (RCE)', + }, }, 'pciDss-3.2': { '1': { - title: ' Install and maintain a firewall configuration to protect cardholder data' - } + title: ' Install and maintain a firewall configuration to protect cardholder data', + }, }, 'pciDss-4.0': { '2': { - title: 'This is useless...' - } + title: 'This is useless...', + }, }, 'owaspAsvs-4.0': { '1': { - title: 'New OWASP ASVS cat 1' - } - } + title: 'New OWASP ASVS cat 1', + }, + }, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/settings.ts b/server/sonar-web/src/main/js/helpers/mocks/settings.ts index 367b4c0cd95..8d9236c4469 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/settings.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/settings.ts @@ -22,7 +22,7 @@ import { Setting, SettingType, SettingValue, - SettingWithCategory + SettingWithCategory, } from '../../types/settings'; export function mockDefinition( @@ -34,7 +34,7 @@ export function mockDefinition( fields: [], options: [], subCategory: 'foo subCat', - ...overrides + ...overrides, }; } @@ -49,16 +49,16 @@ export function mockSetting(overrides: Partial<Setting> = {}): Setting { name: 'Foo setting', description: 'When Foo then Bar', type: SettingType.INTEGER, - options: [] + options: [], }, - ...overrides + ...overrides, }; } export function mockSettingValue(overrides: Partial<SettingValue> = {}) { return { key: 'test', - ...overrides + ...overrides, }; } @@ -78,8 +78,8 @@ export function mockSettingWithCategory( options: [], category: 'general', fields: [], - subCategory: 'email' + subCategory: 'email', }, - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/sources.ts b/server/sonar-web/src/main/js/helpers/mocks/sources.ts index 72523c2add2..0fe4db77452 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/sources.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/sources.ts @@ -31,7 +31,7 @@ export function mockSourceViewerFile( coverage: '85.2', duplicationDensity: '1.0', issues: '12', - lines: '56' + lines: '56', }, project, projectName: 'MyProject', @@ -43,7 +43,7 @@ export function mockSourceViewerFile( longName: name, fav: false, canMarkAsFavorite: true, - ...override + ...override, }; } @@ -58,7 +58,7 @@ export function mockSourceLine(overrides: Partial<SourceLine> = {}): SourceLine scmDate: '2018-12-11T10:48:39+0100', duplicated: false, isNew: true, - ...overrides + ...overrides, }; } @@ -73,6 +73,6 @@ export function mockSnippetsByComponent( }, {}); return { component: mockSourceViewerFile(file, project), - sources + sources, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts b/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts index 0c2c61e5ee2..40c6d5715a8 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts @@ -26,6 +26,6 @@ export function mockSystemUpgrade(override: Partial<SystemUpgrade> = {}): System releaseDate: '2017-03-01', changeLogUrl: 'changelogurl', downloadUrl: 'downloadurl', - ...override + ...override, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/tasks.ts b/server/sonar-web/src/main/js/helpers/mocks/tasks.ts index cfd8bf6e6fb..8c0e611ed14 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/tasks.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/tasks.ts @@ -30,7 +30,7 @@ export function mockTask(overrides: Partial<Task> = {}): Task { status: TaskStatuses.Pending, submittedAt: '2020-09-11T11:45:35+0200', type: TaskTypes.Report, - ...overrides + ...overrides, }; } @@ -39,6 +39,6 @@ export function mockTaskWarning(overrides: Partial<TaskWarning> = {}): TaskWarni key: 'foo', message: 'Lorem ipsum', dismissable: false, - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/token.ts b/server/sonar-web/src/main/js/helpers/mocks/token.ts index f7bbecf6e08..c29528bff29 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/token.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/token.ts @@ -26,6 +26,6 @@ export function mockUserToken(overrides: Partial<UserToken> = {}): UserToken { createdAt: '2019-06-14T09:45:52+0200', type: TokenType.User, isExpired: false, - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/users.ts b/server/sonar-web/src/main/js/helpers/mocks/users.ts index d184c0ffb8c..ef6fc83884b 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/users.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/users.ts @@ -22,6 +22,6 @@ import { UserBase } from '../../types/users'; export function mockUserBase(overrides: Partial<UserBase> = {}): UserBase { return { login: 'userlogin', - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/webhook.ts b/server/sonar-web/src/main/js/helpers/mocks/webhook.ts index 3f4859f4708..c536fdc7c89 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/webhook.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/webhook.ts @@ -28,6 +28,6 @@ export function mockWebhookDelivery(overrides: Partial<WebhookDelivery> = {}): W httpStatus: HttpStatus.Ok, id: '1', success: true, - ...overrides + ...overrides, }; } diff --git a/server/sonar-web/src/main/js/helpers/path.ts b/server/sonar-web/src/main/js/helpers/path.ts index 60252e60593..c04baeb69a0 100644 --- a/server/sonar-web/src/main/js/helpers/path.ts +++ b/server/sonar-web/src/main/js/helpers/path.ts @@ -88,14 +88,14 @@ export function splitPath(path: string) { const tokens = path.split('/'); return { head: tokens.slice(0, -1).join('/'), - tail: tokens[tokens.length - 1] + tail: tokens[tokens.length - 1], }; } export function cutLongWords(str: string, limit = 30) { return str .split(' ') - .map(word => (word.length > limit ? word.substr(0, limit) + '...' : word)) + .map((word) => (word.length > limit ? word.substr(0, limit) + '...' : word)) .join(' '); } diff --git a/server/sonar-web/src/main/js/helpers/projectLinks.ts b/server/sonar-web/src/main/js/helpers/projectLinks.ts index 07725bf6740..d8af5f9f52e 100644 --- a/server/sonar-web/src/main/js/helpers/projectLinks.ts +++ b/server/sonar-web/src/main/js/helpers/projectLinks.ts @@ -31,8 +31,8 @@ export function isProvided(link: Pick<ProjectLink, 'type'>) { export function orderLinks<T extends NameAndType>(links: T[]) { const [provided, unknown] = partition<T>(links, isProvided); return [ - ...sortBy(provided, link => PROVIDED_TYPES.indexOf(link.type)), - ...sortBy(unknown, link => link.name && link.name.toLowerCase()) + ...sortBy(provided, (link) => PROVIDED_TYPES.indexOf(link.type)), + ...sortBy(unknown, (link) => link.name && link.name.toLowerCase()), ]; } diff --git a/server/sonar-web/src/main/js/helpers/qualityGates.ts b/server/sonar-web/src/main/js/helpers/qualityGates.ts index 22ba0141dd5..381866bcbc8 100644 --- a/server/sonar-web/src/main/js/helpers/qualityGates.ts +++ b/server/sonar-web/src/main/js/helpers/qualityGates.ts @@ -20,7 +20,7 @@ import { QualityGateApplicationStatusChildProject, QualityGateProjectStatus, - QualityGateStatusCondition + QualityGateStatusCondition, } from '../types/quality-gates'; export function extractStatusConditionsFromProjectStatus( @@ -28,13 +28,13 @@ export function extractStatusConditionsFromProjectStatus( ): QualityGateStatusCondition[] { const { conditions } = projectStatus; return conditions - ? conditions.map(c => ({ + ? conditions.map((c) => ({ actual: c.actualValue, error: c.errorThreshold, level: c.status, metric: c.metricKey, op: c.comparator, - period: c.periodIndex + period: c.periodIndex, })) : []; } @@ -44,13 +44,13 @@ export function extractStatusConditionsFromApplicationStatusChildProject( ): QualityGateStatusCondition[] { const { conditions } = projectStatus; return conditions - ? conditions.map(c => ({ + ? conditions.map((c) => ({ actual: c.value, error: c.errorThreshold, level: c.status, metric: c.metric, op: c.comparator, - period: c.periodIndex + period: c.periodIndex, })) : []; } diff --git a/server/sonar-web/src/main/js/helpers/query.ts b/server/sonar-web/src/main/js/helpers/query.ts index 2cadbc21282..85b9347fe9d 100644 --- a/server/sonar-web/src/main/js/helpers/query.ts +++ b/server/sonar-web/src/main/js/helpers/query.ts @@ -29,7 +29,7 @@ export function queriesEqual(a: RawQuery, b: RawQuery): boolean { return false; } - return keysA.every(key => isEqual(a[key], b[key])); + return keysA.every((key) => isEqual(a[key], b[key])); } export function cleanQuery(query: RawQuery): RawQuery { diff --git a/server/sonar-web/src/main/js/helpers/request.ts b/server/sonar-web/src/main/js/helpers/request.ts index 569ea04e610..2c0c8eceb8b 100644 --- a/server/sonar-web/src/main/js/helpers/request.ts +++ b/server/sonar-web/src/main/js/helpers/request.ts @@ -61,14 +61,14 @@ const DEFAULT_OPTIONS: { method: string; } = { credentials: 'same-origin', - method: 'GET' + method: 'GET', }; /** * Default request headers */ const DEFAULT_HEADERS = { - Accept: 'application/json' + Accept: 'application/json', }; /** @@ -104,7 +104,7 @@ class Request { options.headers = { ...DEFAULT_HEADERS, - ...customHeaders + ...customHeaders, }; return { url, options }; } @@ -141,7 +141,7 @@ export function request(url: string): Request { export function corsRequest(url: string, mode: RequestMode = 'cors'): Request { const options: RequestInit = { mode }; const request = new Request(url, options); - request.submit = function() { + request.submit = function () { const { url, options } = this.getSubmitData(); return window.fetch(url, options); }; @@ -154,9 +154,7 @@ export function corsRequest(url: string, mode: RequestMode = 'cors'): Request { export function checkStatus(response: Response, bypassRedirect?: boolean): Promise<Response> { return new Promise((resolve, reject) => { if (response.status === HttpStatus.Unauthorized && !bypassRedirect) { - import('./handleRequiredAuthentication') - .then(i => i.default()) - .then(reject, reject); + import('./handleRequiredAuthentication').then((i) => i.default()).then(reject, reject); } else if (isSuccessStatus(response.status)) { resolve(response); } else { @@ -196,7 +194,7 @@ export function get(url: string, data?: RequestData, bypassRedirect?: boolean): return request(url) .setData(data) .submit() - .then(response => checkStatus(response, bypassRedirect)); + .then((response) => checkStatus(response, bypassRedirect)); } /** @@ -224,7 +222,7 @@ export function getCorsJSON(url: string, data?: RequestData): Promise<any> { return corsRequest(url) .setData(data) .submit() - .then(response => { + .then((response) => { if (isSuccessStatus(response.status)) { return parseJSON(response); } @@ -240,7 +238,7 @@ export function postJSON(url: string, data?: RequestData, bypassRedirect?: boole .setMethod('POST') .setData(data) .submit() - .then(response => checkStatus(response, bypassRedirect)) + .then((response) => checkStatus(response, bypassRedirect)) .then(parseJSON); } @@ -256,7 +254,7 @@ export function postJSONBody( .setMethod('POST') .setData(data, true) .submit() - .then(response => checkStatus(response, bypassRedirect)) + .then((response) => checkStatus(response, bypassRedirect)) .then(parseJSON); } @@ -269,7 +267,7 @@ export function post(url: string, data?: RequestData, bypassRedirect?: boolean): .setMethod('POST') .setData(data) .submit() - .then(response => checkStatus(response, bypassRedirect)) + .then((response) => checkStatus(response, bypassRedirect)) .then(() => resolve(), reject); }); } @@ -283,7 +281,7 @@ function tryRequestAgain<T>( ) { tries.max--; if (tries.max !== 0) { - return new Promise<T>(resolve => { + return new Promise<T>((resolve) => { setTimeout( () => resolve(requestTryAndRepeatUntil(repeatAPICall, tries, stopRepeat, repeatErrors)), tries.max > tries.slowThreshold ? 500 : 3000 @@ -300,7 +298,7 @@ export function requestTryAndRepeatUntil<T>( repeatErrors: number[] = [] ) { return repeatAPICall().then( - r => { + (r) => { if (stopRepeat(r)) { return r; } @@ -335,5 +333,5 @@ export enum HttpStatus { NotImplemented = 501, BadGateway = 502, ServiceUnavailable = 503, - GatewayTimeout = 504 + GatewayTimeout = 504, } diff --git a/server/sonar-web/src/main/js/helpers/sanitize.ts b/server/sonar-web/src/main/js/helpers/sanitize.ts index 2dace31d2d1..75cb96e84f5 100644 --- a/server/sonar-web/src/main/js/helpers/sanitize.ts +++ b/server/sonar-web/src/main/js/helpers/sanitize.ts @@ -22,7 +22,7 @@ import { sanitize } from 'dompurify'; export function sanitizeStringRestricted(html: string) { return sanitize(html, { ALLOWED_TAGS: ['b', 'br', 'code', 'i', 'li', 'p', 'strong', 'ul', 'a'], - ALLOWED_ATTR: ['target', 'href'] + ALLOWED_ATTR: ['target', 'href'], }); } diff --git a/server/sonar-web/src/main/js/helpers/scrolling.ts b/server/sonar-web/src/main/js/helpers/scrolling.ts index 2b80c07da7a..fdf5da0fa05 100644 --- a/server/sonar-web/src/main/js/helpers/scrolling.ts +++ b/server/sonar-web/src/main/js/helpers/scrolling.ts @@ -50,7 +50,7 @@ function smoothScroll( const step = Math.ceil(Math.abs(target - current) / SCROLLING_STEPS); let stepsDone = 0; - return new Promise(resolve => { + return new Promise((resolve) => { const interval = setInterval(() => { if (current === target || SCROLLING_STEPS === stepsDone) { clearInterval(interval); @@ -72,12 +72,12 @@ function smoothScroll( function smoothScrollTop(parent: Element | Window, position: number) { const scroll = getScroll(parent); - return smoothScroll(position, scroll.y, position => scrollElement(parent, scroll.x, position)); + return smoothScroll(position, scroll.y, (position) => scrollElement(parent, scroll.x, position)); } function smoothScrollLeft(parent: Element | Window, position: number) { const scroll = getScroll(parent); - return smoothScroll(position, scroll.x, position => scrollElement(parent, position, scroll.y)); + return smoothScroll(position, scroll.x, (position) => scrollElement(parent, position, scroll.y)); } /** @@ -194,9 +194,7 @@ function processQueue() { if (queue.length > 0) { queueRunning = true; const { fn, element, x, y } = queue.shift()!; - fn(element, x, y) - .then(processQueue) - .catch(processQueue); + fn(element, x, y).then(processQueue).catch(processQueue); } else { queueRunning = false; } diff --git a/server/sonar-web/src/main/js/helpers/security-standard.ts b/server/sonar-web/src/main/js/helpers/security-standard.ts index ab51b5f107e..5ffbe8e65d9 100644 --- a/server/sonar-web/src/main/js/helpers/security-standard.ts +++ b/server/sonar-web/src/main/js/helpers/security-standard.ts @@ -20,7 +20,7 @@ import { Standards } from '../types/security'; export function getStandards(): Promise<Standards> { - return import('./standards.json').then(x => x.default); + return import('./standards.json').then((x) => x.default); } export function renderCWECategory(standards: Standards, category: string): string { diff --git a/server/sonar-web/src/main/js/helpers/sonarlint.ts b/server/sonar-web/src/main/js/helpers/sonarlint.ts index 640c594462f..978d624bde6 100644 --- a/server/sonar-web/src/main/js/helpers/sonarlint.ts +++ b/server/sonar-web/src/main/js/helpers/sonarlint.ts @@ -27,17 +27,17 @@ const SONARLINT_PORT_RANGE = 11; export async function probeSonarLintServers(): Promise<Array<Ide>> { const probedPorts = buildPortRange(); - const probeRequests = probedPorts.map(p => + const probeRequests = probedPorts.map((p) => fetch(buildSonarLintEndpoint(p, '/status')) - .then(r => r.json()) - .then(json => { + .then((r) => r.json()) + .then((json) => { const { ideName, description } = json; return { port: p, ideName, description } as Ide; }) .catch(() => undefined) ); const results = await Promise.all(probeRequests); - return results.filter(r => r !== undefined) as Ide[]; + return results.filter((r) => r !== undefined) as Ide[]; } export function openHotspot(calledPort: number, projectKey: string, hotspotKey: string) { @@ -61,7 +61,7 @@ export async function sendUserToken(port: number, token: NewUserToken) { createdAt: token.createdAt, expirationDate: token.expirationDate, token: token.token, - type: token.type + type: token.type, }; const response = await fetch(tokenUrl, { method: 'POST', body: JSON.stringify(data) }); @@ -77,7 +77,7 @@ export async function sendUserToken(port: number, token: NewUserToken) { * @returns [ start , ... , start + size - 1 ] */ export function buildPortRange(start = SONARLINT_PORT_START, size = SONARLINT_PORT_RANGE) { - return Array.from(Array(size).keys()).map(p => start + p); + return Array.from(Array(size).keys()).map((p) => start + p); } function buildSonarLintEndpoint(port: number, path: string) { diff --git a/server/sonar-web/src/main/js/helpers/stringify-queryparams.ts b/server/sonar-web/src/main/js/helpers/stringify-queryparams.ts index 777d9057022..80a45e76ba4 100644 --- a/server/sonar-web/src/main/js/helpers/stringify-queryparams.ts +++ b/server/sonar-web/src/main/js/helpers/stringify-queryparams.ts @@ -63,7 +63,7 @@ export function stringify(obj: any, sep?: any, eq?: any, name?: any) { if (typeof obj === 'object') { return Object.keys(obj) - .map(k => { + .map((k) => { const ks = encodeURIComponent(stringifyPrimitive(k)) + eq; if (Array.isArray(obj[k])) { return obj[k] diff --git a/server/sonar-web/src/main/js/helpers/strings.ts b/server/sonar-web/src/main/js/helpers/strings.ts index 82d791ba42d..9eb35ec85da 100644 --- a/server/sonar-web/src/main/js/helpers/strings.ts +++ b/server/sonar-web/src/main/js/helpers/strings.ts @@ -27,377 +27,377 @@ const defaultDiacriticsRemovalap = [ { base: 'A', letters: - '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F' + '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F', }, { base: 'AA', - letters: '\uA732' + letters: '\uA732', }, { base: 'AE', - letters: '\u00C6\u01FC\u01E2' + letters: '\u00C6\u01FC\u01E2', }, { base: 'AO', - letters: '\uA734' + letters: '\uA734', }, { base: 'AU', - letters: '\uA736' + letters: '\uA736', }, { base: 'AV', - letters: '\uA738\uA73A' + letters: '\uA738\uA73A', }, { base: 'AY', - letters: '\uA73C' + letters: '\uA73C', }, { base: 'B', - letters: '\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181' + letters: '\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181', }, { base: 'C', - letters: '\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E' + letters: '\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E', }, { base: 'D', - letters: '\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779' + letters: '\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779', }, { base: 'DZ', - letters: '\u01F1\u01C4' + letters: '\u01F1\u01C4', }, { base: 'Dz', - letters: '\u01F2\u01C5' + letters: '\u01F2\u01C5', }, { base: 'E', letters: - '\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E' + '\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E', }, { base: 'F', - letters: '\u0046\u24BB\uFF26\u1E1E\u0191\uA77B' + letters: '\u0046\u24BB\uFF26\u1E1E\u0191\uA77B', }, { base: 'G', letters: - '\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E' + '\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E', }, { base: 'H', - letters: '\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D' + letters: '\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D', }, { base: 'I', letters: - '\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197' + '\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197', }, { base: 'J', - letters: '\u004A\u24BF\uFF2A\u0134\u0248' + letters: '\u004A\u24BF\uFF2A\u0134\u0248', }, { base: 'K', - letters: '\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2' + letters: '\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2', }, { base: 'L', letters: - '\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780' + '\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780', }, { base: 'LJ', - letters: '\u01C7' + letters: '\u01C7', }, { base: 'Lj', - letters: '\u01C8' + letters: '\u01C8', }, { base: 'M', - letters: '\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C' + letters: '\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C', }, { base: 'N', letters: - '\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4' + '\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4', }, { base: 'NJ', - letters: '\u01CA' + letters: '\u01CA', }, { base: 'Nj', - letters: '\u01CB' + letters: '\u01CB', }, { base: 'O', letters: - '\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C' + '\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C', }, { base: 'OI', - letters: '\u01A2' + letters: '\u01A2', }, { base: 'OO', - letters: '\uA74E' + letters: '\uA74E', }, { base: 'OU', - letters: '\u0222' + letters: '\u0222', }, { base: 'OE', - letters: '\u008C\u0152' + letters: '\u008C\u0152', }, { base: 'oe', - letters: '\u009C\u0153' + letters: '\u009C\u0153', }, { base: 'P', - letters: '\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754' + letters: '\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754', }, { base: 'Q', - letters: '\u0051\u24C6\uFF31\uA756\uA758\u024A' + letters: '\u0051\u24C6\uFF31\uA756\uA758\u024A', }, { base: 'R', letters: - '\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782' + '\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782', }, { base: 'S', letters: - '\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784' + '\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784', }, { base: 'T', letters: - '\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786' + '\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786', }, { base: 'TZ', - letters: '\uA728' + letters: '\uA728', }, { base: 'U', letters: - '\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244' + '\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244', }, { base: 'V', - letters: '\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245' + letters: '\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245', }, { base: 'VY', - letters: '\uA760' + letters: '\uA760', }, { base: 'W', - letters: '\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72' + letters: '\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72', }, { base: 'X', - letters: '\u0058\u24CD\uFF38\u1E8A\u1E8C' + letters: '\u0058\u24CD\uFF38\u1E8A\u1E8C', }, { base: 'Y', letters: - '\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE' + '\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE', }, { base: 'Z', - letters: '\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762' + letters: '\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762', }, { base: 'a', letters: - '\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250' + '\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250', }, { base: 'aa', - letters: '\uA733' + letters: '\uA733', }, { base: 'ae', - letters: '\u00E6\u01FD\u01E3' + letters: '\u00E6\u01FD\u01E3', }, { base: 'ao', - letters: '\uA735' + letters: '\uA735', }, { base: 'au', - letters: '\uA737' + letters: '\uA737', }, { base: 'av', - letters: '\uA739\uA73B' + letters: '\uA739\uA73B', }, { base: 'ay', - letters: '\uA73D' + letters: '\uA73D', }, { base: 'b', - letters: '\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253' + letters: '\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253', }, { base: 'c', - letters: '\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184' + letters: '\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184', }, { base: 'd', - letters: '\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A' + letters: '\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A', }, { base: 'dz', - letters: '\u01F3\u01C6' + letters: '\u01F3\u01C6', }, { base: 'e', letters: - '\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD' + '\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD', }, { base: 'f', - letters: '\u0066\u24D5\uFF46\u1E1F\u0192\uA77C' + letters: '\u0066\u24D5\uFF46\u1E1F\u0192\uA77C', }, { base: 'g', letters: - '\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F' + '\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F', }, { base: 'h', letters: - '\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265' + '\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265', }, { base: 'hv', - letters: '\u0195' + letters: '\u0195', }, { base: 'i', letters: - '\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131' + '\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131', }, { base: 'j', - letters: '\u006A\u24D9\uFF4A\u0135\u01F0\u0249' + letters: '\u006A\u24D9\uFF4A\u0135\u01F0\u0249', }, { base: 'k', - letters: '\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3' + letters: '\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3', }, { base: 'l', letters: - '\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747' + '\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747', }, { base: 'lj', - letters: '\u01C9' + letters: '\u01C9', }, { base: 'm', - letters: '\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F' + letters: '\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F', }, { base: 'n', letters: - '\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5' + '\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5', }, { base: 'nj', - letters: '\u01CC' + letters: '\u01CC', }, { base: 'o', letters: - '\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275' + '\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275', }, { base: 'oi', - letters: '\u01A3' + letters: '\u01A3', }, { base: 'ou', - letters: '\u0223' + letters: '\u0223', }, { base: 'oo', - letters: '\uA74F' + letters: '\uA74F', }, { base: 'p', - letters: '\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755' + letters: '\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755', }, { base: 'q', - letters: '\u0071\u24E0\uFF51\u024B\uA757\uA759' + letters: '\u0071\u24E0\uFF51\u024B\uA757\uA759', }, { base: 'r', letters: - '\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783' + '\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783', }, { base: 's', letters: - '\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B' + '\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B', }, { base: 't', letters: - '\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787' + '\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787', }, { base: 'tz', - letters: '\uA729' + letters: '\uA729', }, { base: 'u', letters: - '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289' + '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289', }, { base: 'v', - letters: '\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C' + letters: '\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C', }, { base: 'vy', - letters: '\uA761' + letters: '\uA761', }, { base: 'w', - letters: '\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73' + letters: '\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73', }, { base: 'x', - letters: '\u0078\u24E7\uFF58\u1E8B\u1E8D' + letters: '\u0078\u24E7\uFF58\u1E8B\u1E8D', }, { base: 'y', letters: - '\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF' + '\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF', }, { base: 'z', - letters: '\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763' - } + letters: '\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763', + }, ]; const diacriticsMap: Dict<string> = {}; -defaultDiacriticsRemovalap.forEach(defaultDiacritic => - defaultDiacritic.letters.split('').forEach(letter => { +defaultDiacriticsRemovalap.forEach((defaultDiacritic) => + defaultDiacritic.letters.split('').forEach((letter) => { diacriticsMap[letter] = defaultDiacritic.base; }) ); @@ -405,7 +405,7 @@ defaultDiacriticsRemovalap.forEach(defaultDiacritic => // "what?" version ... http://jsperf.com/diacritics/12 export function latinize(str: string): string { // eslint-disable-next-line no-control-regex - return str.replace(/[^\u0000-\u007E]/g, a => diacriticsMap[a] || a); + return str.replace(/[^\u0000-\u007E]/g, (a) => diacriticsMap[a] || a); } export function decodeJwt(token: string) { diff --git a/server/sonar-web/src/main/js/helpers/testMocks.ts b/server/sonar-web/src/main/js/helpers/testMocks.ts index d089cfcd86a..15d2ff44b02 100644 --- a/server/sonar-web/src/main/js/helpers/testMocks.ts +++ b/server/sonar-web/src/main/js/helpers/testMocks.ts @@ -48,7 +48,7 @@ import { RuleParameter, SysInfoBase, SysInfoCluster, - SysInfoStandalone + SysInfoStandalone, } from '../types/types'; import { CurrentUser, LoggedInUser, User } from '../types/users'; @@ -59,7 +59,7 @@ export function mockAlmApplication(overrides: Partial<AlmApplication> = {}): Alm installationUrl: 'https://github.com/apps/greg-sonarcloud/installations/new', key: 'github', name: 'GitHub', - ...overrides + ...overrides, }; } @@ -70,7 +70,7 @@ export function mockAppState(overrides: Partial<AppState> = {}): AppState { qualifiers: ['TRK'], settings: {}, version: '1.0', - ...overrides + ...overrides, }; } @@ -79,7 +79,7 @@ export function mockBaseSysInfo(overrides: Partial<any> = {}): SysInfoBase { Health: 'GREEN' as HealthType, 'Health Causes': [], System: { - Version: '7.8' + Version: '7.8', }, Database: { Database: 'PostgreSQL', @@ -87,18 +87,18 @@ export function mockBaseSysInfo(overrides: Partial<any> = {}): SysInfoBase { Username: 'sonar', URL: 'jdbc:postgresql://localhost/sonar', Driver: 'PostgreSQL JDBC Driver', - 'Driver Version': '42.2.5' + 'Driver Version': '42.2.5', }, 'Compute Engine Tasks': { 'Total Pending': 0, - 'Total In Progress': 0 + 'Total In Progress': 0, }, 'Search State': { State: 'GREEN', Nodes: 3 }, 'Search Indexes': { 'Index components - Docs': 30445, - 'Index components - Shards': 10 + 'Index components - Shards': 10, }, - ...overrides + ...overrides, }; } @@ -109,11 +109,11 @@ export function mockClusterSysInfo(overrides: Partial<any> = {}): SysInfoCluster System: { ...baseInfo.System, 'High Availability': true, - 'Server ID': 'asd564-asd54a-5dsfg45' + 'Server ID': 'asd564-asd54a-5dsfg45', }, Settings: { 'sonar.cluster.enabled': 'true', - 'sonar.cluster.node.name': 'server9.example.com' + 'sonar.cluster.node.name': 'server9.example.com', }, 'Application Nodes': [ { @@ -122,42 +122,42 @@ export function mockClusterSysInfo(overrides: Partial<any> = {}): SysInfoCluster Health: 'GREEN' as HealthType, 'Health Causes': [], System: { - Version: '7.8' + Version: '7.8', }, Plugins: { - java: '5.13.0.17924 [SonarJava]' + java: '5.13.0.17924 [SonarJava]', }, 'Web JVM State': { 'Max Memory (MB)': 1024, - 'Free Memory (MB)': 122 + 'Free Memory (MB)': 122, }, 'Web Database Connection': { - 'Pool Active Connections': 1 + 'Pool Active Connections': 1, }, 'Web Logging': { 'Logs Level': 'DEBUG' }, 'Web JVM Properties': { 'file.encoding': 'UTF-8', - 'file.separator': '/' + 'file.separator': '/', }, 'Compute Engine Tasks': { Pending: 0, - 'In Progress': 0 + 'In Progress': 0, }, 'Compute Engine JVM State': { 'Max Memory (MB)': 1024, - 'Free Memory (MB)': 78 + 'Free Memory (MB)': 78, }, 'Compute Engine Database Connection': { 'Pool Initial Size': 0, - 'Pool Active Connections': 0 + 'Pool Active Connections': 0, }, 'Compute Engine Logging': { - 'Logs Level': 'INFO' + 'Logs Level': 'INFO', }, 'Compute Engine JVM Properties': { 'file.encoding': 'UTF-8', - 'file.separator': '/' - } + 'file.separator': '/', + }, }, { Name: 'server9.example.com', @@ -165,44 +165,44 @@ export function mockClusterSysInfo(overrides: Partial<any> = {}): SysInfoCluster Health: 'GREEN' as HealthType, 'Health Causes': [], System: { - Version: '7.8' + Version: '7.8', }, Plugins: { - java: '5.13.0.17924 [SonarJava]' + java: '5.13.0.17924 [SonarJava]', }, 'Web JVM State': { 'Max Memory (MB)': 1024, - 'Free Memory (MB)': 111 + 'Free Memory (MB)': 111, }, 'Web Database Connection': { 'Pool Active Connections': 0, - 'Pool Max Connections': 60 + 'Pool Max Connections': 60, }, 'Web Logging': { 'Logs Level': 'INFO' }, 'Web JVM Properties': { 'file.encoding': 'UTF-8', - 'file.separator': '/' + 'file.separator': '/', }, 'Compute Engine Tasks': { Pending: 0, - 'In Progress': 0 + 'In Progress': 0, }, 'Compute Engine JVM State': { 'Max Memory (MB)': 1024, - 'Free Memory (MB)': 89 + 'Free Memory (MB)': 89, }, 'Compute Engine Database Connection': { 'Pool Initial Size': 0, - 'Pool Active Connections': 0 + 'Pool Active Connections': 0, }, 'Compute Engine Logging': { - 'Logs Level': 'INFO' + 'Logs Level': 'INFO', }, 'Compute Engine JVM Properties': { 'file.encoding': 'UTF-8', - 'file.separator': '/' - } - } + 'file.separator': '/', + }, + }, ], 'Search Nodes': [ { @@ -210,30 +210,30 @@ export function mockClusterSysInfo(overrides: Partial<any> = {}): SysInfoCluster Host: '10.0.0.0', 'Search State': { 'CPU Usage (%)': 0, - 'Disk Available': '93 GB' - } + 'Disk Available': '93 GB', + }, }, { Name: 'server.example.com', Host: '10.0.0.0', 'Search State': { 'CPU Usage (%)': 0, - 'Disk Available': '93 GB' - } + 'Disk Available': '93 GB', + }, }, { Name: 'server.example.com', Host: '10.0.0.0', 'Search State': { 'CPU Usage (%)': 0, - 'Disk Available': '93 GB' - } - } + 'Disk Available': '93 GB', + }, + }, ], Statistics: { - ncloc: 989880 + ncloc: 989880, }, - ...overrides + ...overrides, }; } @@ -243,7 +243,7 @@ export function mockCondition(overrides: Partial<Condition> = {}): Condition { id: '1', metric: 'coverage', op: 'LT', - ...overrides + ...overrides, }; } @@ -251,9 +251,9 @@ export function mockCurrentUser(overrides: Partial<CurrentUser> = {}): CurrentUs return { isLoggedIn: false, dismissedNotices: { - educationPrinciples: false + educationPrinciples: false, }, - ...overrides + ...overrides, }; } @@ -265,9 +265,9 @@ export function mockLoggedInUser(overrides: Partial<LoggedInUser> = {}): LoggedI name: 'Skywalker', scmAccounts: [], dismissedNotices: { - educationPrinciples: false + educationPrinciples: false, }, - ...overrides + ...overrides, }; } @@ -276,7 +276,7 @@ export function mockGroup(overrides: Partial<Group> = {}): Group { id: 1, membersCount: 1, name: 'Foo', - ...overrides + ...overrides, }; } @@ -292,7 +292,7 @@ export function mockRawIssue(withLocations = false, overrides: Partial<RawIssue> status: 'OPEN', textRange: { startLine: 25, endLine: 26, startOffset: 0, endOffset: 15 }, type: IssueType.CodeSmell, - ...overrides + ...overrides, }; if (withLocations) { @@ -302,15 +302,15 @@ export function mockRawIssue(withLocations = false, overrides: Partial<RawIssue> { locations: [ loc({ component: overrides.component }), - loc({ component: overrides.component }) - ] - } + loc({ component: overrides.component }), + ], + }, ]; } return { ...rawIssue, - ...overrides + ...overrides, }; } @@ -337,7 +337,7 @@ export function mockIssue(withLocations = false, overrides: Partial<Issue> = {}) status: 'OPEN', textRange: { startLine: 25, endLine: 26, startOffset: 0, endOffset: 15 }, transitions: [], - type: 'BUG' + type: 'BUG', }; const loc = mockFlowLocation; @@ -345,14 +345,14 @@ export function mockIssue(withLocations = false, overrides: Partial<Issue> = {}) if (withLocations) { issue.flows = [ [loc(), loc(), loc()], - [loc(), loc()] + [loc(), loc()], ]; issue.secondaryLocations = [loc(), loc()]; } return { ...issue, - ...overrides + ...overrides, }; } @@ -364,7 +364,7 @@ export function mockLocation(overrides: Partial<Location> = {}): Location { query: {}, search: '', state: {}, - ...overrides + ...overrides, }; } @@ -376,7 +376,7 @@ export function mockMetric(overrides: Partial<Pick<Metric, 'key' | 'name' | 'typ id: key, key, name, - type + type, }; } @@ -387,10 +387,10 @@ export function mockMeasure(overrides: Partial<Measure> = {}): Measure { period: { bestValue: true, index: 1, - value: '1.0' + value: '1.0', }, value: '1.0', - ...overrides + ...overrides, }; } @@ -402,10 +402,10 @@ export function mockMeasureEnhanced(overrides: Partial<MeasureEnhanced> = {}): M period: { bestValue: true, index: 1, - value: '1.0' + value: '1.0', }, value: '1.0', - ...overrides + ...overrides, }; } @@ -414,7 +414,7 @@ export function mockPeriod(overrides: Partial<Period> = {}): Period { date: '2019-04-23T02:12:32+0100', index: 0, mode: 'previous_version', - ...overrides + ...overrides, }; } @@ -432,7 +432,7 @@ export function mockQualityProfile(overrides: Partial<Profile> = {}): Profile { languageName: 'JavaScript', name: 'name', projectCount: 3, - ...overrides + ...overrides, }; } @@ -445,7 +445,7 @@ export function mockQualityProfileInheritance( key: 'foo', name: 'Foo', overridingRuleCount: 0, - ...overrides + ...overrides, }; } @@ -454,11 +454,11 @@ export function mockQualityProfileChangelogEvent(eventOverride?: any) { action: 'ACTIVATED', date: '2019-04-23T02:12:32+0100', params: { - severity: 'MAJOR' + severity: 'MAJOR', }, ruleKey: 'rule-key', ruleName: 'rule-name', - ...eventOverride + ...eventOverride, }; } @@ -467,7 +467,7 @@ export function mockQualityProfileExporter(override?: Partial<Exporter>): Export key: 'exporter-key', name: 'exporter-name', languages: ['first-lang', 'second-lang'], - ...override + ...override, }; } @@ -487,7 +487,7 @@ export function mockRouter( push: jest.fn(), replace: jest.fn(), setRouteLeaveHook: jest.fn(), - ...overrides + ...overrides, } as Router; } @@ -502,7 +502,7 @@ export function mockRule(overrides: Partial<Rule> = {}): Rule { sysTags: ['a', 'b'], tags: ['x'], type: 'CODE_SMELL', - ...overrides + ...overrides, } as Rule; } @@ -513,7 +513,7 @@ export function mockRuleActivation(overrides: Partial<RuleActivation> = {}): Rul params: [{ key: 'foo', value: 'Bar' }], qProfile: 'baz', severity: 'MAJOR', - ...overrides + ...overrides, }; } @@ -526,8 +526,8 @@ export function mockRuleDetails(overrides: Partial<RuleDetails> = {}): RuleDetai descriptionSections: [ { key: RuleDescriptionSections.DEFAULT, - content: '<b>Why</b> Because' - } + content: '<b>Why</b> Because', + }, ], htmlDesc: '', mdDesc: '', @@ -552,7 +552,7 @@ export function mockRuleDetails(overrides: Partial<RuleDetails> = {}): RuleDetai scope: 'MAIN', isExternal: false, type: 'BUG', - ...overrides + ...overrides, }; } @@ -562,7 +562,7 @@ export function mockRuleDetailsParameter(overrides: Partial<RuleParameter> = {}) htmlDesc: 'description', key: '1', type: 'number', - ...overrides + ...overrides, }; } @@ -573,49 +573,49 @@ export function mockStandaloneSysInfo(overrides: Partial<any> = {}): SysInfoStan System: { ...baseInfo.System, 'High Availability': false, - 'Server ID': 'asd564-asd54a-5dsfg45' + 'Server ID': 'asd564-asd54a-5dsfg45', }, Settings: { 'sonar.cluster.enabled': 'true', - 'sonar.cluster.node.name': 'server9.example.com' + 'sonar.cluster.node.name': 'server9.example.com', }, 'Web JVM State': { 'Max Memory (MB)': 1024, - 'Free Memory (MB)': 111 + 'Free Memory (MB)': 111, }, 'Web Database Connection': { 'Pool Active Connections': 0, - 'Pool Max Connections': 60 + 'Pool Max Connections': 60, }, 'Web Logging': { 'Logs Level': 'INFO', 'Logs Dir': '/logs' }, 'Web JVM Properties': { 'file.encoding': 'UTF-8', - 'file.separator': '/' + 'file.separator': '/', }, 'Compute Engine Tasks': { Pending: 0, - 'In Progress': 0 + 'In Progress': 0, }, 'Compute Engine JVM State': { 'Max Memory (MB)': 1024, - 'Free Memory (MB)': 89 + 'Free Memory (MB)': 89, }, 'Compute Engine Database Connection': { 'Pool Initial Size': 0, - 'Pool Active Connections': 0 + 'Pool Active Connections': 0, }, 'Compute Engine Logging': { 'Logs Level': 'DEBUG', - 'Logs Dir': '/logs' + 'Logs Dir': '/logs', }, 'Compute Engine JVM Properties': { 'file.encoding': 'UTF-8', - 'file.separator': '/' + 'file.separator': '/', }, ALMs: {}, Bundled: {}, Plugins: {}, - ...overrides + ...overrides, }; } @@ -625,7 +625,7 @@ export function mockUser(overrides: Partial<User> = {}): User { local: true, login: 'john.doe', name: 'John Doe', - ...overrides + ...overrides, }; } @@ -655,7 +655,7 @@ export function mockLanguage(overrides: Partial<Language> = {}): Language { return { key: 'css', name: 'CSS', - ...overrides + ...overrides, }; } @@ -666,9 +666,9 @@ export function mockFlowLocation(overrides: Partial<FlowLocation> = {}): FlowLoc startLine: 1, startOffset: 1, endLine: 2, - endOffset: 2 + endOffset: 2, }, - ...overrides + ...overrides, }; } @@ -678,7 +678,7 @@ export function mockIdentityProvider(overrides: Partial<IdentityProvider> = {}): iconPath: '/path/icon.svg', key: 'github', name: 'Github', - ...overrides + ...overrides, }; } @@ -688,8 +688,8 @@ export function mockRef( return { current: { getBoundingClientRect: jest.fn(), - ...overrides.current - } + ...overrides.current, + }, } as React.RefObject<HTMLElement>; } @@ -698,7 +698,7 @@ export function mockPaging(overrides: Partial<Paging> = {}): Paging { pageIndex: 1, pageSize: 100, total: 1000, - ...overrides + ...overrides, }; } @@ -708,7 +708,7 @@ export function mockDumpTask(props: Partial<DumpTask> = {}): DumpTask { startedAt: '2020-03-12T12:20:20Z', submittedAt: '2020-03-12T12:15:20Z', executedAt: '2020-03-12T12:22:20Z', - ...props + ...props, }; } @@ -718,7 +718,7 @@ export function mockDumpStatus(props: Partial<DumpStatus> = {}): DumpStatus { canBeImported: true, dumpToImport: '', exportedDump: '', - ...props + ...props, }; } diff --git a/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx b/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx index c92cb3f960c..48e8a0702b6 100644 --- a/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx +++ b/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx @@ -66,11 +66,12 @@ export function renderAppWithAdminContext( /*noop*/ }, pendingPlugins: { installing: [], removing: [], updating: [] }, - systemStatus: overrides.systemStatus ?? 'UP' - }}> + systemStatus: overrides.systemStatus ?? 'UP', + }} + > <Outlet context={{ - adminPages: overrides.adminPages ?? [] + adminPages: overrides.adminPages ?? [], }} /> </AdminContext.Provider> @@ -115,8 +116,9 @@ export function renderAppWithComponentContext( branchLikes: [], onBranchesChange: jest.fn(), onComponentChange: jest.fn(), - ...componentContext - }}> + ...componentContext, + }} + > <Outlet /> </ComponentContext.Provider> ); @@ -160,7 +162,7 @@ function renderRoutedApp( metrics = DEFAULT_METRICS, appState = mockAppState(), featureList = [], - languages = {} + languages = {}, }: RenderContext = {} ): RenderResult { const path = parsePath(navigateTo); diff --git a/server/sonar-web/src/main/js/helpers/testUtils.ts b/server/sonar-web/src/main/js/helpers/testUtils.ts index 00d1109cf26..e64b78a18f9 100644 --- a/server/sonar-web/src/main/js/helpers/testUtils.ts +++ b/server/sonar-web/src/main/js/helpers/testUtils.ts @@ -26,12 +26,12 @@ export function mockEvent(overrides = {}) { target: { blur() { /* noop */ - } + }, }, currentTarget: { blur() { /* noop */ - } + }, }, preventDefault() { /* noop */ @@ -42,7 +42,7 @@ export function mockEvent(overrides = {}) { stopImmediatePropagation() { /* noop */ }, - ...overrides + ...overrides, } as any; } @@ -65,7 +65,7 @@ export function clickOutside(event = {}): void { export function submit(element: ShallowWrapper | ReactWrapper): void { element.simulate('submit', { - preventDefault() {} + preventDefault() {}, }); } @@ -84,7 +84,7 @@ export function change( element.simulate('change', { target: { value }, currentTarget: { value }, - ...event + ...event, }); } } @@ -94,7 +94,7 @@ export const KEYCODE_MAP: { [code in KeyboardKeys]?: string } = { [KeyboardKeys.LeftArrow]: 'left', [KeyboardKeys.UpArrow]: 'up', [KeyboardKeys.RightArrow]: 'right', - [KeyboardKeys.DownArrow]: 'down' + [KeyboardKeys.DownArrow]: 'down', }; export function keydown(args: { key?: KeyboardKeys; metaKey?: boolean; ctrlKey?: boolean }): void { @@ -109,13 +109,13 @@ export function resizeWindowTo(width?: number, height?: number) { if (width) { Object.defineProperty(document.documentElement, 'clientWidth', { configurable: true, - value: width + value: width, }); } if (height) { Object.defineProperty(document.documentElement, 'clientHeight', { configurable: true, - value: height + value: height, }); } @@ -134,13 +134,13 @@ export function setNodeRect({ width = 50, height = 50, left = 0, top = 0 }) { const { findDOMNode } = require('react-dom'); const element = document.createElement('div'); Object.defineProperty(element, 'getBoundingClientRect', { - value: () => ({ width, height, left, top }) + value: () => ({ width, height, left, top }), }); findDOMNode.mockReturnValue(element); } export function doAsync(fn?: Function): Promise<void> { - return new Promise(resolve => { + return new Promise((resolve) => { setImmediate(() => { if (fn) { fn(); diff --git a/server/sonar-web/src/main/js/helpers/tokens.ts b/server/sonar-web/src/main/js/helpers/tokens.ts index 4c1f981b13d..83ac35d10b6 100644 --- a/server/sonar-web/src/main/js/helpers/tokens.ts +++ b/server/sonar-web/src/main/js/helpers/tokens.ts @@ -28,11 +28,11 @@ export const EXPIRATION_OPTIONS = [ TokenExpiration.OneMonth, TokenExpiration.ThreeMonths, TokenExpiration.OneYear, - TokenExpiration.NoExpiration -].map(value => { + TokenExpiration.NoExpiration, +].map((value) => { return { value, - label: translate('users.tokens.expiration', value.toString()) + label: translate('users.tokens.expiration', value.toString()), }; }); @@ -40,7 +40,7 @@ const SETTINGS_EXPIRATION_MAP: { [key: string]: TokenExpiration } = { '30 days': TokenExpiration.OneMonth, '90 days': TokenExpiration.ThreeMonths, '1 year': TokenExpiration.OneYear, - 'No expiration': TokenExpiration.NoExpiration + 'No expiration': TokenExpiration.NoExpiration, }; export async function getAvailableExpirationOptions() { @@ -48,7 +48,7 @@ export async function getAvailableExpirationOptions() { * We intentionally fetch all settings, because fetching a specific setting will * return it from the DB as a fallback, even if the setting is not defined at startup. */ - const setting = (await getAllValues()).find(v => v.key === SettingsKey.TokenMaxAllowedLifetime); + const setting = (await getAllValues()).find((v) => v.key === SettingsKey.TokenMaxAllowedLifetime); if (setting === undefined || setting.value === undefined) { return EXPIRATION_OPTIONS; } @@ -56,7 +56,7 @@ export async function getAvailableExpirationOptions() { const maxTokenLifetime = setting.value; if (SETTINGS_EXPIRATION_MAP[maxTokenLifetime] !== TokenExpiration.NoExpiration) { return EXPIRATION_OPTIONS.filter( - option => + (option) => option.value <= SETTINGS_EXPIRATION_MAP[maxTokenLifetime] && option.value !== TokenExpiration.NoExpiration ); diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts index e8f4b31b742..763d0552fc6 100644 --- a/server/sonar-web/src/main/js/helpers/urls.ts +++ b/server/sonar-web/src/main/js/helpers/urls.ts @@ -38,7 +38,7 @@ export interface Location { export enum CodeScope { Overall = 'overall', - New = 'new' + New = 'new', } type CodeScopeType = CodeScope.Overall | CodeScope.New; @@ -68,7 +68,7 @@ export function queryToSearch(query: RawQuery = {}) { * author=a&author=b */ arrayParams.forEach(({ key, values }) => { - values.forEach(value => { + values.forEach((value) => { searchParams.append(key, value); }); }); @@ -106,7 +106,7 @@ export function getProjectUrl( ): Partial<Path> { return { pathname: PROJECT_BASE_URL, - search: queryToSearch({ id: project, branch, ...(codeScope && { code_scope: codeScope }) }) + search: queryToSearch({ id: project, branch, ...(codeScope && { code_scope: codeScope }) }), }; } @@ -120,8 +120,8 @@ export function getProjectQueryUrl( search: queryToSearch({ id: project, ...branchParameters, - ...(codeScope && { code_scope: codeScope }) - }) + ...(codeScope && { code_scope: codeScope }), + }), }; } @@ -132,14 +132,14 @@ export function getPortfolioUrl(key: string): To { export function getPortfolioAdminUrl(key: string): To { return { pathname: '/project/admin/extension/governance/console', - search: queryToSearch({ id: key, qualifier: ComponentQualifier.Portfolio }) + search: queryToSearch({ id: key, qualifier: ComponentQualifier.Portfolio }), }; } export function getApplicationAdminUrl(key: string): To { return { pathname: '/project/admin/extension/developer-server/application-console', - search: queryToSearch({ id: key }) + search: queryToSearch({ id: key }), }; } @@ -151,7 +151,7 @@ export function getComponentBackgroundTaskUrl( return { pathname: '/project/background_tasks', search: queryToSearch({ id: componentKey, status, taskType }), - hash: '' + hash: '', }; } @@ -187,7 +187,7 @@ export function getComponentIssuesUrl(componentKey: string, query?: Query): Path return { pathname: '/project/issues', search: queryToSearch({ ...(query || {}), id: componentKey }), - hash: '' + hash: '', }; } @@ -215,10 +215,10 @@ export function getComponentSecurityHotspotsUrl(componentKey: string, query: Que SecurityStandard.PCI_DSS_3_2, SecurityStandard.PCI_DSS_4_0, SecurityStandard.OWASP_ASVS_4_0, - 'owaspAsvsLevel' - ]) + 'owaspAsvsLevel', + ]), }), - hash: '' + hash: '', }; } @@ -262,7 +262,7 @@ export function getComponentDrilldownUrlWithSelection( metric, branchLike, treemapView: view === 'treemap', - listView: view === 'list' + listView: view === 'list', }); } @@ -273,7 +273,7 @@ export function getMeasureTreemapUrl(componentKey: string, metric: string) { export function getActivityUrl(component: string, branchLike?: BranchLike, graph?: GraphType) { return { pathname: '/project/activity', - search: queryToSearch({ id: component, graph, ...getBranchLikeQuery(branchLike) }) + search: queryToSearch({ id: component, graph, ...getBranchLikeQuery(branchLike) }), }; } @@ -287,8 +287,8 @@ export function getMeasureHistoryUrl(component: string, metric: string, branchLi id: component, graph: 'custom', custom_metrics: metric, - ...getBranchLikeQuery(branchLike) - }) + ...getBranchLikeQuery(branchLike), + }), }; } @@ -308,13 +308,13 @@ export function getQualityProfileUrl(name: string, language: string): To { export function getQualityGateUrl(key: string): To { return { - pathname: '/quality_gates/show/' + encodeURIComponent(key) + pathname: '/quality_gates/show/' + encodeURIComponent(key), }; } export function getQualityGatesUrl(): To { return { - pathname: '/quality_gates' + pathname: '/quality_gates', }; } @@ -324,14 +324,14 @@ export function getGlobalSettingsUrl( ): Partial<Path> { return { pathname: '/admin/settings', - search: queryToSearch({ category, ...query }) + search: queryToSearch({ category, ...query }), }; } export function getProjectSettingsUrl(id: string, category?: string): Partial<Path> { return { pathname: '/project/settings', - search: queryToSearch({ id, category }) + search: queryToSearch({ id, category }), }; } @@ -370,8 +370,8 @@ export function getCodeUrl( id: project, ...getBranchLikeQuery(branchLike), selected, - line: line?.toFixed() - }) + line: line?.toFixed(), + }), }; } |