@atomist/sdm-pack-aspect
Version:
an Atomist SDM Extension Pack for visualizing drift across an organization
83 lines • 2.24 kB
TypeScript
import { Omit } from "../util/omit";
/**
* Score value
*/
export declare type FiveStar = 0 | 1 | 2 | 3 | 4 | 5;
/**
* Scores with this category are always included in any score computation
*/
export declare const AlwaysIncludeCategory: "*";
/**
* Represents a quality ranking of a particular element of a project.
* The numeric score will be from from 1-5, where 1 is very bad and 5 is very good.
*/
export interface Score {
readonly name: string;
readonly description?: string;
/**
* Category this score belongs to, if any
*/
readonly category?: string;
/**
* Explanation for this score, if available
*/
readonly reason?: string;
/**
* Score for this project
*/
readonly score: FiveStar;
}
/**
* Structure representing a score on a particular aspect of a project.
* The key is the scorer name
*/
export declare type Scores = Record<string, Score>;
/**
* Weighting of a particular scorer
*/
export declare type Weighting = 1 | 2 | 3;
export interface Scored {
readonly scores: Scores;
}
/**
* Weighting to apply to this name score. Default is 1.
* Other values can be used to increase the weighting.
*/
export declare type ScoreWeightings = Record<string, Weighting>;
export declare type WeightedScores = Record<string, Score & {
weighting: Weighting;
}>;
export interface WeightedScore {
/**
* Weighted score
*/
weightedScore: number;
/**
* Individual component scores
*/
weightedScores: WeightedScores;
}
/**
* Perform a weighted composite score for the given scores.
* Returns a real number from 0 to 5
*/
export declare function weightedCompositeScore(scored: Scored, weightings?: ScoreWeightings): WeightedScore | undefined;
/**
* Extended by types that can perform scoring
*/
export interface Scorer {
/**
* Name of the scorer. Will be included in all scores.
*/
readonly name: string;
readonly description?: string;
/**
* Category to include in scores, if any
*/
readonly category?: string;
}
/**
* Type returned by any scorer
*/
export declare type ScorerReturn = Omit<Score, "name" | "description" | "category"> | undefined;
//# sourceMappingURL=Score.d.ts.map