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

Reduce stacktrace noise in the output when running with info mode #240

Open
vlsi opened this issue Nov 7, 2023 · 2 comments
Open

Reduce stacktrace noise in the output when running with info mode #240

vlsi opened this issue Nov 7, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@vlsi
Copy link

vlsi commented Nov 7, 2023

What version of OpenRewrite are you using?

org.openrewrite.rewrite.gradle.plugin:6.4.3

How are you running OpenRewrite?

plugins {
    id("org.openrewrite.rewrite")
}

dependencies {
    rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.4.1"))
    rewrite("org.openrewrite.recipe:rewrite-static-analysis")
}

rewrite {
    activeRecipe("org.openrewrite.java.OrderImports")
    activeRecipe("org.openrewrite.staticanalysis.MissingOverrideAnnotation")
}

What is the smallest, simplest way to reproduce the problem?

The project should have files that OpenRewrite can't parse.

What did you expect to see?

Running the build with --info should not be extremely verbose.

What did you see instead?

Running ./gradlew rewriteRun produces 187 lines for pgjdbc/pgjdbc. There are 52 lines starting with 'There were problems parsing...'

Running the same build with ./gradlew rewriteRun produces 2 megabyte with 21781 lines.
That makes --info virtually unusable.

I suggest that "debugging" openrewrite should be hidden under a special flag as people can rarely deal with OpenRewrite parser failures.

What is the full stack trace of any errors you encountered?

rewriteRun.info.txt

Are you interested in contributing a fix to OpenRewrite?

I might probably work on that

A workaround might probably be excluding the problematic files until OpenRewrite parser is fixed.

@vlsi vlsi added the bug Something isn't working label Nov 7, 2023
@timtebeek
Copy link
Contributor

That's indeed a lot of output with little in the sense of actionable stack traces. From a spot check a few of those parser errors are related to the issue you've reported:

Our best bet to reduce the output is the resolve those parser errrors, which are rare, in openrewrite/rewrite#3464 as indicated. I suspect you'll then end up with far less output, and are able to narrow down any remaining issues more easily.

That said, if you see any good ways to push some of the current --info further down then we're open to (and much appreciate) suggestions!

@koppor
Copy link
Contributor

koppor commented Aug 28, 2024

Alternatively, it would be nice if the line number or the concrete issue at "There were problems parsing...". Maybe adding the reason of the exception?

2024-08-28T12:33:45.572+0200 [WARN] [org.openrewrite.gradle.isolated.DefaultProjectParser] There were problems parsing src\main\java\org\jabref\logic\ai\chathistory\BibDatabaseChatHistoryManager.java
2024-08-28T12:33:45.572+0200 [DEBUG] [org.openrewrite.gradle.isolated.DefaultProjectParser] java.lang.IllegalStateException: src\main\java\org\jabref\logic\ai\chathistory\BibDatabaseChatHistoryManager.java is not print idempotent.

New:

2024-08-28T12:33:45.572+0200 [WARN] [org.openrewrite.gradle.isolated.DefaultProjectParser] There were problems at parsing: src\main\java\org\jabref\logic\ai\chathistory\BibDatabaseChatHistoryManager.java is not print idempotent.

Update: The concrete error is openrewrite/rewrite#4223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

3 participants