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

Error on highlighting when: "import" used as a (member) variable name in class nested into a namespace #2197

Closed
MarcoWagner opened this issue Jun 16, 2021 · 8 comments · Fixed by #2202
Assignees
Labels
Milestone

Comments

@MarcoWagner
Copy link

Describe the bug
After upgrading to sonar-cxx version 2.0.x the scanner is getting interrupted with the following message:

ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Cannot register highlighting rule for characters at Range[from [line=4, lineOffset=9] to [line=4, lineOffset=14]] as it overlaps at least one existing rule
        at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.checkOverlappingBoundaries(DefaultHighlighting.java:60)
        at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.doSave(DefaultHighlighting.java:120)
        at org.sonar.api.batch.sensor.internal.DefaultStorable.save(DefaultStorable.java:45)
        at org.sonar.plugins.cxx.CxxSquidSensor.saveHighlighting(CxxSquidSensor.java:516)
        at org.sonar.plugins.cxx.CxxSquidSensor.save(CxxSquidSensor.java:377)
        at org.sonar.plugins.cxx.CxxSquidSensor.execute(CxxSquidSensor.java:306)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
        at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:49)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:361)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:

To Reproduce
Scan a file with this content:

namespace Test {
   class Test {
   private:
      bool import = false;
   };
}

Expected behavior
Ideally the variable gets recognized as such.
Alternatively not interrupting the scan, maybe skipping the file with a warning.

Desktop (please complete the following information):

  • OS: Windows
  • SonarQube version: 7.9.3
  • cxx plugin version: 2.0.3
  • sonar-scanner version: 4.6.2.2472
@guwirth guwirth added the bug label Jun 16, 2021
@guwirth
Copy link
Collaborator

guwirth commented Jun 16, 2021

Hi @MarcoWagner,

thanks for the feedback. This seems to be related to #2192.

import and module are identifiers with special meaning in C++20. I will verify it.
https://en.cppreference.com/w/cpp/keyword

Please try with latest snapshot https://ci.appveyor.com/project/SonarOpenCommunity/sonar-cxx/branch/master/artifacts. This does not solve the problem but should continue after a problem as with 1.3.

Regards,

@guwirth
Copy link
Collaborator

guwirth commented Jun 16, 2021

Hi @MarcoWagner,

also here strange: parsing and syntax highlighting with SSLR toolkit is ok:

grafik

Regards,

@MarcoWagner
Copy link
Author

Thanks, the updated version does not interrupt anymore.

The parsing speedup of the new version is awesome. On the Project i am using sonar-cxx it had an impact from several hours to less than 10 minutes!

@guwirth
Copy link
Collaborator

guwirth commented Jun 16, 2021

Hi @MarcoWagner,

...the parsing speedup of the new version is awesome.

Thanks for the feedback...

Regards

@guwirth
Copy link
Collaborator

guwirth commented Jun 17, 2021

Hi @MarcoWagner,

Could you share some insights to the 10 minutes and performance please:

  • how big is your project (LoC)?
  • looking to the LOG file: which sensor needs most of the time?
    • Indexing files...
    • Sensor CXX [cxx]
    • Sensor CXX XXX report import [cxx] XXX=Cppcheck, ClangTidy, ....

Just search for (done) | time in the report.

Regards,

guwirth added a commit to guwirth/sonar-cxx that referenced this issue Jun 18, 2021
@guwirth guwirth self-assigned this Jun 18, 2021
@guwirth guwirth added this to the 2.0.4 milestone Jun 18, 2021
@MarcoWagner
Copy link
Author

currently only using cppcheck and cobertura coverage reports.

~720k LoC

INFO: Sensor CXX [cxx] (done) | time=460850ms
INFO: Sensor CXX Cppcheck report import [cxx] (done) | time=1389ms
INFO: Sensor CXX Cobertura XML coverage report import [cxx] (done) | time=15089ms

@guwirth
Copy link
Collaborator

guwirth commented Jun 22, 2021

Hi @MarcoWagner, thx! That helps to further optimize the plugin...

@MarcoWagner
Copy link
Author

MarcoWagner commented Jun 22, 2021

i also have a wxWidgets based project with interesting stats.

~150k LoC

INFO: Sensor CXX [cxx] (done) | time=5475497ms

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

Successfully merging a pull request may close this issue.

2 participants