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

MissingFieldException: Field 'other_locations' when analyze with sonar-java plugin #4

Open
subotaii opened this issue Dec 29, 2019 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@subotaii
Copy link

Nice work with this intellij plugin nhat phan !
When a launch analyze with sonar-java plugin, i got the exception below.

kotlinx.serialization.MissingFieldException: Field 'other_locations' is required, but it was missing
	at net.ntworld.codeCleaner.codeClimate.internal.AnalyzedIssueImpl.<init>(AnalyzedIssueImpl.kt)
	at net.ntworld.codeCleaner.codeClimate.internal.AnalyzedIssueImpl$$serializer.deserialize(AnalyzedIssueImpl.kt)
	at net.ntworld.codeCleaner.codeClimate.internal.AnalyzedIssueImpl$$serializer.deserialize(AnalyzedIssueImpl.kt:9)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:33)
	at kotlinx.serialization.json.internal.AbstractJsonTreeInput.decodeSerializableValue(TreeJsonInput.kt:43)
	at kotlinx.serialization.CoreKt.decode(Core.kt:79)
	at kotlinx.serialization.json.internal.TreeJsonInputKt.readJson(TreeJsonInput.kt:22)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:41)
	at kotlinx.serialization.json.internal.StreamingJsonInput.decodeSerializableValue(StreamingJsonInput.kt:29)
	at kotlinx.serialization.ElementValueDecoder.decodeSerializableElement(ElementWise.kt:142)
	at kotlinx.serialization.internal.ListLikeSerializer.readItem(CollectionSerializers.kt:98)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.readItem$default(CollectionSerializers.kt:70)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.patch(CollectionSerializers.kt:51)
	at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:61)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:33)
	at kotlinx.serialization.json.internal.StreamingJsonInput.decodeSerializableValue(StreamingJsonInput.kt:29)
	at kotlinx.serialization.CoreKt.decode(Core.kt:79)
	at kotlinx.serialization.json.Json.parse(Json.kt:152)
	at net.ntworld.codeCleaner.Serializer.parse(Serializer.kt:30)
	at net.ntworld.codeCleaner.Serializer.parseIssues(Serializer.kt:39)
	at net.ntworld.codeCleaner.quality.CodeQualityParser.parse(CodeQualityParser.kt:19)
	at net.ntworld.codeCleaner.CodeQualityManager.create(CodeQualityManager.kt:17)
	at net.ntworld.codeCleaner.commandHandler.CreateCodeQualityCommandHandler.handle(CreateCodeQualityCommandHandler.kt:11)
	at net.ntworld.codeCleaner.commandHandler.CreateCodeQualityCommandHandler.handle(CreateCodeQualityCommandHandler.kt:9)
	at net.ntworld.foundation.cqrs.CommandHandler$DefaultImpls.execute(CommandHandler.kt:10)
	at net.ntworld.codeCleaner.commandHandler.CreateCodeQualityCommandHandler.execute(CreateCodeQualityCommandHandler.kt:9)
	at net.ntworld.codeCleaner.LocalCommandBus.process(LocalCommandBus.kt:34)
	at net.ntworld.codeCleaner.commandHandler.CreateAnalyzeProcessCommandHandler$handle$1.invoke(CreateAnalyzeProcessCommandHandler.kt:48)
	at net.ntworld.codeCleaner.commandHandler.CreateAnalyzeProcessCommandHandler$handle$1.invoke(CreateAnalyzeProcessCommandHandler.kt:20)
	at net.ntworld.foundation.Infrastructure$DefaultImpls.invoke(Infrastructure.kt:55)
	at net.ntworld.foundation.InfrastructureResolver.invoke(InfrastructureResolver.kt:12)
	at net.ntworld.codeCleaner.commandHandler.CreateAnalyzeProcessCommandHandler.handle(CreateAnalyzeProcessCommandHandler.kt:27)
	at net.ntworld.codeCleaner.commandHandler.CreateAnalyzeProcessCommandHandler.handle(CreateAnalyzeProcessCommandHandler.kt:20)
	at net.ntworld.foundation.cqrs.CommandHandler$DefaultImpls.execute(CommandHandler.kt:10)
	at net.ntworld.codeCleaner.commandHandler.CreateAnalyzeProcessCommandHandler.execute(CreateAnalyzeProcessCommandHandler.kt:20)
	at net.ntworld.codeCleaner.LocalCommandBus.process(LocalCommandBus.kt:34)
	at net.ntworld.intellijCodeCleaner.task.AnalyzeTask$run$1.invoke(AnalyzeTask.kt:23)
	at net.ntworld.intellijCodeCleaner.task.AnalyzeTask$run$1.invoke(AnalyzeTask.kt:13)
	at net.ntworld.foundation.Infrastructure$DefaultImpls.invoke(Infrastructure.kt:55)
	at net.ntworld.foundation.InfrastructureWrapper.invoke(InfrastructureWrapper.kt:11)
	at net.ntworld.intellijCodeCleaner.task.AnalyzeTask.run(AnalyzeTask.kt:22)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:888)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:163)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:585)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:531)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:150)
	at com.intellij.openapi.progress.impl.CoreProgressManager$4.lambda$run$0(CoreProgressManager.java:402)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:221)
	at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:402)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:238)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

