import Metric from "../classes/Metric" ; import MetricSet from "../classes/MetricSet" ; import { complexityMetric , coverageMetricId , linesOfCodeMetric , noMetric } from "./Metrics" ; export const noColorMetric = new Metric ( noMetric . id , noMetric . label , "All buildings will have the same color." ) ; export const packageNameColorMetric = new Metric ( "package" , "Package Name" , "Every building is assigned a color, depending on it's containing package or namespace." ) ; export const violationsColorMetric = new Metric ( "violations" , "Issues" , "Scale from green (no open violations) to red (highest number of violations)." ) ; export const linesOfCodeColorMetric = new Metric ( linesOfCodeMetric . id , "Lines of Code" , "Scale from green (few lines of code) to red (a lot of lines of code)." ) ; export const newIssuesColorMetric = new Metric ( "new_violations" , "New Issues" , "Scale from green (no new issues) to red (highest number of new issues)." ) ; export const complexityColorMetric = new Metric ( complexityMetric . id , "Complexity" , "Scale from green (low complexity) to red (high complexity)." ) ; export const coverageColorMetric = new Metric ( coverageMetricId , "Coverage" , "Scale from green (high coverage) to red (low or no coverage)." ) ; export const openIssuesColorMetric = new Metric ( "open_issues" , "Open Issues" , "Scale from green (no open issues) to red (a lot of issues)." ) ; export const numberOfAuthorsScmColorMetric = new Metric ( "number_of_authors" , "Number of authors" , "Number of authors based on the SCM info." ) ; export const leakPeriodCommitsScmColorMetric = new Metric ( "number_of_commits" , "Number of commits" , "Number of commits during the current leak period." ) ; export class ColorMetrics { public static availableColorMetrics : Metric [ ] = [ noColorMetric , complexityColorMetric , coverageColorMetric , numberOfAuthorsScmColorMetric , leakPeriodCommitsScmColorMetric , violationsColorMetric , newIssuesColorMetric , linesOfCodeColorMetric , openIssuesColorMetric , packageNameColorMetric , ] ; public static readonly colorMetrics : MetricSet = new MetricSet ( ColorMetrics . availableColorMetrics ) ; public static getColorMetricById ( id ) { for ( const availableColorMetric of ColorMetrics . availableColorMetrics ) { if ( availableColorMetric . id === id ) { return availableColorMetric ; } } } public static isScmColorMetric ( metricColor ) { return ( metricColor . id === numberOfAuthorsScmColorMetric . id || metricColor . id === leakPeriodCommitsScmColorMetric . id ) ; } }