Ignore existing issues in Sonarqube analysis - java

I am setting up sonarqube code analysis for my existing projects. I want to focus only one issues on new code and ignore already existing issues.Is there a way to export existing defects list and use it as baseline of defects which should be ignored.
I can create the project and mark all issues as Cannot be fixed/ignored. But i have to do it for every release version. We have different release versions
Thanks in Advance

If I understood well, it seems you need to flag some of your Sonar issues, so you can exclude them from results when a new analysis is performed.
You can do it by creating an Action Plan (Important: this feature has been removed from Sonar > 5.3) and assigning the issues to this Action Plan (call it "baseline").
Then, from the Issues view, you can filter by project and Action Plan, selecting all non-baseline Action Plans.
In case you're using Sonar > 5.3 (no Action Plan feature), you can instead add a "baseline" Tag to your baseline issues (do it by bulk-changing them).
Once issues have been tagged, you can (from Issues view) filter by Tag, selecting all existings tags but "baseline" tag, and save this Filter, so you don't need to create it every time.

This is exactly what the SonarQube Leak Period is for.
You don't mention your SonarQube server version, so I'll assume the latest: 6.3.
Set Administration > General > Leak > Leak Period to the appropriate value, whether that's a date, previous_version, or a number of days. Then focus solely on "new" metrics, such as Coverage on New Code.
The SonarQube interface is designed to help you focus on Leak Period values by pulling them out into a separate section of the project home page:

Related

Need Updated StickerView with auto face detect functionality

I have tried to find out a new updated Stickerview library but no updated library available on GitHub.
https://github.com/kencheung4/android-StickerView
https://github.com/nimengbo/StickerView
All the Above library not working well.
Functionality Needed:
Auto Face detects and applies the sticker on it very well.
Multiple stickers can add/replace at a time.
Please suggests how to look for a good library for Stickerview.
(This is not a request for finding a tool)
You can refer to the "Network" section of those two repositories:
https://github.com/kencheung4/android-StickerView/network
https://github.com/nimengbo/StickerView/network
You will see the forks created from said repositories, and the newer commits done in those forks.
That way, you might find the one fork which include the fixes you want.
For example: usmanrana07/android-StickerView includes:
Added 'controlFrameVisibility' method
The controller frame should hide after particular time of ACTION_UP even because if user wants to take screenshot then those icons also remain visible in picture.
I have added pieces of code which will hide the controller frame after 2 seconds of action completion and it would be visible again on touch to the view.
And yongjhih/StickerView adds a StickerManager for simpler application, which could be of interest in your case.
There might not be the exact features you are looking for, but the "Network" section is a good way to assess if said features were already coded, or if you need to implement them.

Reverting source code to Java after IntelliJ's Kotlin > Java conversion

So I wanted to try out converting our backend API source code which is written in Java and see how it looks (IIRC there is a preview before converting), but once I did it it automatically started converting all the files in the selected folders, and in the end it asked for code corrections, which I responded with no as I wanted to cancel it and now I am stuck with a broken code base with no other options than:
Reverting to the last git commit and reimplementing all the changes done from my side (I could have prevented it but committing before the conversion but oh well)
Continue using Kotlin to code in but I have code errors which I don't know how to fix
What I am asking instead is if there's anyway to convert Kotlin back to Java in IntelliJ IDEA? Thank you in advance
Intellij has a feature called Local History and it can be used to go back in time for things you did not commit to your source control system. This history is retained until you install a new version of IntelliJ IDEA or invalidate caches. Read more in the Intellij help for the feature.
Your source code constantly changes as you edit, test, or compile. Any version control system tracks the differences between the committed versions, but the local changes between commits pass unnoticed. Local History is your personal version control system that tracks changes to your source code on your computer and enables you to compare versions and roll changes back, if necessary. Local History is always at your disposal, no steps are required to enable it.
Local History is independent of external version control systems and works with the directories of your project even when they are not under any VCS control. It applies to any structural artifacts: a project, a directory or package, a file, a class, class members, tags, or selected fragment of text.

How do I get the "clouds" view back in Sonar?

