codeclimate-community / codeclimate-scalastyle

Code climate Analysis Engine for scalastyle
Other
3 stars 4 forks source link

java.util.UnknownFormatConversionException #11

Open efueger opened 5 years ago

efueger commented 5 years ago

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 https://github.com/codeclimate-community/codeclimate-scalastyle/pull/8 ?


troubleshooting resources:

efueger commented 5 years ago

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

ivanobulo commented 5 years ago

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

efueger commented 5 years ago

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

xoyo24 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

@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 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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