Refactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed. How to refactor and reduce the complexity

A little information on how cognitive complexity works and why you should keep it low First of all it is important to understand how “Cognitive Complexity” works as compared to “Cyclomatic Complexity“. Cognitive complexity takes into account the complexity perceived by the human brain. This is why it does not simply indicate the number of … Read more

Ignore SonarQube warnings in python

I believe the only syntax supported for Python (assuming it is supported) is the NOSONAR comment, so #NOSONAR or # NOSONAR at the end of the line where you want to ignore issues. Unfortunately, this is a global issue suppression: it kills all issues on the line, not just those from a specific rule.

Excluding Lombok classes from Sonar coverage report

As mentionned here : https://github.com/jacoco/jacoco/pull/513#issuecomment-293176354 filtering is performed at a time of report generation (creation of html, xml, etc), not at a time of collection of execution information (creation of exec file). So that tools that read execution data directly instead of reading of xml (which is a kind of mistake on their side to … Read more

Sonarqube, “String contains no format specifiers” when logging constant String message

This is a known issue introduced with SonarJava 5.1. You can safely consider this issue as a False Positive (FP) and/or ignore it. It has already been fixed while handling JIRA ticket SONARJAVA-2633. The fix has been delivered with version 5.1.1 of SonarJava analyzer, released on Feb 16, 2018 (requires SonarQube LTS 6.7 or superior). … Read more

What does the “leak period” mean in sonarQube?

Shortly, leak period is time frame (usually since last release), where specified criteria are measured on newly added code. This allows to focus on quality of fresh code and stop the accumulation of technical debt. The “leak” concept is explained in documentation here https://docs.sonarqube.org/display/SONAR/Fixing+the+Water+Leak Update SonarSource has fleshed-out and updated the terminology / philosophy: https://sonarqube.org/features/clean-as-you-code.

Stop sonar on window 64

First try to stop the SonarStart.bat by using Ctrl+c as suggested , and then try to open localhost:9000 ( or whichever port you configured sonar server). If it is still opening then go to task manager and search for wrapper.exe service and stop the service, if no service or app is found then goto: Task … Read more

How to exclude some maven project from sonar analysis

There are several ways, one of which is adding the sonar.skip property inside the pom.xml of the project / module you want to skip. This excludes a project from SonarQube analysis: <properties> <sonar.skip>true</sonar.skip> </properties> This also works with Jenkins and running Sonar as a post build action. For more details see: Analyzing with SonarQube Scanner … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)