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

java.util.UnknownFormatConversionException #11

Open
efueger opened this issue Feb 15, 2019 · 11 comments
Open

java.util.UnknownFormatConversionException #11

efueger opened this issue Feb 15, 2019 · 11 comments

Comments

@efueger
Copy link

efueger commented Feb 15, 2019

Repo hitting a format conversion error:

Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '"'
	at java.util.Formatter.checkText(Formatter.java:2579)
	at java.util.Formatter.parse(Formatter.java:2565)
	at java.util.Formatter.format(Formatter.java:2501)
	at java.util.Formatter.format(Formatter.java:2455)
	at java.lang.String.format(String.java:2940)
	at org.codeclimate.scalastyle.CodeClimateIssuePrinter.printIssue(CodeClimateIssuePrinter.scala:34)
	at org.codeclimate.scalastyle.CodeClimateEngine$.$anonfun$new$10(CodeClimateEngine.scala:45)
	at org.codeclimate.scalastyle.CodeClimateEngine$.$anonfun$new$10$adapted(CodeClimateEngine.scala:45)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at org.codeclimate.scalastyle.CodeClimateEngine$.delayedEndpoint$org$codeclimate$scalastyle$CodeClimateEngine$1(CodeClimateEngine.scala:45)
	at org.codeclimate.scalastyle.CodeClimateEngine$delayedInit$body.apply(CodeClimateEngine.scala:13)
	at scala.Function0.apply$mcV$sp(Function0.scala:34)
	at scala.Function0.apply$mcV$sp$(Function0.scala:34)
	at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
	at scala.App.$anonfun$main$1$adapted(App.scala:76)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at scala.App.main(App.scala:76)
	at scala.App.main$(App.scala:74)
	at org.codeclimate.scalastyle.CodeClimateEngine$.main(CodeClimateEngine.scala:13)
	at org.codeclimate.scalastyle.CodeClimateEngine.main(CodeClimateEngine.scala)

Maybe related to the custom message work done in #8 ?


troubleshooting resources:

@efueger
Copy link
Author

efueger commented Feb 25, 2019

@ivanobulo or @jsippel - any ideas? Let me know if I can help with any other info from the logs.

@ivanobulo
Copy link

ivanobulo commented Feb 26, 2019

@efueger
I'll have a look. Can you share your scalastyle XML configuration?

@efueger
Copy link
Author

efueger commented Feb 26, 2019

Thanks, @ivanobulo - I've asked the user to post it here. 👌

@xoyo24
Copy link

xoyo24 commented Feb 27, 2019

@ivanobulo
Sorry, we don't have a scalastyle XML configuration for now.
I'm trying to use Codacy at the same time. And I assume there is a default configuration for scalastyle like Codacy.
Maybe this is the problem?

@ivanobulo
Copy link

@xiaoyang24 It does look like this is non-standard configuration because the message it tries to format has a syntax error. I made a fix in the PR linked above. You could build the engine locally from the sources by running:
docker build . -t codeclimate/codeclimate-scalastyle:latest
and then run codeclimate analyzer using the command:
CODECLIMATE_DEBUG=1 codeclimate analyze --dev --engine scalastyle
This would print debug information including the message that causes error.

@xoyo24
Copy link

xoyo24 commented Mar 1, 2019

@ivanobulo
Thank you, and yes, I found an old Scalastyle XML configuration file in one of the sub directories.
I'm trying your method to check any problems with that file.

Or maybe I could solve the problem by removing it, does this sound like a solution?

@xoyo24
Copy link

xoyo24 commented Mar 4, 2019

@ivanobulo
Just to inform you about the progress.
I've tried to run the command locally but didn't get the Exception, even with the configuration file undeleted.
I finally got Analysis complete! Found 3,890 issues. in 1h 29m 54s.

@felipebonezi
Copy link

@xiaoyang24 It does look like this is non-standard configuration because the message it tries to format has a syntax error. I made a fix in the PR linked above. You could build the engine locally from the sources by running:
docker build . -t codeclimate/codeclimate-scalastyle:latest
and then run codeclimate analyzer using the command:
CODECLIMATE_DEBUG=1 codeclimate analyze --dev --engine scalastyle
This would print debug information including the message that causes error.

Can you help me? I'm having this problem.
I don't know how to fix it. 😢

.scalafmt.conf

version = "2.7.5"

align.preset = more
maxColumn = 100
newlines.alwaysBeforeTopLevelStatements = true

rewrite.rules = [
ExpandImportSelectors,
RedundantBraces,
RedundantParens,
SortModifiers,
PreferCurlyFors
]
rewrite.redundantBraces.stringInterpolation = true

Error
Captura de Tela 2021-04-13 às 12 02 59

@ivanobulo
Copy link

@felipebonezi It's been a while since I looked at this project. From the error message it looks like its the same issue. Build the codeclimate-scalastyle locally:
docker build . -t codeclimate/codeclimate-scalastyle:latest
run
CODECLIMATE_DEBUG=1 codeclimate analyze --dev --engine scalastyle
and post error message here. If you do it properly it should contain log message "Unable to format the message. Invalid message format for key". I don't see it in the message you posted earlier.

@felipebonezi
Copy link

@felipebonezi It's been a while since I looked at this project. From the error message it looks like its the same issue. Build the codeclimate-scalastyle locally:
docker build . -t codeclimate/codeclimate-scalastyle:latest
run
CODECLIMATE_DEBUG=1 codeclimate analyze --dev --engine scalastyle
and post error message here. If you do it properly it should contain log message "Unable to format the message. Invalid message format for key". I don't see it in the message you posted earlier.

@ivanobulo my previous log file was using the command CODECLIMATE_DEBUG=1 codeclimate analyze --dev --engine scalastyle.

I've done what you asked me to do and still returning the same log. 😢

Captura de Tela 2021-04-21 às 06 11 33

@ivanobulo
Copy link

try adding '&&' before codeclimate, like this:
CODECLIMATE_DEBUG=1 && codeclimate analyze --dev --engine scalastyle

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

No branches or pull requests

4 participants