UNPKG

2.71 kBTypeScriptView Raw
1import { Violation } from "../dsl/Violation";
2/**
3 * The representation of what running a Dangerfile generates.
4 * This needs to be passed between processes, so data only please.
5 */
6export interface DangerResults {
7 /**
8 * Failed messages
9 */
10 fails: Violation[];
11 /**
12 * Messages for info
13 */
14 warnings: Violation[];
15 /**
16 * A set of messages to show inline
17 */
18 messages: Violation[];
19 /**
20 * Markdown messages to attach at the bottom of the comment
21 */
22 markdowns: Violation[];
23 /** Meta information about the runtime evaluation */
24 meta?: {
25 /** E.g. "dangerJS", or "Danger Swift" */
26 runtimeName: string;
27 /** e.g. "https://danger.systems/js" */
28 runtimeHref: string;
29 };
30}
31export interface DangerRuntimeContainer extends DangerResults {
32 /**
33 * Asynchronous functions to be run after parsing
34 */
35 scheduled?: any[];
36}
37export interface DangerInlineResults {
38 /**
39 * Path to the file
40 */
41 file: string;
42 /**
43 * Line in the file
44 */
45 line: number;
46 /**
47 * Failed messages
48 */
49 fails: string[];
50 /**
51 * Messages for info
52 */
53 warnings: string[];
54 /**
55 * A set of messages to show inline
56 */
57 messages: string[];
58 /**
59 * Markdown messages to attach at the bottom of the comment
60 */
61 markdowns: string[];
62}
63export declare const emptyDangerResults: {
64 fails: never[];
65 warnings: never[];
66 messages: never[];
67 markdowns: never[];
68};
69export declare function validateResults(results: DangerResults): void;
70/** Returns only the inline violations from Danger results */
71export declare function inlineResults(results: DangerResults): DangerResults;
72/** Returns only the main-comment comments violations from Danger results */
73export declare function regularResults(results: DangerResults): DangerResults;
74/** Concat all the violations into a new results */
75export declare function mergeResults(results1: DangerResults, results2: DangerResults): DangerResults;
76/** Sorts all of the results according to their files and lines */
77export declare function sortInlineResults(inlineResults: DangerInlineResults[]): DangerInlineResults[];
78export declare function sortResults(results: DangerResults): DangerResults;
79export declare const emptyResults: () => DangerResults;
80export declare const isEmptyResults: (results: DangerResults) => boolean;
81export declare const isMarkdownOnlyResults: (results: DangerResults) => boolean;
82export declare function resultsIntoInlineResults(results: DangerResults): DangerInlineResults[];
83export declare function inlineResultsIntoResults(inlineResults: DangerInlineResults): DangerResults;