SonarQube finds No Issues in Typescript, but local SonarTs finds many errors

First time posting, please be gentle. Sorry if I’m missing something obvious.

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 7.1 Community Docker Image in Kubernetes
    Using Default Typescript, Sonar Way Recommended profile
  • what are you trying to achieve
    See issues in our code
  • what have you tried so far to achieve this
    Logs show the scanner has run and was a success
2020.01.09 14:42:05 INFO  ce[AW-KwUq-iIpz1eOawyHN][o.s.c.t.CeWorkerImpl] Execute task | project=oh-idp | type=REPORT | id=AW-KwUq-iIpz1eOawyHN | submitter=admin
2020.01.09 14:46:14 INFO  ce[AW-KwUq-iIpz1eOawyHN][o.s.c.t.CeWorkerImpl] Executed task | project=oh-idp | type=REPORT | id=AW-KwUq-iIpz1eOawyHN | submitter=admin | status=SUCCESS | time=249278ms

However, when I run sonarts plugin locally in tslint, I see about 50 issues reported. I can’t find any logs which would indicate why no rules are being triggered.
In the project in the sonarqube web dashboard, when I click on the code section, I see all the files along with git commit information, but no issues are found.

Our system is setup with an external cloud db, and scan history is shown, just no “issues”.

What information do I need to add?

Basically, everything looks like it’s working but I’m not getting any negative responses, yet I know the code has issues.

Is there documentation somewhere on what I should be looking at to find the source of the problem?
The logs on the sonarqube pod only show that a project has started and that it was successful.
The profiles page shows me that the Typescript “sonar way recommended” profile is “in use” for all our projects.
But I still am not getting any found issues.

I noticed that the community edition does not support “branches or pull requests”
Our default branch in github is “qa”, and we have a “master” branch, but it’s not the main branch.
Would this cause the problem I’m seeing? Do we need to add the sonar-project.properties file to the master branch instead of our default “qa” branch?

Hi,

Could you please provide full logs of your analysis? Run scanner with ‘-X’ option to get debug logs. Also please provide your sonar-project.properties if any.
Also note that the version of SQ you are using (7.1) is not maintained anymore, please consider updating to 7.9 (LTS) or 8.1 (latest).

Thank you for responding. A Couple of questions.
How do I run the -x argument? I’m using the Jenkins plugin and running sonarqube in docker containers on kubernetes.

Secondly, when I change the version to “latest” which corresponds with 7.9 I get a whole host of error messages. Which docker image is considered stable?

Jenkins Settings


sonar-project.properties file

# must be unique in a given SonarQube instance
sonar.projectKey=oh-idp
sonar.projectName=oh-idp
sonar.projectVersion=5.0.1
sonar.sourceEncoding=UTF-8
sonar.sources=lib/src
sonar.exclusions=**/node_modules/**,**/*.spec.ts
sonar.tests=lib/specs
sonar.test.inclusions=**/*.spec.ts
sonar.ts.tslintconfigpath=tslint.json
sonar.ts.lcov.reportpath=test-results/coverage/lcov.info

Error messages after upgrading SonarQube docker image to 7.9 instead of 7.1

INFO: Load quality profiles (done) | time=2106ms
INFO: Detected Jenkins
INFO: Load active rules
INFO: Load active rules (done) | time=8829ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 16.209s
INFO: Final Memory: 18M/212M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.ProjectFileIndexer
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:281)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:353)
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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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)
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.FileIndexer
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:63)
… 22 more
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonarsource.dotnet.shared.plugins.WrongEncodingFileFilter
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:621)
at org.picocontainer.parameters.CollectionComponentParameter.getArrayInstance(CollectionComponentParameter.java:334)
at org.picocontainer.parameters.CollectionComponentParameter.access$100(CollectionComponentParameter.java:49)
at org.picocontainer.parameters.CollectionComponentParameter$1.resolveInstance(CollectionComponentParameter.java:139)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:141)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:63)
… 36 more
Caused by: org.picocontainer.injectors.AbstractInjector$UnsatisfiableDependenciesException: org.sonarsource.dotnet.shared.plugins.WrongEncodingFileFilter has unsatisfied dependency ‘class org.sonarsource.dotnet.shared.plugins.AbstractConfiguration’ for constructor ‘public org.sonarsource.dotnet.shared.plugins.WrongEncodingFileFilter(org.sonarsource.dotnet.shared.plugins.EncodingPerFile,org.sonarsource.dotnet.shared.plugins.AbstractConfiguration)’ from org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@7f485fda:250<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@2e77b8cf:40<|
at org.picocontainer.injectors.ConstructorInjector.getGreediestSatisfiableConstructor(ConstructorInjector.java:191)
at org.picocontainer.injectors.ConstructorInjector.getGreediestSatisfiableConstructor(ConstructorInjector.java:110)
at org.picocontainer.injectors.ConstructorInjector.access$100(ConstructorInjector.java:51)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:331)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:63)
… 52 more
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
[Pipeline] }
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeeded?

Hi,

This last error after the upgrade makes me think that maybe you have upgraded sonarQube but not its plugins ?
Could you list which plugins are installed on your sonarqube instance ?

So far we are only analyzing the typescript projects

Ok, your plugins look fine.

I suggest you to create a new thread about class loading problem. When having a separate thread with clear problem it’s easier to get help. When that problem is fixed you can bring here fresh logs etc related to TS problem.

Thanks. How do I pass in the -X flag to generate more logs when its running as a Jenkins plugin in a docker container?

It should be “Additional arguments” for the job configuration