From f4367f96c0260ed59b3344821fd5234996f59a74 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Thu, 28 Mar 2019 09:46:59 -0400 Subject: [PATCH] Add ignored warning counts to the changeset tags (close #6123) --- modules/ui/commit.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/ui/commit.js b/modules/ui/commit.js index c868cb524..6f41463e8 100644 --- a/modules/ui/commit.js +++ b/modules/ui/commit.js @@ -24,7 +24,8 @@ var readOnlyTags = [ /^ideditor:/, /^imagery_used$/, /^host$/, - /^locale$/ + /^locale$/, + /^warnings:/ ]; // treat most punctuation (except -, _, +, &) as hashtag delimiters - #4398 @@ -114,6 +115,18 @@ export function uiCommit(context) { } } + var warningCountsByType = {}; + context.validator().getWarnings().forEach(function(warning) { + // deletion count can be derived so don't tag that warning in the changeset + if (warning.type === 'many_deletions') return; + if (!warningCountsByType[warning.type]) warningCountsByType[warning.type] = 0; + warningCountsByType[warning.type] += 1; + }); + for (var warningType in warningCountsByType) { + // tag the counts of warnings ignored by the user + tags['warnings:' + warningType] = warningCountsByType[warningType].toString(); + } + _changeset = _changeset.update({ tags: tags }); var header = selection.selectAll('.header')