Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Improve error messages output when running tasks #313

Open
peterMonteer opened this issue Dec 12, 2019 · 4 comments
Open

Improve error messages output when running tasks #313

peterMonteer opened this issue Dec 12, 2019 · 4 comments

Comments

@peterMonteer
Copy link

peterMonteer commented Dec 12, 2019

Problem Description

When running ktlintCheck or ktlintFormat, if code style errors are found, the error message is not specific when the task fails, just mentioning a non-zero exit value after running the JavaExec in the runLint task.

This can cause some confusion and it's not very specific.

Suggested Solution:

Output error message when ktlintCheck finds code style errors:
"Ktlint found X code styles errors, please fix them before continuing"

Output error message when ktlintFormat is not able to auto-correct:
"Ktlint found X code styles errors that couldn't be auto-corrected, please fix them before continuing"

@JLLeitschuh
Copy link
Owner

@Tapchicoma do we even have the information required to do this?

@Tapchicoma
Copy link
Collaborator

Generally, I think it is possible. Probably will require some changes in ktlint itself.

@phileo99
Copy link

phileo99 commented Aug 3, 2020

I initially thought this was an issue with AGP, but it is actually a problem caused by KTLint-gradle plugin

This problem is very easy to reproduce.
Just create any sample project using the new Project wizard in Android Studio 4.x and prepend an extra space before super.onCreate()

When building the sample project, the build window will report the following false failure:

Process 'command '/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

However, if you run ./gradlew :app:ktlintAndroidTestSourceSetFormat you get back the syntax highlighting and line number of the failure, which is way more useful.

Is there a way to pipe the output of KTLint to the build window?
Or alternatively, make KTLint failures behave like compile failures so that we can see the syntax highlighting and line number of the failure?

@JCreswellENVRMNT
Copy link

Even a message hinting about where the report files with further details can be found would be useful for Kotlin and/or Lint noobs like me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants