@atomist/automation-client
Version:
Atomist API for software low-level client
82 lines • 2.73 kB
TypeScript
import { HandlerResult } from "../../HandlerResult";
import { RepoRef } from "../common/RepoId";
import { SourceLocation } from "../common/SourceLocation";
export declare type Severity = "error" | "warn" | "info";
/**
* A single comment on a project, with optional source location.
*/
export interface ReviewComment {
readonly severity: Severity;
/**
* Name of the category to which this comment applies: E.g. "API usage".
* Should be human readable. Review comments are typically filtered by
* category when reported.
*/
readonly category: string;
/**
* Name of the more specific category to which this comment applies if available,
* E.g. "Usage of Foobar API". Review comments are typically sorted by
* subcategory when reported.
*/
readonly subcategory?: string;
/**
* Details of the problem
*/
readonly detail: string;
readonly sourceLocation?: SourceLocation;
/**
* Command invocation that will fix this problem
*/
readonly fix?: Fix;
}
/**
* Coordinates of an Atomist command handler to fix a specific problem
*/
export interface Fix {
command: string;
params: {
[propName: string]: string | number;
};
}
export declare class DefaultReviewComment implements ReviewComment {
severity: Severity;
category: string;
detail: string;
sourceLocation: SourceLocation;
fix?: Fix;
constructor(severity: Severity, category: string, detail: string, sourceLocation: SourceLocation, fix?: Fix);
}
/**
* The result of reviewing a single project
*/
export interface ProjectReview {
repoId: RepoRef;
comments: ReviewComment[];
}
/**
* The result of reviewing many projects: For example,
* all the projects in an org
*/
export interface ReviewResult<T extends ProjectReview = ProjectReview> extends HandlerResult {
projectsReviewed: number;
projectReviews: T[];
}
/**
* Give a project a clean bill of health, with no comments
* @param repoId identification of project
* @return {{repoId: RepoRef, comments: Array}}
*/
export declare function clean(repoId: RepoRef): ProjectReview;
/**
* Function suitable for use by Array.prototype.sort() to sort review
* comments by severity, category, subcategory, and sourceLocation
* path and offset. Items with the same severity, category, and
* subcategory without a location are sorted before those having a
* location.
*
* @param a First element to compare.
* @param b Second element to compare.
* @return -1 if a sorts first, 1 if b sorts first, and 0 if they are equivalent.
*/
export declare function reviewCommentSorter(a: ReviewComment, b: ReviewComment): number;
//# sourceMappingURL=ReviewResult.d.ts.map