Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add reporter for format summary #1536

Merged
merged 4 commits into from
Jul 24, 2022

Conversation

paul-dingemans
Copy link
Collaborator

Description

Add reporter for a format summary of one line per file. This reporter support colored output in same way as the plain reporter. Like other reporters it allows it content to be written to a separate file. The reported proceduces output when running in format and lint only mode. See examples below.

With lint only:

$ ktlint-dev --experimental --reporter=format --relative --color 
Foo3.kt: Format required (2 violations need manual fixing)
Foo2.kt: Format required (1 violation needs manual fixing)
Foo1.kt: Format not needed (no violations found)
Foo4.kt: Format required (all violations can be autocorrected)

With format:

$ ktlint-dev --experimental --reporter=format --relative --color -F
Foo3.kt: Format not completed (2 violations need manual fixing)
Foo2.kt: Format not completed (1 violation needs manual fixing)
Foo1.kt: Format not needed (no violations found)
Foo4.kt: Format completed (all violations have been fixed)

Closes #821

Checklist

  • PR description added
  • tests are added
  • CHANGELOG.md is updated

In case of adding a new rule:

  • README.md is updated
  • Rule has been applied on Ktlint itself and violations are fixed

@paul-dingemans paul-dingemans added this to the 0.47.0 milestone Jul 3, 2022
@pinterest pinterest deleted a comment from mohammdimohsen85 Jul 4, 2022
@pinterest pinterest deleted a comment from mohammdimohsen85 Jul 4, 2022
# Conflicts:
#	ktlint-core/src/main/kotlin/com/pinterest/ktlint/core/KtLint.kt
#	ktlint-core/src/test/kotlin/com/pinterest/ktlint/core/KtLintTest.kt
@paul-dingemans paul-dingemans merged commit 7ae1126 into pinterest:master Jul 24, 2022
@paul-dingemans paul-dingemans deleted the 821-reporter-format branch July 24, 2022 18:08
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print the files that have been formatted successfully
1 participant