modified: Array<{
key: string;
name: string;
- left: { params: { [p: string]: string }; severity: string };
- right: { params: { [p: string]: string }; severity: string };
+ left: { params: T.Dict<string>; severity: string };
+ right: { params: T.Dict<string>; severity: string };
}>;
}
export function activateRule(data: {
key: string;
organization: string | undefined;
- params?: { [key: string]: string };
+ params?: T.Dict<string>;
reset?: boolean;
rule: string;
severity?: string;
}
export interface SearchRulesResponse {
- actives?: { [rule: string]: T.RuleActivation[] };
+ actives?: T.Dict<T.RuleActivation[]>;
facets?: { property: string; values: { count: number; val: string }[] }[];
p: number;
ps: number;
import { SuggestionsContext } from './SuggestionsContext';
import { isSonarCloud } from '../../../helpers/system';
-interface SuggestionsJson {
- [key: string]: T.SuggestionLink[];
-}
+type SuggestionsJson = T.Dict<T.SuggestionLink[]>;
interface State {
suggestions: T.SuggestionLink[];
loadingMore?: string;
more: More;
open: boolean;
- organizations: { [key: string]: { name: string } };
- projects: { [key: string]: { name: string } };
+ organizations: T.Dict<{ name: string }>;
+ projects: T.Dict<{ name: string }>;
query: string;
results: Results;
selected?: string;
export class Search extends React.PureComponent<Props, State> {
input?: HTMLInputElement | null;
node?: HTMLElement | null;
- nodes: { [x: string]: HTMLElement };
+ nodes: T.Dict<HTMLElement>;
mounted = false;
constructor(props: Props) {
innerRef: (componentKey: string, node: HTMLElement | null) => void;
onClose: () => void;
onSelect: (componentKey: string) => void;
- organizations: { [key: string]: { name: string } };
- projects: { [key: string]: { name: string } };
+ organizations: T.Dict<{ name: string }>;
+ projects: T.Dict<{ name: string }>;
selected: boolean;
}
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
declare namespace T {
+ export type Dict<T> = { [key: string]: T };
+
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
// Type ordered alphabetically to prevent merge conflicts
organizationsEnabled?: boolean;
productionDatabase: boolean;
qualifiers: string[];
- settings: { [key: string]: string };
+ settings: T.Dict<string>;
standalone?: boolean;
version: string;
}
name: string;
}
- export interface Languages {
- [key: string]: Language;
- }
+ export type Languages = T.Dict<Language>;
export interface LightComponent {
key: string;
}
export interface SettingValue {
- fieldValues?: Array<{ [key: string]: string }>;
+ fieldValues?: Array<T.Dict<string>>;
inherited?: boolean;
key: string;
- parentFieldValues?: Array<{ [key: string]: string }>;
+ parentFieldValues?: Array<T.Dict<string>>;
parentValue?: string;
parentValues?: string[];
value?: string;
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-const extensions: { [key: string]: Function } = {};
+const extensions: T.Dict<Function> = {};
const registerExtension = (key: string, start: Function) => {
extensions[key] = start;
}
interface State {
- issueTypes?: { [key: string]: { count: number } };
+ issueTypes?: T.Dict<{ count: number }>;
loading: boolean;
projectsCount: number;
}
export interface Props {
addNotification: (n: T.Notification) => void;
channels: string[];
- notificationsByProject: { [project: string]: T.Notification[] };
+ notificationsByProject: T.Dict<T.Notification[]>;
projects: NotificationProject[];
removeNotification: (n: T.Notification) => void;
types: string[];
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-let bucket: { [key: string]: T.ComponentMeasure } = {};
-let childrenBucket: {
- [key: string]: {
- children: T.ComponentMeasure[];
- page: number;
- total: number;
- };
-} = {};
-let breadcrumbsBucket: { [key: string]: T.Breadcrumb[] } = {};
+let bucket: T.Dict<T.ComponentMeasure> = {};
+let childrenBucket: T.Dict<{
+ children: T.ComponentMeasure[];
+ page: number;
+ total: number;
+}> = {};
+let breadcrumbsBucket: T.Dict<T.Breadcrumb[]> = {};
export function addComponent(component: T.ComponentMeasure): void {
bucket[component.key] = component;
import '../code.css';
interface StateToProps {
- metrics: { [metric: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
}
interface DispatchToProps {
baseComponent?: T.ComponentMeasure;
branchLike?: T.BranchLike;
components: T.ComponentMeasure[];
- metrics: { [metric: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
rootComponent: T.ComponentMeasure;
selected?: T.ComponentMeasure;
}
}
interface State {
- params: { [p: string]: string };
+ params: T.Dict<string>;
profile: string;
severity: string;
submitting: boolean;
}
getParams = ({ activation, rule } = this.props) => {
- const params: { [p: string]: string } = {};
+ const params: T.Dict<string> = {};
if (rule && rule.params) {
for (const param of rule.params) {
params[param.key] = param.defaultValue || '';
openRule?: T.Rule;
paging?: T.Paging;
query: Query;
- referencedProfiles: { [profile: string]: Profile };
- referencedRepositories: { [repository: string]: { key: string; language: string; name: string } };
+ referencedProfiles: T.Dict<Profile>;
+ referencedRepositories: T.Dict<{ key: string; language: string; name: string }>;
rules: T.Rule[];
selected?: string;
}
}
}
-function parseActives(rawActives: { [rule: string]: T.RuleActivation[] }) {
+function parseActives(rawActives: T.Dict<T.RuleActivation[]>) {
const actives: Actives = {};
for (const [rule, activations] of Object.entries(rawActives)) {
actives[rule] = {};
function parseFacets(rawFacets: { property: string; values: { count: number; val: string }[] }[]) {
const facets: Facets = {};
for (const rawFacet of rawFacets) {
- const values: { [value: string]: number } = {};
+ const values: T.Dict<number> = {};
for (const rawValue of rawFacet.values) {
values[rawValue.val] = rawValue.count;
}
languages: T.Languages;
organization: string | undefined;
query: Query;
- referencedProfiles: { [profile: string]: Profile };
+ referencedProfiles: T.Dict<Profile>;
total: number;
}
organization: string | undefined;
profile?: Profile;
query: Query;
- referencedProfiles: { [profile: string]: Profile };
+ referencedProfiles: T.Dict<Profile>;
total: number;
}
key: string;
keyModifiedByUser: boolean;
name: string;
- params: { [p: string]: string };
+ params: T.Dict<string>;
reactivating: boolean;
severity: string;
status: string;
constructor(props: Props) {
super(props);
- const params: { [p: string]: string } = {};
+ const params: T.Dict<string> = {};
if (props.customRule && props.customRule.params) {
for (const param of props.customRule.params) {
params[param.key] = param.defaultValue || '';
import { formatMeasure } from '../../../helpers/measures';
export interface BasicProps {
- onChange: (changes: { [x: string]: string | string[] | undefined }) => void;
+ onChange: (changes: T.Dict<string | string[] | undefined>) => void;
onToggle: (facet: FacetKey) => void;
open: boolean;
- stats?: { [x: string]: number };
+ stats?: T.Dict<number>;
values: string[];
}
organization: string | undefined;
organizationsEnabled?: boolean;
query: Query;
- referencedProfiles: { [profile: string]: Profile };
- referencedRepositories: { [repository: string]: { key: string; language: string; name: string } };
+ referencedProfiles: T.Dict<Profile>;
+ referencedRepositories: T.Dict<{ key: string; language: string; name: string }>;
selectedProfile?: Profile;
}
onChange: (changes: Partial<Query>) => void;
onToggle: (facet: FacetKey) => void;
open: boolean;
- referencedProfiles: { [profile: string]: Profile };
+ referencedProfiles: T.Dict<Profile>;
value: string | undefined;
}
import { getLanguages, Store } from '../../../store/rootReducer';
interface StateProps {
- referencedLanguages: { [language: string]: { key: string; name: string } };
+ referencedLanguages: T.Dict<{ key: string; name: string }>;
}
interface Props extends BasicProps, StateProps {
- referencedRepositories: { [repository: string]: { key: string; language: string; name: string } };
+ referencedRepositories: T.Dict<{ key: string; language: string; name: string }>;
}
class RepositoryFacet extends React.PureComponent<Props> {
onDelete: (rule: string) => void;
onFilterChange: (changes: Partial<Query>) => void;
organization: string | undefined;
- referencedProfiles: { [profile: string]: Profile };
- referencedRepositories: { [repository: string]: { key: string; language: string; name: string } };
+ referencedProfiles: T.Dict<Profile>;
+ referencedRepositories: T.Dict<{ key: string; language: string; name: string }>;
ruleKey: string;
selectedProfile?: Profile;
}
onFilterChange: (changes: Partial<Query>) => void;
onTagsChange: (tags: string[]) => void;
organization: string | undefined;
- referencedRepositories: { [repository: string]: { key: string; language: string; name: string } };
+ referencedRepositories: T.Dict<{ key: string; language: string; name: string }>;
ruleDetails: T.RuleDetails;
}
onActivate: () => Promise<void>;
onDeactivate: () => Promise<void>;
organization: string | undefined;
- referencedProfiles: { [profile: string]: Profile };
+ referencedProfiles: T.Dict<Profile>;
ruleDetails: T.RuleDetails;
}
leakPeriod?: T.Period;
loading: boolean;
measures: T.MeasureEnhanced[];
- metrics: { [metric: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
}
export class App extends React.PureComponent<Props, State> {
branchLike?: T.BranchLike;
leakPeriod?: T.Period;
requestedMetric: Pick<T.Metric, 'key' | 'direction'>;
- metrics: { [metric: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
rootComponent: T.ComponentMeasure;
router: InjectedRouter;
selected?: string;
domain: string;
leakPeriod?: T.Period;
loading: boolean;
- metrics: { [metric: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
rootComponent: T.ComponentMeasure;
- updateLoading: (param: { [key: string]: boolean }) => void;
+ updateLoading: (param: T.Dict<boolean>) => void;
updateSelected: (component: string) => void;
}
className?: string;
domain: string;
leakPeriod?: T.Period;
- metrics: { [metric: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
rootComponent: T.ComponentMeasure;
router: InjectedRouter;
selected?: string;
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-export const complementary: { [metric: string]: string[] } = {
+export const complementary: T.Dict<string[]> = {
coverage: ['uncovered_lines', 'uncovered_conditions'],
line_coverage: ['uncovered_lines'],
branch_coverage: ['uncovered_conditions'],
component: T.ComponentMeasure;
components: T.ComponentMeasureEnhanced[];
domain: string;
- metrics: { [metric: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
updateSelected: (component: string) => void;
}
components: T.ComponentMeasureEnhanced[];
onClick: (component: string) => void;
metric: T.Metric;
- metrics: { [metric: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
rootComponent: T.ComponentMeasure;
selectedComponent?: string;
view: View;
handleOpen: (component: string) => void;
loadingMore: boolean;
metric: T.Metric;
- metrics: { [metric: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
paging?: T.Paging;
rootComponent: T.ComponentMeasure;
selectedKey?: string;
}
interface State {
- openFacets: { [metric: string]: boolean };
+ openFacets: T.Dict<boolean>;
}
export default class Sidebar extends React.PureComponent<Props, State> {
}
}
-function getOpenFacets(
- openFacets: { [metric: string]: boolean },
- { measures, selectedMetric }: Props
-) {
+function getOpenFacets(openFacets: T.Dict<boolean>, { measures, selectedMetric }: Props) {
const newOpenFacets = { ...openFacets };
const measure = measures.find(measure => measure.metric.key === selectedMetric);
if (measure && measure.metric && measure.metric.domain) {
export function enhanceComponent(
component: T.ComponentMeasure,
metric: Pick<T.Metric, 'key'> | undefined,
- metrics: { [key: string]: T.Metric }
+ metrics: T.Dict<T.Metric>
): T.ComponentMeasureEnhanced {
if (!component.measures) {
return { ...component, measures: [] };
return !branch || isLongLivingBranch(branch) || isMainBranch(branch);
}
-export function getMeasuresPageMetricKeys(
- metrics: { [key: string]: T.Metric },
- branch?: T.BranchLike
-) {
+export function getMeasuresPageMetricKeys(metrics: T.Dict<T.Metric>, branch?: T.BranchLike) {
const metricKeys = getDisplayMetrics(Object.values(metrics)).map(metric => metric.key);
if (isPullRequest(branch) || isShortLivingBranch(branch)) {
}
}
-export function getBubbleMetrics(domain: string, metrics: { [key: string]: T.Metric }) {
+export function getBubbleMetrics(domain: string, metrics: T.Dict<T.Metric>) {
const conf = bubbles[domain];
return {
x: metrics[conf.x],
organization: T.Organization;
}
-type SelectedRepositories = { [key: string]: T.AlmRepository | undefined };
+type SelectedRepositories = T.Dict<T.AlmRepository | undefined>;
interface State {
highlight: boolean;
export interface SearchResult {
exactMatch?: boolean;
- highlights: { [field: string]: [number, number][] };
+ highlights: T.Dict<[number, number][]>;
longestTerm: string;
page: DocumentationEntry;
query: string;
)
.map(match => {
const page = this.props.pages.find(page => page.relativeName === match.ref);
- const highlights: { [field: string]: [number, number][] } = {};
+ const highlights: T.Dict<[number, number][]> = {};
let longestTerm = '';
let exactMatch = false;
checkAll?: boolean;
checked: string[];
effortTotal?: number;
- facets: { [facet: string]: Facet };
+ facets: T.Dict<Facet>;
issues: T.Issue[];
loading: boolean;
- loadingFacets: { [key: string]: boolean };
+ loadingFacets: T.Dict<boolean>;
loadingMore: boolean;
locationsNavigator: boolean;
myIssues: boolean;
- openFacets: { [facet: string]: boolean };
+ openFacets: T.Dict<boolean>;
openIssue?: T.Issue;
openPopup?: { issue: string; name: string };
paging?: T.Paging;
query: Query;
- referencedComponentsById: { [id: string]: ReferencedComponent };
- referencedComponentsByKey: { [key: string]: ReferencedComponent };
- referencedLanguages: { [languageKey: string]: ReferencedLanguage };
- referencedRules: { [ruleKey: string]: ReferencedRule };
- referencedUsers: { [login: string]: ReferencedUser };
+ referencedComponentsById: T.Dict<ReferencedComponent>;
+ referencedComponentsByKey: T.Dict<ReferencedComponent>;
+ referencedLanguages: T.Dict<ReferencedLanguage>;
+ referencedRules: T.Dict<ReferencedRule>;
+ referencedUsers: T.Dict<ReferencedUser>;
selected?: string;
selectedFlowIndex?: number;
selectedLocationIndex?: number;
};
getAvailableTransitions(issues: T.Issue[]) {
- const transitions: { [x: string]: number } = {};
+ const transitions: T.Dict<number> = {};
issues.forEach(issue => {
if (issue.transitions) {
issue.transitions.forEach(t => {
open: boolean;
organization: string | undefined;
query: Query;
- stats: { [x: string]: number } | undefined;
- referencedUsers: { [login: string]: ReferencedUser };
+ stats: T.Dict<number> | undefined;
+ referencedUsers: T.Dict<ReferencedUser>;
}
export default class AssigneeFacet extends React.PureComponent<Props> {
open: boolean;
organization: string | undefined;
query: Query;
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
authors: string[];
}
onToggle: (property: string) => void;
open: boolean;
sinceLeakPeriod: boolean;
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
}
class CreationDateFacet extends React.PureComponent<Props & InjectedIntlProps> {
onToggle: (property: string) => void;
open: boolean;
query: Query;
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
}
export default class DirectoryFacet extends React.PureComponent<Props> {
onToggle: (property: string) => void;
open: boolean;
query: Query;
- referencedComponents: { [componentKey: string]: ReferencedComponent };
- stats: { [x: string]: number } | undefined;
+ referencedComponents: T.Dict<ReferencedComponent>;
+ stats: T.Dict<number> | undefined;
}
export default class FileFacet extends React.PureComponent<Props> {
onToggle: (property: string) => void;
open: boolean;
query: Query;
- referencedLanguages: { [languageKey: string]: ReferencedLanguage };
- stats: { [x: string]: number } | undefined;
+ referencedLanguages: T.Dict<ReferencedLanguage>;
+ stats: T.Dict<number> | undefined;
}
class LanguageFacet extends React.PureComponent<Props> {
organization: { key: string } | undefined;
projects: string[];
query: Query;
- referencedComponents: { [componentKey: string]: ReferencedComponent };
- stats: { [x: string]: number } | undefined;
+ referencedComponents: T.Dict<ReferencedComponent>;
+ stats: T.Dict<number> | undefined;
}
interface SearchedProject {
open: boolean;
resolved: boolean;
resolutions: string[];
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
}
const RESOLUTIONS = ['', 'FIXED', 'FALSE-POSITIVE', 'WONTFIX', 'REMOVED'];
open: boolean;
organization: string | undefined;
query: Query;
- referencedRules: { [ruleKey: string]: ReferencedRule };
+ referencedRules: T.Dict<ReferencedRule>;
rules: string[];
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
}
export default class RuleFacet extends React.PureComponent<Props> {
onToggle: (property: string) => void;
open: boolean;
severities: string[];
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
}
const SEVERITIES = ['BLOCKER', 'MINOR', 'CRITICAL', 'INFO', 'MAJOR'];
export interface Props {
component: T.Component | undefined;
- facets: { [facet: string]: Facet };
+ facets: T.Dict<Facet>;
hideAuthorFacet?: boolean;
loadSearchResultCount: (property: string, changes: Partial<Query>) => Promise<Facet>;
- loadingFacets: { [key: string]: boolean };
+ loadingFacets: T.Dict<boolean>;
myIssues: boolean;
onFacetToggle: (property: string) => void;
onFilterChange: (changes: Partial<Query>) => void;
- openFacets: { [facet: string]: boolean };
+ openFacets: T.Dict<boolean>;
organization: { key: string } | undefined;
query: Query;
- referencedComponentsById: { [id: string]: ReferencedComponent };
- referencedComponentsByKey: { [key: string]: ReferencedComponent };
- referencedLanguages: { [languageKey: string]: ReferencedLanguage };
- referencedRules: { [ruleKey: string]: ReferencedRule };
- referencedUsers: { [login: string]: ReferencedUser };
+ referencedComponentsById: T.Dict<ReferencedComponent>;
+ referencedComponentsByKey: T.Dict<ReferencedComponent>;
+ referencedLanguages: T.Dict<ReferencedLanguage>;
+ referencedRules: T.Dict<ReferencedRule>;
+ referencedUsers: T.Dict<ReferencedUser>;
}
export default class Sidebar extends React.PureComponent<Props> {
export interface Props {
cwe: string[];
cweOpen: boolean;
- cweStats: { [x: string]: number } | undefined;
+ cweStats: T.Dict<number> | undefined;
fetchingOwaspTop10: boolean;
fetchingSansTop25: boolean;
fetchingCwe: boolean;
open: boolean;
owaspTop10: string[];
owaspTop10Open: boolean;
- owaspTop10Stats: { [x: string]: number } | undefined;
+ owaspTop10Stats: T.Dict<number> | undefined;
query: Query;
sansTop25: string[];
sansTop25Open: boolean;
- sansTop25Stats: { [x: string]: number } | undefined;
+ sansTop25Stats: T.Dict<number> | undefined;
}
interface State {
onChange: (changes: Partial<Query>) => void;
onToggle: (property: string) => void;
open: boolean;
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
statuses: string[];
}
open: boolean;
organization: string | undefined;
query: Query;
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
tags: string[];
}
onChange: (changes: Partial<Query>) => void;
onToggle: (property: string) => void;
open: boolean;
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
types: string[];
}
}
export function mapFacet(facet: string) {
- const propertyMapping: { [x: string]: string } = {
+ const propertyMapping: T.Dict<string> = {
files: 'fileUuids',
modules: 'moduleUuids'
};
return propertyMapping[facet] || facet;
}
-export function parseFacets(facets: RawFacet[]): { [x: string]: Facet } {
+export function parseFacets(facets: RawFacet[]): T.Dict<Facet> {
if (!facets) {
return {};
}
// for readability purpose
- const propertyMapping: { [x: string]: string } = {
+ const propertyMapping: T.Dict<string> = {
fileUuids: 'files',
moduleUuids: 'modules'
};
- const result: { [x: string]: Facet } = {};
+ const result: T.Dict<Facet> = {};
facets.forEach(facet => {
const values: Facet = {};
facet.values.forEach(value => {
}
interface State {
- userGroups?: { [k: string]: UserGroup & { status?: string } };
+ userGroups?: T.Dict<UserGroup & { status?: string }>;
loading?: boolean;
}
import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
interface Props {
- location: { pathname: string; query: { [x: string]: string } };
+ location: { pathname: string; query: T.Dict<string> };
organization: T.Organization;
}
interface Props {
className?: string;
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
options: BadgeOptions;
type: BadgeType;
updateOptions: (options: Partial<BadgeOptions>) => void;
interface Props {
branchLike?: T.BranchLike;
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
project: string;
qualifier: string;
}
component: T.Component;
fetchMetrics: () => void;
onComponentChange: (changes: {}) => void;
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
}
interface State {
metrics: metrics.join()
}).then(r => {
if (this.mounted) {
- const history: { [metric: string]: Array<{ date: Date; value?: string }> } = {};
+ const history: T.Dict<Array<{ date: Date; value?: string }>> = {};
r.measures.forEach(measure => {
const measureHistory = measure.history.map(analysis => ({
date: parseDate(analysis.date),
history?: {
[metric: string]: Array<{ date: Date; value?: string }>;
};
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
qualifier: string;
}
[metric: string]: Array<{ date: Date; value?: string }>;
};
measures?: T.MeasureEnhanced[];
- metrics?: { [key: string]: T.Metric };
+ metrics?: T.Dict<T.Metric>;
onComponentChange: (changes: {}) => void;
}
}
interface State {
- deprecatedByKey: { [key: string]: number };
+ deprecatedByKey: T.Dict<number>;
}
class MetaQualityProfiles extends React.PureComponent<StateProps & OwnProps, State> {
Promise.all(requests).then(
responses => {
if (this.mounted) {
- const deprecatedByKey: { [key: string]: number } = {};
+ const deprecatedByKey: T.Dict<number> = {};
responses.forEach((count, i) => {
const profileKey = this.props.profiles[i].key;
deprecatedByKey[profileKey] = count;
type State = {
loading: boolean;
- metrics?: { [key: string]: T.Metric };
+ metrics?: T.Dict<T.Metric>;
projects?: ApplicationProject[];
status?: string;
};
import { ApplicationProject, ConditionAnalysis } from '../../../api/quality-gates';
interface Props {
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
project: ApplicationProject;
}
}
}
- getIssuesUrl = (sinceLeakPeriod: boolean, customQuery: { [x: string]: string }) => {
- const query: { [x: string]: string | undefined } = {
+ getIssuesUrl = (sinceLeakPeriod: boolean, customQuery: T.Dict<string>) => {
+ const query: T.Dict<string | undefined> = {
resolved: 'false',
...getBranchLikeQuery(this.props.branchLike),
...customQuery
const metricKey = condition.measure.metric.key;
- const RATING_METRICS_MAPPING: { [metric: string]: [string, boolean] } = {
+ const RATING_METRICS_MAPPING: T.Dict<[string, boolean]> = {
reliability_rating: ['BUG', false],
new_reliability_rating: ['BUG', true],
security_rating: ['VULNERABILITY', false],
}
interface State {
- initialPermissionsCount: { [key: string]: number };
+ initialPermissionsCount: T.Dict<number>;
}
export default class HoldersList extends React.PureComponent<Props, State> {
state: State = { initialPermissionsCount: {} };
export const PERMISSIONS_ORDER_FOR_DEV = ['user', 'admin'];
-export const PERMISSIONS_ORDER_BY_QUALIFIER: { [index: string]: string[] } = {
+export const PERMISSIONS_ORDER_BY_QUALIFIER: T.Dict<string[]> = {
TRK: PERMISSIONS_ORDER_FOR_PROJECT_TEMPLATE,
VW: PERMISSIONS_ORDER_FOR_VIEW,
SVW: PERMISSIONS_ORDER_FOR_VIEW,
interface Props {
component: string;
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
}
interface State {
return getAllTimeMachineData({ component, metrics: graphMetrics.join() }).then(
timeMachine => {
if (this.mounted) {
- const history: { [metric: string]: Array<{ date: Date; value?: string }> } = {};
+ const history: T.Dict<Array<{ date: Date; value?: string }>> = {};
timeMachine.measures.forEach(measure => {
const measureHistory = measure.history.map(analysis => ({
date: parseDate(analysis.date),
}
interface StateToProps {
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
}
interface DispatchToProps {
interface State {
loading: boolean;
- measures?: { [key: string]: string | undefined };
+ measures?: T.Dict<string | undefined>;
subComponents?: SubComponent[];
totalSubComponents?: number;
}
interface Props {
component: string;
- measures: { [key: string]: string | undefined };
+ measures: T.Dict<string | undefined>;
}
export default function MaintainabilityBox({ component, measures }: Props) {
interface Props {
component: string;
- measures: { [key: string]: string | undefined };
+ measures: T.Dict<string | undefined>;
}
export default function ReleasabilityBox({ component, measures }: Props) {
interface Props {
component: string;
- measures: { [key: string]: string | undefined };
+ measures: T.Dict<string | undefined>;
}
export default function ReliabilityBox({ component, measures }: Props) {
interface Props {
component: string;
- measures: { [key: string]: string | undefined };
+ measures: T.Dict<string | undefined>;
}
export default function SecurityBox({ component, measures }: Props) {
interface Props {
component: { description?: string; key: string };
- measures: { [key: string]: string | undefined };
+ measures: T.Dict<string | undefined>;
}
export default function Summary({ component, measures }: Props) {
);
}
-function renderCell(measures: { [key: string]: string | undefined }, metric: string, type: string) {
+function renderCell(measures: T.Dict<string | undefined>, metric: string, type: string) {
return (
<td className="text-center">
<Measure metricKey={metric} metricType={type} value={measures[metric]} />
);
}
-function renderNcloc(measures: { [key: string]: string | undefined }, maxLoc: number) {
+function renderNcloc(measures: T.Dict<string | undefined>, maxLoc: number) {
const ncloc = Number(measures['ncloc'] || 0);
const barWidth = maxLoc > 0 ? Math.max(1, Math.round((ncloc / maxLoc) * 50)) : 0;
return (
*/
export interface SubComponent {
key: string;
- measures: { [key: string]: string | undefined };
+ measures: T.Dict<string | undefined>;
name: string;
refKey?: string;
qualifier: string;
function getWorstSeverity(data: string): { severity: string; count: number } | undefined {
const SEVERITY_ORDER = ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO'];
- const severities: { [key: string]: number } = {};
+ const severities: T.Dict<number> = {};
data.split(';').forEach(equality => {
const [key, count] = equality.split('=');
severities[key] = Number(count);
];
export function convertMeasures(measures: Array<{ metric: string; value?: string }>) {
- const result: { [key: string]: string | undefined } = {};
+ const result: T.Dict<string | undefined> = {};
measures.forEach(measure => {
result[measure.metric] = measure.value;
});
value: string;
}
-const METRIC_RATING: { [x: string]: string } = {
+const METRIC_RATING: T.Dict<string> = {
bugs: 'reliability_rating',
vulnerabilities: 'security_rating',
code_smells: 'sqale_rating'
export const APPLICATION_EVENT_TYPES = ['QUALITY_GATE', 'DEFINITION_CHANGE', 'OTHER'];
export const DEFAULT_GRAPH = 'issues';
export const GRAPH_TYPES = ['issues', 'coverage', 'duplications', 'custom'];
-export const GRAPHS_METRICS_DISPLAYED: { [x: string]: string[] } = {
+export const GRAPHS_METRICS_DISPLAYED: T.Dict<string[]> = {
issues: ['bugs', 'code_smells', 'vulnerabilities'],
coverage: ['lines_to_cover', 'uncovered_lines'],
duplications: ['ncloc', 'duplicated_lines']
};
-export const GRAPHS_METRICS: { [x: string]: string[] } = {
+export const GRAPHS_METRICS: T.Dict<string[]> = {
issues: GRAPHS_METRICS_DISPLAYED['issues'].concat([
'reliability_rating',
'security_rating',
};
}
-function findMetric(key: string, metrics: T.Metric[] | { [key: string]: T.Metric }) {
+function findMetric(key: string, metrics: T.Metric[] | T.Dict<T.Metric>) {
if (Array.isArray(metrics)) {
return metrics.find(metric => metric.key === key);
}
export function generateSeries(
measuresHistory: MeasureHistory[],
graph: string,
- metrics: T.Metric[] | { [key: string]: T.Metric },
+ metrics: T.Metric[] | T.Dict<T.Metric>,
displayedMetrics: string[]
): Serie[] {
if (displayedMetrics.length <= 0 || typeof measuresHistory === 'undefined') {
}
interface AnalysesByDay {
- byDay: { [x: string]: ParsedAnalysis[] };
+ byDay: T.Dict<ParsedAnalysis[]>;
version: string | null;
key: string | null;
}
import { translate } from '../../../helpers/l10n';
interface Props {
- measures: { [key: string]: string };
+ measures: T.Dict<string>;
}
export default function ProjectCardLeakMeasures({ measures }: Props) {
import VulnerabilityIcon from '../../../components/icons-components/VulnerabilityIcon';
interface Props {
- measures: { [key: string]: string | undefined };
+ measures: T.Dict<string | undefined>;
}
export default function ProjectCardOverallMeasures({ measures }: Props) {
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
property?: string;
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
property?: string;
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
className?: string;
onQueryChange: (change: RawQuery) => void;
options: Option[];
- query: { [x: string]: any };
+ query: T.Dict<any>;
renderOption: (option: Option, isSelected: boolean) => React.ReactNode;
value?: Option | Option[];
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
property: string;
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
property?: string;
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: string[];
}
maxFacetValue?: number;
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
property?: string;
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
maxFacetValue?: number;
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
maxFacetValue?: number;
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
maxFacetValue?: number;
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
maxFacetValue?: number;
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
maxFacetValue?: number;
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
options: Array<{ label: string; value: string }>;
organization?: { key: string };
property: string;
- query: { [x: string]: any };
+ query: T.Dict<any>;
}
export default class SearchableFilterFooter extends React.PureComponent<Props> {
maxFacetValue?: number;
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
property?: string;
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: any;
}
onQueryChange: (change: RawQuery) => void;
organization?: { key: string };
property?: string;
- query: { [x: string]: any };
+ query: T.Dict<any>;
value?: string[];
}
}
function mapPropertyToMetric(property?: string): string | undefined {
- const map: { [property: string]: string } = {
+ const map: T.Dict<string> = {
analysis_date: 'analysisDate',
reliability: 'reliability_rating',
new_reliability: 'new_reliability_rating',
isFavorite?: boolean;
key: string;
leakPeriodDate?: string;
- measures: { [key: string]: string };
+ measures: T.Dict<string>;
name: string;
organization?: { key: string; name: string };
tags: string[];
{ value: 'new_lines', class: 'projects-leak-sorting-option' }
];
-export const SORTING_SWITCH: { [x: string]: string } = {
+export const SORTING_SWITCH: T.Dict<string> = {
analysis_date: 'analysis_date',
name: 'name',
reliability: 'new_reliability',
'new_lines'
];
-const METRICS_BY_VISUALIZATION: { [x: string]: string[] } = {
+const METRICS_BY_VISUALIZATION: T.Dict<string[]> = {
risk: ['reliability_rating', 'security_rating', 'coverage', 'ncloc', 'sqale_index'],
// x, y, size, color
reliability: ['ncloc', 'reliability_remediation_effort', 'bugs', 'reliability_rating'],
facets: getFacetsMap(facets),
projects: components
.map(component => {
- const componentMeasures: { [key: string]: string } = {};
+ const componentMeasures: T.Dict<string> = {};
measures.filter(measure => measure.component === component.key).forEach(measure => {
const value = isDiffMetric(measure.metric)
? getPeriodValue(measure, 1)
}
function mapFacetValues(values: Array<{ val: string; count: number }>) {
- const map: { [value: string]: number } = {};
+ const map: T.Dict<number> = {};
values.forEach(value => {
map[value.val] = value.count;
});
}
function getFacetsMap(facets: Facet[]) {
- const map: { [property: string]: { [value: string]: number } } = {};
+ const map: T.Dict<T.Dict<number>> = {};
facets.forEach(facet => {
const property = mapMetricToProperty(facet.property);
const { values } = facet;
}
function mapPropertyToMetric(property?: string) {
- const map: { [property: string]: string } = {
+ const map: T.Dict<string> = {
analysis_date: 'analysisDate',
reliability: 'reliability_rating',
new_reliability: 'new_reliability_rating',
}
function mapMetricToProperty(metricKey: string) {
- const map: { [metric: string]: string } = {
+ const map: T.Dict<string> = {
analysisDate: 'analysis_date',
reliability_rating: 'reliability',
new_reliability_rating: 'new_reliability',
export default class Visualizations extends React.PureComponent<Props> {
renderVisualization(projects: Project[]) {
- const visualizationToComponent: { [x: string]: any } = {
+ const visualizationToComponent: T.Dict<any> = {
risk: Risk,
reliability: Reliability,
security: Security,
interface Props {
canEdit: boolean;
conditions: T.Condition[];
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
onAddCondition: (condition: T.Condition) => void;
onSaveCondition: (newCondition: T.Condition, oldCondition: T.Condition) => void;
onRemoveCondition: (Condition: T.Condition) => void;
}
interface StateToProps {
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
}
interface DispatchToProps {
interface Props {
isDefault?: boolean;
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
organization?: string;
onAddCondition: (condition: T.Condition) => void;
onRemoveCondition: (Condition: T.Condition) => void;
import ParameterChange from './ParameterChange';
interface Props {
- changes: { [change: string]: string | null };
+ changes: T.Dict<string | null>;
}
export default function ChangesList({ changes }: Props) {
import ChevronRightIcon from '../../../components/icons-components/ChevronRightcon';
import ChevronLeftIcon from '../../../components/icons-components/ChevronLeftIcon';
-type Params = { [p: string]: string };
+type Params = T.Dict<string>;
interface Props extends CompareResponse {
organization?: string;
interface State {
activatedTotal: number | null;
- activatedByType: { [type: string]: ByType };
- allByType: { [type: string]: ByType };
+ activatedByType: T.Dict<ByType>;
+ allByType: T.Dict<ByType>;
compareToSonarWay: { profile: string; profileName: string; missingRuleCount: number } | null;
loading: boolean;
total: number | null;
const RULES_LIMIT = 10;
-function parseRules(
- rules: T.Rule[],
- actives?: { [rule: string]: T.RuleActivation[] }
-): ExtendedRule[] {
+function parseRules(rules: T.Rule[], actives?: T.Dict<T.RuleActivation[]>): ExtendedRule[] {
return rules.map(rule => {
const activations = actives && actives[rule.key];
return { ...rule, activations: activations ? activations.length : 0 };
interface Props {
actions: Actions;
languages: Array<{ key: string; name: string }>;
- location: { query: { [p: string]: string } };
+ location: { query: T.Dict<string> };
organization: string | null;
profiles: Profile[];
updateProfiles: () => Promise<void>;
interface Props {
languages: Array<{ key: string; name: string }>;
- location: { query: { [p: string]: string } };
+ location: { query: T.Dict<string> };
organization: string | null;
profiles: Profile[];
updateProfiles: () => Promise<void>;
const { profiles, languages } = this.props;
const { language } = this.props.location.query;
- const profilesIndex: { [language: string]: Profile[] } = groupBy<Profile>(
+ const profilesIndex: T.Dict<Profile[]> = groupBy<Profile>(
profiles,
profile => profile.language
);
action: string;
authorName: string;
date: string;
- params?: { [change: string]: string | null };
+ params?: T.Dict<string | null>;
ruleKey: string;
ruleName: string;
}
const languages = this.props.component.qualityProfiles
? this.props.component.qualityProfiles.map(qp => qp.language).join(',')
: '';
- const sansTopCategoryTags: { [key: string]: string } = {
+ const sansTopCategoryTags: T.Dict<string> = {
'insecure-interaction': 'insecure',
'porous-defenses': 'porous',
'risky-resource': 'risky'
renderComponentIssuesLink = (
activeRules: number,
- query: { [x: string]: string | undefined },
+ query: T.Dict<string | undefined>,
value: number,
tooltip?: JSX.Element
) => {
parent?: T.SecurityHotspot
): React.ReactFragment {
const { branchLike, component, type } = this.props;
- const params: { [name: string]: string | undefined } = {
+ const params: T.Dict<string | undefined> = {
...getBranchLikeQuery(branchLike),
types: 'SECURITY_HOTSPOT'
};
export type StandardType = 'owaspTop10' | 'sansTop25' | 'cwe';
export interface Standards {
- owaspTop10: { [x: string]: { title: string; description?: string } };
- sansTop25: { [x: string]: { title: string; description?: string } };
- cwe: { [x: string]: { title: string; description?: string } };
+ owaspTop10: T.Dict<{ title: string; description?: string }>;
+ sansTop25: T.Dict<{ title: string; description?: string }>;
+ cwe: T.Dict<{ title: string; description?: string }>;
}
export function renderOwaspTop10Category(
type Action = ActionType<typeof receiveDefinitions, Actions.ReceiveDefinitions>;
-export interface State {
- [key: string]: T.SettingCategoryDefinition;
-}
+export type State = T.Dict<T.SettingCategoryDefinition>;
export function receiveDefinitions(definitions: T.SettingCategoryDefinition[]) {
return { type: Actions.ReceiveDefinitions, definitions };
| ActionType<typeof stopLoading, Actions.StopLoading>;
export interface State {
- changedValues: { [key: string]: any };
- loading: { [key: string]: boolean };
- validationMessages: { [key: string]: string };
+ changedValues: T.Dict<any>;
+ loading: T.Dict<boolean>;
+ validationMessages: T.Dict<string>;
}
export function cancelChange(key: string) {
type Action = ActionType<typeof receiveValues, Actions.receiveValues>;
-interface SettingsState {
- [key: string]: T.SettingValue;
-}
+type SettingsState = T.Dict<T.SettingValue>;
export interface State {
- components: { [component: string]: SettingsState };
+ components: T.Dict<SettingsState>;
global: SettingsState;
}
}
if (item.type === 'PROPERTY_SET') {
- const value: { [key: string]: string } = {};
+ const value: T.Dict<string> = {};
item.fields.forEach(field => (value[field.key] = getEmptyValue(field)));
return [value];
}
os: string;
}
-const filenames: { [key: string]: string } = {
+const filenames: T.Dict<string> = {
win: 'build-wrapper-win-x86.zip',
linux: 'build-wrapper-linux-x86.zip',
mac: 'build-wrapper-macosx-x86.zip'
token: string;
}
-const executables: { [key: string]: string } = {
+const executables: T.Dict<string> = {
linux: 'build-wrapper-linux-x86-64',
win: 'build-wrapper-win-x86-64.exe',
mac: 'build-wrapper-macosx-x86'
interface State {
component?: T.SourceViewerFile;
displayDuplications: boolean;
- duplicatedFiles?: { [ref: string]: T.DuplicatedFile };
+ duplicatedFiles?: T.Dict<T.DuplicatedFile>;
duplications?: T.Duplication[];
duplicationsByLine: { [line: number]: number[] };
hasSourcesAfter: boolean;
interface Props {
blocks: T.DuplicationBlock[];
branchLike: T.BranchLike | undefined;
- duplicatedFiles?: { [ref: string]: T.DuplicatedFile };
+ duplicatedFiles?: T.Dict<T.DuplicatedFile>;
inRemovedComponent: boolean;
onClose: () => void;
openComponent: WorkspaceContextShape['openComponent'];
import { scrollToElement } from '../../helpers/scrolling';
interface Props {
- childProps?: { [k: string]: string };
+ childProps?: T.Dict<string>;
className?: string;
content: string | undefined;
displayH1?: boolean;
}
function withChildProps<P>(
- WrappedComponent: React.ComponentType<P & { customProps?: { [k: string]: any } }>,
- childProps?: { [k: string]: any }
+ WrappedComponent: React.ComponentType<P & { customProps?: T.Dict<any> }>,
+ childProps?: T.Dict<any>
) {
return function withChildProps(props: P) {
return <WrappedComponent customProps={childProps} {...props} />;
children?: React.ReactNode;
// Use as `import(/* webpackMode: "eager" */ 'Docs/tooltips/foo/bar.md')`
doc: Promise<{ default: string }>;
- overlayProps?: { [k: string]: string };
+ overlayProps?: T.Dict<string>;
}
interface State {
import DetachIcon from '../icons-components/DetachIcon';
interface OwnProps {
- customProps?: { [k: string]: string };
+ customProps?: T.Dict<string>;
}
type Props = OwnProps & React.AnchorHTMLAttributes<HTMLAnchorElement>;
getFacetItemText: (item: string) => string;
getSearchResultKey: (result: S) => string;
getSearchResultText: (result: S) => string;
- loadSearchResultCount?: (result: S[]) => Promise<{ [x: string]: number }>;
+ loadSearchResultCount?: (result: S[]) => Promise<T.Dict<number>>;
maxInitialItems: number;
maxItems: number;
minSearchLength: number;
- onChange: (changes: { [x: string]: string | string[] }) => void;
+ onChange: (changes: T.Dict<string | string[]>) => void;
onClear?: () => void;
onItemClick?: (itemValue: string, multiple: boolean) => void;
onSearch: (query: string, page?: number) => Promise<SearchResponse<S>>;
renderSearchResult: (result: S, query: string) => React.ReactNode;
searchPlaceholder: string;
getSortedItems?: () => string[];
- stats: { [x: string]: number } | undefined;
+ stats: T.Dict<number> | undefined;
values: string[];
}
searchMaxResults?: boolean;
searchPaging?: T.Paging;
searchResults?: S[];
- searchResultsCounts: { [key: string]: number };
+ searchResultsCounts: T.Dict<number>;
showFullList: boolean;
}
import Icon, { IconProps } from './Icon';
import * as theme from '../../app/theme';
-const qualifierIcons: { [x: string]: (props: IconProps) => React.ReactElement<any> } = {
+const qualifierIcons: T.Dict<(props: IconProps) => React.ReactElement<any>> = {
app: ApplicationIcon,
brc: SubProjectIcon,
dev: DeveloperIcon,
severity: string | null | undefined;
}
-const severityIcons: { [x: string]: (props: IconProps) => React.ReactElement<any> } = {
+const severityIcons: T.Dict<(props: IconProps) => React.ReactElement<any>> = {
blocker: BlockerSeverityIcon,
critical: CriticalSeverityIcon,
major: MajorSeverityIcon,
status: string;
}
-const statusIcons: { [x: string]: (props: IconProps) => React.ReactElement<any> } = {
+const statusIcons: T.Dict<(props: IconProps) => React.ReactElement<any>> = {
open: OpenStatusIcon,
confirmed: ConfirmedStatusIcon,
reopened: ReopenedStatusIcon,
status: string;
}
-const statusIcons: { [x: string]: (props: IconProps) => React.ReactElement<any> } = {
+const statusIcons: T.Dict<(props: IconProps) => React.ReactElement<any>> = {
ok: OkTestStatusIcon,
failure: FailureTestStatusIcon,
error: ErrorTestStatusIcon,
'security_rating'
];
-export function enhanceMeasure(
- measure: T.Measure,
- metrics: { [key: string]: T.Metric }
-): T.MeasureEnhanced {
+export function enhanceMeasure(measure: T.Measure, metrics: T.Dict<T.Metric>): T.MeasureEnhanced {
return {
...measure,
metric: metrics[measure.metric],
interface Props {
branchLike?: T.BranchLike;
history?: History;
- metrics: { [key: string]: T.Metric };
+ metrics: T.Dict<T.Metric>;
project: string;
renderWhenEmpty?: () => React.ReactNode;
router: Pick<Router, 'push'>;
history: History | undefined,
graph: string,
customMetrics: string[],
- metrics: { [x: string]: T.Metric }
+ metrics: T.Dict<T.Metric>
) => {
const myHistory = history;
if (!myHistory) {
'new_vulnerabilities'
];
-const issueParamsPerMetric: { [key: string]: { [key: string]: string } } = {
+const issueParamsPerMetric: T.Dict<T.Dict<string>> = {
blocker_violations: { resolved: 'false', severities: 'BLOCKER' },
new_blocker_violations: { resolved: 'false', severities: 'BLOCKER' },
critical_violations: { resolved: 'false', severities: 'CRITICAL' },
};
propsToIssueParams = () => {
- const params: { [key: string]: string | boolean } = {
+ const params: T.Dict<string | boolean> = {
...(issueParamsPerMetric[this.props.metric] || { resolved: 'false' })
};
interface State {
loading: boolean;
- referencedRepositories: { [repository: string]: { key: string; language: string; name: string } };
+ referencedRepositories: T.Dict<{ key: string; language: string; name: string }>;
ruleDetails?: T.RuleDetails;
}
import { memoize } from 'lodash';
const parseCookies = memoize(
- (documentCookie: string): { [key: string]: string } => {
+ (documentCookie: string): T.Dict<string> => {
const rawCookies = documentCookie.split('; ');
- const cookies: { [key: string]: string } = {};
+ const cookies: T.Dict<string> = {};
rawCookies.forEach(candidate => {
const [key, value] = candidate.split('=');
cookies[key] = value;
}
function injectRelational(
- issue: { [x: string]: any },
+ issue: T.Dict<any>,
source: any[] | undefined,
baseField: string,
lookupField: string
) {
- const newFields: { [x: string]: any } = {};
+ const newFields: T.Dict<any> = {};
const baseValue = issue[baseField];
if (baseValue !== undefined && source !== undefined) {
const lookupValue = source.find(candidate => candidate[lookupField] === baseValue);
}
function getFormatter(type: string): Formatter {
- const FORMATTERS: { [type: string]: Formatter } = {
+ const FORMATTERS: T.Dict<Formatter> = {
INT: intFormatter,
SHORT_INT: shortIntFormatter,
FLOAT: floatFormatter,
/**
* Return an object containing a special http request header used to prevent CSRF attacks.
*/
-export function getCSRFToken(): { [x: string]: string } {
+export function getCSRFToken(): T.Dict<string> {
// Fetch API in Edge doesn't work with empty header,
// so we ensure non-empty value
const value = getCSRFTokenValue();
return value ? { [getCSRFTokenName()]: value } : {};
}
-export interface RequestData {
- [x: string]: any;
-}
+export type RequestData = T.Dict<any>;
export function omitNil(obj: RequestData): RequestData {
return omitBy(obj, isNil);
}
];
-const diacriticsMap: { [x: string]: string } = {};
+const diacriticsMap: T.Dict<string> = {};
defaultDiacriticsRemovalap.forEach(defaultDiacritic =>
defaultDiacritic.letters.split('').forEach(letter => {
diacriticsMap[letter] = defaultDiacritic.base;
type Action = ActionType<typeof receiveMetrics, 'RECEIVE_METRICS'>;
-export type State = { byKey: { [key: string]: T.Metric }; keys: string[] };
+export type State = { byKey: T.Dict<T.Metric>; keys: string[] };
const byKey = (state: State['byKey'] = {}, action: Action) => {
if (action.type === 'RECEIVE_METRICS') {
| ActionType<typeof deleteOrganization, 'DELETE_ORGANIZATION'>;
export interface State {
- byKey: { [key: string]: T.Organization };
+ byKey: T.Dict<T.Organization>;
my: string[];
}
| ActionType<typeof skipOnboardingAction, Actions.SkipOnboardingAction>;
export interface State {
- usersByLogin: { [login: string]: any };
+ usersByLogin: T.Dict<any>;
userLogins: string[];
currentUser: T.CurrentUser;
}