Here my .codeclimate.yml file.

version: "2"
checks:
  argument-count:
    enabled: false
    config:
      threshold: 4
  complex-logic:
    enabled: false
    config:
      threshold: 4
  file-lines:
    enabled: false
    config:
      threshold: 250
  method-complexity:
    enabled: false
    config:
      threshold: 5
  method-count:
    enabled: false
    config:
      threshold: 20
  method-lines:
    enabled: false
    config:
      threshold: 25
  nested-control-flow:
    enabled: false
    config:
      threshold: 4
  return-statements:
    enabled: false
    config:
      threshold: 4
  similar-code:
    enabled: false
    config:
      threshold: #language-specific defaults. overrides affect all languages.
  identical-code:
    enabled: false
    config:
      threshold: #language-specific defaults. overrides affect all languages.
plugins:
  sonar-java:
    enabled: true
    config:
      sonar.java.source: "8"
exclude_patterns:
  - "config/"
  - "db/"
  - "dist/"
  - "features/"
  - "**/node_modules/"
  - "script/"
  - "**/spec/"
  - "**/test/"
  - "**/tests/"
  - "**/vendor/"
  - "**/*.d.ts"
  - "**/*.min.js"
  - "**/*.min.css"
  - "apache/"
  - "bdd/"
  - "mysql/"
  - "web/src/main/resources/"
  - "**/target/"
  - "!**/target/site/jacoco/jacoco.xml"
@nhat-phan nhat-phan self-assigned this Jan 3, 2020
@nhat-phan nhat-phan added the bug Something isn't working label Jan 3, 2020
@nhat-phan
Copy link
Owner

@subotaii Could you please send me the sample of sonar-java plugin output. I can't change the contract if I don't know the output of that plugin.

You can run this command: codeclimate analyze -f json > result.json and find an item which don't have other_locations key

Thank you in advance!

@subotaii
Copy link
Author

subotaii commented Jan 6, 2020 via email

@nhat-phan
Copy link
Owner

Hi @subotaii could you please send me 1 item which doesn't have other_locations. I meant I want to know structure of the item then I can write a correct JSON parser.

@sema4-vadymnovakovskyi
Copy link

Hey!
Is there any updates?
I have the same problem

@sema4-vadymnovakovskyi
Copy link

@nhat-phan I see that in result.json file only "engine_name":"checkstyle" have no key other_locations. May be it will helps you

@sema4-vadymnovakovskyi
Copy link

@nhat-phan
Hey!
Is there any updates?

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
None yet
Development

No branches or pull requests

3 participants