123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827 |
- /*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
- import { RuleDescriptionSection } from '../apps/coding-rules/rule';
- import { ComponentQualifier } from './component';
- import { MessageFormatting } from './issues';
- import { UserActive, UserBase } from './users';
-
- export type Dict<T> = { [key: string]: T };
- export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
-
- export interface A11ySkipLink {
- key: string;
- label: string;
- weight?: number;
- }
-
- export interface AlmApplication extends IdentityProvider {
- installationUrl: string;
- }
-
- export interface AlmRepository {
- label: string;
- installationKey: string;
- linkedProjectKey?: string;
- linkedProjectName?: string;
- private?: boolean;
- }
-
- export interface AlmUnboundApplication {
- installationId: string;
- key: string;
- name: string;
- }
-
- export interface Breadcrumb {
- key: string;
- name: string;
- qualifier: string;
- }
-
- export namespace Chart {
- export interface Point {
- x: Date;
- y: number | string | undefined;
- }
-
- export interface Serie {
- data: Point[];
- name: string;
- translatedName: string;
- type: string;
- }
- }
-
- export interface Component extends LightComponent {
- alm?: { key: string; url: string };
- analysisDate?: string;
- breadcrumbs: Breadcrumb[];
- canBrowseAllChildProjects?: boolean;
- configuration?: ComponentConfiguration;
- description?: string;
- extensions?: Extension[];
- isFavorite?: boolean;
- leakPeriodDate?: string;
- name: string;
- needIssueSync?: boolean;
- path?: string;
- refKey?: string;
- qualityProfiles?: ComponentQualityProfile[];
- qualityGate?: { isDefault?: boolean; key: string; name: string };
- tags?: string[];
- version?: string;
- visibility?: Visibility;
- }
-
- export interface NavigationComponent
- extends Omit<Component, 'alm' | 'qualifier' | 'leakPeriodDate' | 'path' | 'tags'> {}
-
- interface ComponentConfiguration {
- canApplyPermissionTemplate?: boolean;
- canBrowseProject?: boolean;
- canUpdateProjectVisibilityToPrivate?: boolean;
- extensions?: Extension[];
- showBackgroundTasks?: boolean;
- showHistory?: boolean;
- showLinks?: boolean;
- showQualityGates?: boolean;
- showQualityProfiles?: boolean;
- showPermissions?: boolean;
- showSettings?: boolean;
- showUpdateKey?: boolean;
- }
-
- export interface ComponentQualityProfile {
- deleted?: boolean;
- key: string;
- language: string;
- name: string;
- }
-
- export interface ComponentMeasureIntern {
- analysisDate?: string;
- branch?: string;
- description?: string;
- isFavorite?: boolean;
- isRecentlyBrowsed?: boolean;
- canBrowseAllChildProjects?: boolean;
- key: string;
- match?: string;
- name: string;
- path?: string;
- project?: string;
- qualifier: string;
- refKey?: string;
- }
-
- export interface ComponentMeasure extends ComponentMeasureIntern {
- measures?: Measure[];
- }
-
- export interface ComponentMeasureEnhanced extends ComponentMeasureIntern {
- value?: string;
- leak?: string;
- measures: MeasureEnhanced[];
- }
-
- export interface Condition {
- error: string;
- id: string;
- metric: string;
- op?: string;
- }
-
- export interface CustomMeasure {
- createdAt?: string;
- description?: string;
- id: string;
- metric: {
- key: string;
- name: string;
- domain?: string;
- type: string;
- };
- projectKey: string;
- pending?: boolean;
- user: UserBase;
- value: string;
- updatedAt?: string;
- }
-
- export interface Duplication {
- blocks: DuplicationBlock[];
- }
-
- export interface DuplicationBlock {
- _ref?: string;
- from: number;
- size: number;
- }
-
- export interface DuplicatedFile {
- key: string;
- name: string;
- project: string;
- projectName: string;
- }
-
- export type ExpandDirection = 'up' | 'down';
-
- export interface Extension {
- key: string;
- name: string;
- }
-
- export interface FacetValue<T = string> {
- count: number;
- val: T;
- }
-
- export enum FlowType {
- DATA = 'DATA',
- EXECUTION = 'EXECUTION',
- }
-
- export interface Flow {
- type: FlowType;
- description?: string;
- locations: FlowLocation[];
- }
-
- export interface FlowLocation {
- component: string;
- componentName?: string;
- index?: number;
- msg?: string;
- msgFormattings?: MessageFormatting[];
- textRange: TextRange;
- }
-
- export interface Group {
- default?: boolean;
- description?: string;
- membersCount: number;
- name: string;
- }
-
- export type HealthType = 'RED' | 'YELLOW' | 'GREEN';
-
- export interface IdentityProvider {
- backgroundColor: string;
- helpMessage?: string;
- iconPath: string;
- key: string;
- name: string;
- }
-
- export interface Issue {
- actions: string[];
- assignee?: string;
- assigneeActive?: boolean;
- assigneeAvatar?: string;
- assigneeLogin?: string;
- assigneeName?: string;
- author?: string;
- branch?: string;
- comments?: IssueComment[];
- component: string;
- componentEnabled?: boolean;
- componentLongName: string;
- componentQualifier: string;
- componentUuid: string;
- creationDate: string;
- effort?: string;
- externalRuleEngine?: string;
- fromExternalRule?: boolean;
- quickFixAvailable?: boolean;
- key: string;
- flows: FlowLocation[][];
- flowsWithType: Flow[];
- line?: number;
- message: string;
- messageFormattings?: MessageFormatting[];
- project: string;
- projectName: string;
- projectKey: string;
- pullRequest?: string;
- resolution?: string;
- rule: string;
- ruleDescriptionContextKey?: string;
- ruleName: string;
- ruleStatus?: string;
- secondaryLocations: FlowLocation[];
- severity: string;
- status: string;
- tags?: string[];
- textRange?: TextRange;
- transitions: string[];
- type: IssueType;
- }
-
- export interface IssueChangelog {
- avatar?: string;
- creationDate: string;
- diffs: IssueChangelogDiff[];
- user: string;
- isUserActive: boolean;
- userName: string;
- externalUser?: string;
- webhookSource?: string;
- }
-
- export interface IssueChangelogDiff {
- key: string;
- newValue?: string;
- oldValue?: string;
- }
-
- export interface IssueComment {
- author?: string;
- authorActive?: boolean;
- authorAvatar?: string;
- authorLogin?: string;
- authorName?: string;
- createdAt: string;
- htmlText: string;
- key: string;
- markdown: string;
- updatable: boolean;
- }
-
- export interface IssuesByLine {
- [key: number]: Issue[];
- }
-
- export type IssueType = 'BUG' | 'VULNERABILITY' | 'CODE_SMELL' | 'SECURITY_HOTSPOT';
-
- export interface Language {
- key: string;
- name: string;
- }
-
- export type Languages = Dict<Language>;
-
- export interface LightComponent {
- key: string;
- qualifier: string;
- }
-
- export interface LinearIssueLocation {
- from: number;
- index?: number;
- line: number;
- startLine?: number;
- text?: string;
- textFormatting?: MessageFormatting[];
- to: number;
- }
-
- export interface LineMap {
- [line: number]: SourceLine;
- }
-
- export interface LinePopup {
- index?: number;
- line: number;
- name: string;
- open?: boolean;
- }
-
- export interface Measure extends MeasureIntern {
- metric: string;
- }
-
- export interface MeasureEnhanced extends MeasureIntern {
- metric: Metric;
- leak?: string;
- }
-
- export interface MeasureIntern {
- bestValue?: boolean;
- period?: PeriodMeasure;
- value?: string;
- }
-
- export interface Metric {
- bestValue?: string;
- custom?: boolean;
- decimalScale?: number;
- description?: string;
- direction?: number;
- domain?: string;
- hidden?: boolean;
- higherValuesAreBetter?: boolean;
- id: string;
- key: string;
- name: string;
- qualitative?: boolean;
- type: string;
- worstValue?: string;
- }
-
- export interface MyProject {
- description?: string;
- key: string;
- lastAnalysisDate?: string;
- links: Array<{
- name: string;
- type: string;
- href: string;
- }>;
- name: string;
- qualityGate?: string;
- }
-
- export interface NewCodePeriod {
- type?: NewCodePeriodSettingType;
- value?: string;
- effectiveValue?: string;
- inherited?: boolean;
- }
-
- export interface NewCodePeriodBranch {
- projectKey: string;
- branchKey: string;
- inherited?: boolean;
- type?: NewCodePeriodSettingType;
- value?: string;
- effectiveValue?: string;
- }
-
- export type NewCodePeriodSettingType =
- | 'PREVIOUS_VERSION'
- | 'NUMBER_OF_DAYS'
- | 'SPECIFIC_ANALYSIS'
- | 'REFERENCE_BRANCH';
-
- export interface Paging {
- pageIndex: number;
- pageSize: number;
- total: number;
- }
-
- export interface Period {
- date: string;
- index?: number;
- mode: PeriodMode | NewCodePeriodSettingType;
- modeParam?: string;
- parameter?: string;
- }
-
- export interface PeriodMeasure {
- bestValue?: boolean;
- index: number;
- value: string;
- }
-
- /*
- * These are old baseline setting types, necessary for
- * backward compatibility.
- */
- export type PeriodMode =
- | 'days'
- | 'date'
- | 'version'
- | 'previous_analysis'
- | 'previous_version'
- | 'manual_baseline';
-
- export interface Permission {
- description: string;
- key: string;
- name: string;
- }
-
- export interface PermissionDefinition {
- key: string;
- name: string;
- description: string;
- }
-
- export type PermissionDefinitions = Array<PermissionDefinition | PermissionDefinitionGroup>;
-
- export interface PermissionDefinitionGroup {
- category: string;
- permissions: PermissionDefinition[];
- }
-
- export interface PermissionGroup {
- description?: string;
- id?: string;
- name: string;
- permissions: string[];
- }
-
- export interface PermissionUser extends UserActive {
- permissions: string[];
- }
-
- export interface PermissionTemplateGroup {
- key: string;
- usersCount: number;
- groupsCount: number;
- withProjectCreator?: boolean;
- }
-
- export interface PermissionTemplate {
- defaultFor: string[];
- id: string;
- name: string;
- description?: string;
- projectKeyPattern?: string;
- createdAt: string;
- updatedAt?: string;
- permissions: Array<PermissionTemplateGroup>;
- }
-
- export interface ProfileInheritanceDetails {
- activeRuleCount: number;
- isBuiltIn: boolean;
- key: string;
- name: string;
- overridingRuleCount?: number;
- }
-
- export interface ProjectLink {
- id: string;
- name?: string;
- type: string;
- url: string;
- }
-
- export enum CaycStatus {
- Compliant = 'compliant',
- NonCompliant = 'non-compliant',
- OverCompliant = 'over-compliant',
- }
-
- export interface QualityGate {
- actions?: {
- associateProjects?: boolean;
- copy?: boolean;
- delegate?: boolean;
- delete?: boolean;
- manageConditions?: boolean;
- rename?: boolean;
- setAsDefault?: boolean;
- };
- conditions?: Condition[];
- isBuiltIn?: boolean;
- caycStatus?: CaycStatus;
- isDefault?: boolean;
- name: string;
- }
-
- export type RawQuery = Dict<any>;
-
- export interface Rule {
- isTemplate?: boolean;
- key: string;
- lang?: string;
- langName?: string;
- name: string;
- params?: RuleParameter[];
- severity: string;
- status: string;
- sysTags?: string[];
- tags?: string[];
- type: RuleType;
- }
-
- export interface RuleActivation {
- createdAt: string;
- inherit: RuleInheritance;
- params: { key: string; value: string }[];
- qProfile: string;
- severity: string;
- }
-
- export interface RulesUpdateRequest {
- key: string;
- markdown_description?: string;
- markdown_note?: string;
- name?: string;
- params?: string;
- remediation_fn_base_effort?: string;
- remediation_fn_type?: string;
- remediation_fy_gap_multiplier?: string;
- severity?: string;
- status?: string;
- tags?: string;
- }
-
- export interface RuleDetails extends Rule {
- createdAt: string;
- debtOverloaded?: boolean;
- debtRemFnCoeff?: string;
- debtRemFnOffset?: string;
- debtRemFnType?: string;
- defaultDebtRemFnOffset?: string;
- defaultDebtRemFnType?: string;
- defaultRemFnBaseEffort?: string;
- defaultRemFnType?: string;
- descriptionSections?: RuleDescriptionSection[];
- educationPrinciples?: string[];
- effortToFixDescription?: string;
- htmlDesc?: string;
- htmlNote?: string;
- internalKey?: string;
- isExternal?: boolean;
- mdDesc?: string;
- mdNote?: string;
- remFnBaseEffort?: string;
- remFnOverloaded?: boolean;
- remFnType?: string;
- repo: string;
- scope?: RuleScope;
- templateKey?: string;
- }
-
- export type RuleInheritance = 'NONE' | 'INHERITED' | 'OVERRIDES';
-
- export interface RuleParameter {
- defaultValue?: string;
- htmlDesc?: string;
- key: string;
- type: string;
- }
-
- export type RuleScope = 'MAIN' | 'TEST' | 'ALL';
-
- export type RuleType = 'BUG' | 'VULNERABILITY' | 'CODE_SMELL' | 'SECURITY_HOTSPOT' | 'UNKNOWN';
-
- export interface Snippet {
- start: number;
- end: number;
- index: number;
- toDelete?: boolean;
- }
-
- export interface SnippetGroup extends SnippetsByComponent {
- locations: FlowLocation[];
- }
- export interface SnippetsByComponent {
- component: SourceViewerFile;
- sources: { [line: number]: SourceLine };
- }
-
- export interface SourceLine {
- code?: string;
- conditions?: number;
- coverageStatus?: SourceLineCoverageStatus;
- coveredConditions?: number;
- duplicated?: boolean;
- isNew?: boolean;
- line: number;
- lineHits?: number;
- scmAuthor?: string;
- scmDate?: string;
- scmRevision?: string;
- }
-
- export type SourceLineCoverageStatus = 'uncovered' | 'partially-covered' | 'covered';
-
- export interface SourceViewerFile {
- fav?: boolean;
- key: string;
- leakPeriodDate?: string;
- measures: {
- coverage?: string;
- duplicationDensity?: string;
- issues?: string;
- lines?: string;
- tests?: string;
- };
- canMarkAsFavorite?: boolean;
- path: string;
- name?: string;
- longName?: string;
- project: string;
- projectName: string;
- q: ComponentQualifier;
- uuid: string;
- }
-
- export type StandardSecurityCategories = Dict<{ title: string; description?: string }>;
-
- export type Status = 'ERROR' | 'OK';
-
- export interface SubscriptionPlan {
- maxNcloc: number;
- price: number;
- }
-
- export interface SuggestionLink {
- link: string;
- scope?: 'sonarcloud';
- text: string;
- }
-
- export interface SysInfoAppNode extends SysInfoBase {
- 'Compute Engine Logging': SysInfoLogging;
- Name: string;
- 'Web Logging': SysInfoLogging;
- }
-
- export interface SysInfoBase extends SysInfoValueObject {
- Health: HealthType;
- 'Health Causes': string[];
- Plugins?: Dict<string>;
- System: {
- Version: string;
- };
- }
-
- export interface SysInfoCluster extends SysInfoBase {
- 'Application Nodes': SysInfoAppNode[];
- 'Search Nodes': SysInfoSearchNode[];
- Settings: Dict<string>;
- Statistics?: {
- ncloc: number;
- };
- System: {
- 'High Availability': true;
- 'Server ID': string;
- Version: string;
- };
- }
-
- export interface SysInfoLogging extends Dict<string> {
- 'Logs Level': string;
- }
-
- export interface SysInfoSearchNode extends SysInfoValueObject {
- Name: string;
- }
-
- export interface SysInfoSection extends Dict<SysInfoValueObject> {}
-
- export interface SysInfoStandalone extends SysInfoBase {
- 'Compute Engine Logging': SysInfoLogging;
- Settings: Dict<string>;
- Statistics?: {
- ncloc: number;
- } & Dict<string | number>;
- System: {
- 'High Availability': false;
- 'Server ID': string;
- Version: string;
- };
- 'Web Logging': SysInfoLogging;
- }
-
- export type SysInfoValue =
- | boolean
- | string
- | number
- | undefined
- | HealthType
- | SysInfoValueObject
- | SysInfoValueArray;
-
- export interface SysInfoValueArray extends Array<SysInfoValue> {}
-
- export interface SysInfoValueObject extends Dict<SysInfoValue> {}
-
- export type SysStatus =
- | 'STARTING'
- | 'UP'
- | 'DOWN'
- | 'RESTARTING'
- | 'DB_MIGRATION_NEEDED'
- | 'DB_MIGRATION_RUNNING';
-
- export interface TestCase {
- coveredLines: number;
- durationInMs: number;
- fileId: string;
- fileKey: string;
- fileName: string;
- id: string;
- message?: string;
- name: string;
- stacktrace?: string;
- status: string;
- }
-
- export interface TextRange {
- startLine: number;
- startOffset: number;
- endLine: number;
- endOffset: number;
- }
-
- export interface UserSelected extends UserActive {
- selected: boolean;
- }
-
- export type Visibility = 'public' | 'private';
-
- export namespace WebApi {
- export interface Action {
- key: string;
- changelog: Changelog[];
- description: string;
- deprecatedSince?: string;
- hasResponseExample: boolean;
- internal: boolean;
- params?: Param[];
- post: boolean;
- since?: string;
- }
-
- export interface Changelog {
- description: string;
- version: string;
- }
-
- export interface Domain {
- actions: Action[];
- deprecatedSince?: string;
- description: string;
- internal?: boolean;
- path: string;
- since?: string;
- }
-
- export interface Example {
- example: string;
- format: string;
- }
-
- export interface Param {
- defaultValue?: string;
- deprecatedKey?: string;
- deprecatedKeySince?: string;
- deprecatedSince?: string;
- description: string;
- exampleValue?: string;
- internal: boolean;
- key: string;
- maximumLength?: number;
- maximumValue?: number;
- maxValuesAllowed?: number;
- minimumLength?: number;
- minimumValue?: number;
- possibleValues?: string[];
- required: boolean;
- since?: string;
- }
- }
|