Skip to content

Commit

Permalink
Display warning instead of error when no files are matched, and retur…
Browse files Browse the repository at this point in the history
…n with exit code 0

Closes pinterest#1624
  • Loading branch information
paul-dingemans committed Sep 3, 2022
1 parent e5ff031 commit bb11a86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@ Do not show deprecation warning about property "disabled_rules" when using CLi-p
### Added

### Changed
* Display warning instead of error when no files are matched, and return with exit code 0. ([#1624](https://github.com/pinterest/ktlint/issues/1624))

### Removed

Expand Down
Expand Up @@ -274,11 +274,12 @@ internal class KtlintCommandLine {
)
}
reporter.afterAll()
logger.debug { "${System.currentTimeMillis() - start}ms / $fileNumber file(s) / $errorNumber error(s)" }
if (fileNumber.get() == 0) {
logger.error { "No files matched $patterns" }
exitProcess(1)
// Do not return an error as this would implicate that in a multi-module project, each module has to contain
// at least one kotlin file.
logger.warn { "No files matched $patterns" }
}
logger.debug { "${System.currentTimeMillis() - start}ms / $fileNumber file(s) / $errorNumber error(s)" }
if (tripped.get()) {
exitProcess(1)
}
Expand Down

0 comments on commit bb11a86

Please sign in to comment.