Riverside-Software / sonar-openedge

CABL (Code Analyzer for ABL in SonarQube) - ABL ANTLR4 Parser
https://riverside-software.fr
GNU Lesser General Public License v3.0
63 stars 26 forks source link

Publish keyword #1103

Closed dominickdm closed 10 months ago

dominickdm commented 1 year ago

Hello, After upgrading to the latest available release (2.23) we have issues with the KeyWordCase rule.

It seems that the keyword PUBLISH is not correctly handled for .NET event publishing:

Example image

image

Can this be improved?

gquerret commented 12 months ago

Yes, there are still a few issues with this rule.

lievendf commented 11 months ago

A couple of other false positives we're getting: afbeelding afbeelding

gquerret commented 10 months ago

This comes from the .Net object signatures that are not available in this environment. You can pass additional property sonar.oe.assembly.catalog (check documentation ). File is generated by PCT.

dominickdm commented 10 months ago

I tried to set this up, but I get the following exeption while parsing the generated catalog.json. I'll send you the JSON by mail.

Error executing sensor: 'OpenEdgeProparseSensor'
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 38 column 8 path $[1].properties[0]
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
    at com.google.gson.Gson.fromJson(Gson.java:932)
    at com.google.gson.Gson.fromJson(Gson.java:870)
    at org.prorefactor.refactor.RefactorSession.injectClassesFromCatalog(RefactorSession.java:133)
    at org.sonar.plugins.openedge.foundation.OpenEdgeSettings.getProparseSession(OpenEdgeSettings.java:748)
    at org.sonar.plugins.openedge.foundation.OpenEdgeSettings.getProparseSessions(OpenEdgeSettings.java:660)
    at org.sonar.plugins.openedge.sensor.OpenEdgeProparseSensor.execute(OpenEdgeProparseSensor.java:155)
    at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:75)
    at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.execute(SensorsExecutor.java:66)
    at org.sonarsource.sonarlint.core.analysis.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:122)
    at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.startComponents(SpringComponentContainer.java:182)
    at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.execute(SpringComponentContainer.java:161)
    at org.sonarsource.sonarlint.core.analysis.container.module.ModuleContainer.analyze(ModuleContainer.java:71)
    at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:58)
    at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:32)
    at org.sonarsource.sonarlint.core.analysis.AnalysisEngine$AsyncCommand.execute(AnalysisEngine.java:153)
    at org.sonarsource.sonarlint.core.analysis.AnalysisEngine.executeQueuedCommands(AnalysisEngine.java:71)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 38 column 8 path $[1].properties[0]
    at com.google.gson.stream.JsonReader.nextString(JsonReader.java:824)
    at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:405)
    at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:393)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
    ... 19 more
gquerret commented 10 months ago

I assume that you've executed the task with PCT 227. There's currently a discrepancy between the output of PCT 227 and the expectation of CABL 2.24. You can generate catalog.json with PCT226, and that should fix the problem. Note that CABL 2.25 will be compatible with PCT 227 output (and break compatibility with the output of PCT 226).

dominickdm commented 10 months ago

I used indeed PCT 227. The parsing error is no longer there after using the PCT226 catalog.json.

Unfortunately, this didn't solve the false positive. I'm also wondering what Publish has to do with the assemblies. This are just ABL class events (https://docs.progress.com/bundle/abl-reference/page/Publish-event-method.html#Publish-event-method) ? See small example below: image

gquerret commented 10 months ago

The catalog attribute should fix Lieven's issue. Class events are not handled correctly, that will be changed.

dominickdm commented 10 months ago

It also didn't fix Lieven's issue. I'll send the new json by mail.

image

gquerret commented 10 months ago