[dmt] add statistic after linter run - #457
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add an end-of-lint statistics summary that is printed after the regular lint
results. The summary is rendered as a single framed block styled to match the
deckhouse-cli mirrorpull/push summaries, so the two tools feel like one family.Running
dmt lintnow finishes with a compact overview of the run:Why
Until now the output was a flat list of findings with no roll-up: on a large run
you had to scroll and count by hand to answer basic questions — how many modules
were scanned, how the findings break down by severity, which linters fired most,
and how long the run took. The summary puts that at the bottom of every run and
gives CI logs a single, scannable verdict line.
Details
internal/manager/statistics.go— new file with the collector and renderer:collectStatistics()tallies all collected findings by severity(critical / errors / warnings / ignored) and by linter. Counts always cover
every finding regardless of the
--hide-warnings/--show-ignoreddisplayflags, so the summary reflects the full picture.
renderStatistics()formats the framed block. The title and state line adaptto the outcome:
Lint failed, redLint failed; N problem(s) must be fixed.Completed with N warning(s).No problems found.(per-linter breakdown omitted)zero/secondary) and go through
fatih/color, which disables ANSI when stdoutis not a TTY or
NO_COLORis set — so escape codes never leak into pipes orfiles. Colours are applied after width padding so they don't break columns.
internal/manager/manager.go—Managergains astartedAttimestamp setin
NewManager; the summary reports wall-clock elapsed since it.cmd/dmt/main.go—mng.PrintStatistics()is called right aftermng.PrintResult()inrunLint.