We have a Java project, which gets built by a Jenkins job and is then analyzed by Sonar.
We used to have a view within the Sonar part of the Jenkins build results called "Clouds", which showed the complexity of a class versus its test coverage, which was a very useful metric. (See here for an example)
But now - I assume after some updates which were made to Sonar/Jenkins - it is not longer available. Can someone tell me how to get it back?
[We use SonarQube 4.5.4]
This feature is now a dedicated widget called "Project File Word Cloud" that you can add on one of your dashboards in SonarQube.

Eclipse unable to clean build output

I have an Eclipse (4.4.1) working set consisting of ~60 projects (the number may be relevant, as it takes more time to refresh the workspace). Occasionally, I encounter build failures because Eclipse is unable to clean the output folder before build:
It turned out that the process which locks the file is Eclipse itself:
It also turned out that files being locked are always of XML content. Particularly, if I define resources with *.foo extension as XML files (via Preferences -> General -> Content Types), there's a good chance they will be locked, too, once they're copied to the output path.
I thought the problem was caused by all XML resources being validated automatically:
-- so I added exclusion filters 1st and even disabled XML/XSD validation entirely. The problem stopped occurring that often, but still emerges from time to time. Refreshing or closing-reopening a project isn't helpful.
The only remedy is restarting Eclipse or running Unlocker every 1/2 hour, which is not very convenient.
Any ideas how to solve or at least further diagnose this?
Just my 2 cents.
Perhaps you can fix this issue by following this steps:
Project -> Properties -> Builders -> New -> Program
Define a custom "Cleaner"-Program, for example Unlocker or your own Java- or CMD-script
Move your custom Builder-Program up. It should be the first Builder in the list
P.S. some times i have similar problems caused by Avira Antivirus Scanner...
Disable third-party version control daemons. (Like TGitCache).
They only lock resources for a short while and are not visible in Process Explorer, but are the most frequent cause of such failures.
Assuming that XML Validation is the main cause of your problem, I suggest you extend your search for validation points in your projects' configuration, to set off all of them:
General preferences/Validation
General preferences/XML/XML files/Validation (the "honour all schema locations" option might be causing delay at validating)
Project preferences/Validation (check them; might be overriding the general preferences)
Project preferences/Builders/Validator
Hope it helps.
I have experienced similar issues. Yes, the number of projects is probably the cause. Close the projects not in use. If that cleans things up moving groups of related project into separate work spaces should help you out.
i.e File-> Close project
I'm not familiar with the problem, but I would tackle the problem this way:
download File Leak Detector
add the agentpath to your eclipse.ini (e.g.,
-javaagent:path/to/file-leak-detector.jar=http=19999, see documentation of File Leak Detector)
when the problem happens again, see which (eclipse) class is responsible for holding a handle of the file
Find out what is the purpose of the class that holds the handle
This way, you are maybe able to pin down the Eclipse feature that causes your problem.

Are Eclipse warnings customizable beyond just the level

I am wondering if it possible to, for example, set the warning level for unused import statements on files that end in *Impl.java?
I know I can use the #SupressWarnings annotations, but the files that I want excluded are built from another project. I simply want to ignore their problems...at least for the time being.
I don't see any customizable options that would achieve this and my Google-Fu is failing me.
I assume it is simply not an available option, but I thought I would ask the experts before I wrote it off completely.
Thanks!
Go to Window > Preferences > Java > Compiler > Errors/Warnings
This menu gives you the option to choose which occurrences of events you want to treat as error/warning/not-at-all.
(There are more places where you can configure additional cases, e.g. Window > Preferences > Java Persistence > Errors/Warnings for the Java Persistence framework. To find them all use the in-menu search (top left corner in the preferences menu) and search for 'warning' or something like that.)
As far as I know it is not possible to specify any further conditions for the configuration of the warn levels.
Isn't it an option to just switch the option to 'ignore' for the time you work on this specific project?
A work around could be to have a second workspace just for that project. As eclipse saves its preferences workspace-wise this would not affect your other projects.
Perhaps keep those files in a different project. Set the project settings so it doesn't display the warnings. Than include this project in your current project. Not sure if it works and if this is what you wants but it might be a workaround.

Categories