macisamuele / language-formatters-pre-commit-hooks

Collection of custom pre-commit hooks.
Apache License 2.0
115 stars 58 forks source link

Update to ktlint 0.48.1 #140

Closed detouched closed 1 year ago

detouched commented 1 year ago

Replace --verbose option with --log-level debug.

macisamuele commented 1 year ago

I'm not familiar with the difference between log-level and verbose, can you please provide context in why is the change helpful?

Moreover, can we avoid updating the ktlon version in here? There is already #138 doing it.

detouched commented 1 year ago

Sorry, my bad, didn't check for open PRs before raising this one.

The reason for this change is that --verbose is deprecated, in fact ktlint 0.48.1 returns an error when it is provided:

[cwd=/Users/detouched/Work/_devops/project] Run command: ('java', '--add-opens', 'java.base/java.lang=ALL-UNNAMED', '-jar', '/Users/detouched/.cache/pre-commit/ktlint0.48.1.jar', '--verbose', '--relative', '--', 'src/test/kotlin/integration/org/github/detouched/devops/controllers/StateControllerTest.kt')
[return_code=1] | 18:27:15.336 [main] ERROR com.pinterest.ktlint.internal.KtlintCommandLine - Options '--debug', '--trace', '--verbose' and '-v' are deprecated and replaced with option '--log-level=<level>' or '-l=<level>'.

That is, #138 without replacing or removing --verbose will lead to unusable commit hook which will always fail.

macisamuele commented 1 year ago

I was not aware of it, due to unrelated test failures I was not focusing yet on the ktlint update. Please make sure to rebase your changes on the latest version of the repository and to keep the ktlint version bump. As soon as tests are going to be green I'll merge this PR and release the new version

detouched commented 1 year ago

Looks like I overlooked another --verbose argument. Let me fix that.

codecov[bot] commented 1 year ago

Codecov Report

Merging #140 (1f1670c) into master (74961ae) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #140   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          309       309           
=========================================
  Hits           309       309           
Impacted Files Coverage Δ
...ormatters_pre_commit_hooks/pretty_format_kotlin.py 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.