Custom sonar-xml plugin highlighting conflict - java

I've developed a custom XML plugin for Sonar, based on a fork of official sonar-xml plugin following these recommendations.
When I develop the custom plugin the sonar-xml version was 1.5.1 and and both plugins work fine together in SonarQube 5.6.6.
Now I'm upgrading the SonarQube version to 7.9.1 and his plugins, but when the analysis is performed with sonar-xml-plugin v2.0.1 and my custom xml plugin based on sonar-xml-plugin v1.5.1 I get an error trying to save highlighting for XML files and an Issue in those files with issues detected by both plugins:
Parse error: Trying to save highlighting twice for the same file is not supported: samplefile.xml
Rule: XML parser failure (xml:S2260)
After seeing the javadoc of NewHighlighting class I came to the conclusion that it is a deliberate decision but I need to use both plugins and I would not want to leave them without updating because I also want to see the issues in SonarLint.
And not, rules based on XPath template of sonar-xml-plugin are not enough for my rules requirements.
Has anyone somewhere had the same problem? Some idea to solve the problem?
Thanks a lot in advance!

Related

Static format checker for xml files using Maven

i'm using Maven as a build tool and Checkstyle to check that files conform to the agreed coding style.
The problem is that i also want to check formatting in XML files too, just simple indentation checks, but checkstyle doesn't support it.
I just can't find a tool that can do this simple checks and integrate with Maven.
Any ideas ?
A quick google search offers this:
https://www.mojohaus.org/xml-maven-plugin/check-format-mojo.html
Full name:
org.codehaus.mojo:xml-maven-plugin:1.0.2:check-format
Description:
An XML indentation check over a set of files.
Though I have not used it myself.

Intellij IDEA Plugin for RAML

I have just started using RAML in my Java project. I am using Intellij IDEA and there my RAML file is displayed as raw text, without any text highlighting. It seems that it doesn't recognize this type of file at all.
Is there any plugin for RAML in Intellij IDEA?
Mostly I tried to google it and also checked in the list of plugins. If plugin doesn't exist, what would you suggest? It seems that then I would need to use some other tool to modify properly this file.
RESTful API Modeling Language (RAML) is a YAML-based language for describing RESTful APIs.
Intellij has a plugin for YAML syntax so you can use that for RAML.
Just go to settings -> Editor -> File Types.
Then under Recognized File Types just scroll down to YAML and select it.
Now just add *.raml and *.rml to the Registered Patterns section and you will get syntax highlighting.
There is a plugin Raml Intellij Plugin . It is still in beta but you can use it. You can download directly from the Intellij Repositories
The RAML Workbench for Atom is a good way to get started. It provides a lot of guidance to writing RAML.
The Raml plugin that I used to mantain is no longer under dev. To replace that I've added raml completion to the DataWeave Plugin. So if you install the Plugin It will also add Raml and Oas support. Saddly I needed to do this change. All these plugins are being mantain on my spare time

Analyzing library dependencies for .Net / NuGet projects with SonarQube Plugin

We are analyzing several Projects in SonarQube -> Java and also .Net Projects.
For Java / Maven Projects its no Problem to see the Library dependencies -> Which component uses which Library. There is even a dependency browser built-in in the Sonar core.
For .Net Projects we use NuGet for the dependency Management. In Sonar its not possible to see which Component uses which Library with the specific version for .Net / NuGet Projects. Now we want to know which Library is used in which Component and vice versa. And that's why I'm writing a plugin that shows me the the NuGet dependencies.
There are two possibilities:
1. Solution: The easy way
I write a Plugin that parses the "repositories.config" and the appropriate "packages.config" Files, persists this information into the database and then show them in a widget.
2. Solution: The elegant way
I write a plugin which reads the NuGet information from the "repositories.config" and the appropriate "packages.config" files and perstist this information the same way like the maven information is perstisted too in the database. Then also the built-in dependency browser would find the NuGet dependencies.
So:
A question for Solution 1:
What would be the best way to persist the dependency information? A String Measure for each project with a JSON containing the dependency information?
A question for Solution 2: (And this is my main question here)
Do you know how / where this data is persisted in the Sonar database for maven projects? It would take me a lot of time trying to reenigneer the whole sonar source code. Maybe someone has an idea how i can find this information faster or maybe you have even other ideas to solve my problem.
The goal would also be to share this plugin to the community.
Thank you!
Regards
Cédric

Info about version dependancies of enterprise java libraries

I am new to enterprise application developement and trying to create a REST server with Spring REST, JPA taking to mySQL database and Javascript on the client side. As I see loads of opensource libraries doing specific task, I started off with using 'maven project' with different 'arch type' (which is nothing but predefined POM with relevent libraries as I understand) provided by Eclipse. But I often run into version mismatch issues, in many cases found specific solution to that perticular libraries in StackOverflow or other sites.
Hence I started looking for a information these version dependancies such as, this version of JPA works with that version of Hibernate library and so on. I checked maven repository of major libraries, I did not find such information so far.
My queries are:
Where can I find these information about the versions dependancies?
Are these pre defined POM in eclipse reliable? Who owns them, where can I get last modified dates on these maven 'arch types'? (I find the ones I choose having fairly old version of libraries).
If I have to start off on my own creating a Maven dependacies, where will I get information about what are the dependent libraries, for example, if I need spring MVC, for sure it needs java servlet library. I am worried becuase the maven 'spring-mvc-jap' arch type whooping 50 libaries as dependancies.(Coming from embeded domain, I find to too hard to digest :D). So not sure if it is the right way.
Please correct if I am missing anything in my understanding.
You can find this information, if you are using maven and some IDE you can go to the dependancy and make click un > and this will show the librarys used for this dependancy or if you want to use the console you have http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html this will show the same that the IDE.
After normally in the documentation of the library used, you can find some doc about the dependancy about this.
Other solution is get the .jar and use 7zip to see the POM and know the dependancy used.
And for finish my answer if the IDE tell you that you dont have x dependancy normally you have to add this because any of the other dependancy used have it (they used only for the compiling task), but sometime somes projet change a lots of code between the version .a to .b so you will have some problem using the version .b, at this moment i didnt find one good and easy way to fix this, only using the way that i told you (only if i found some problem in the compilation)
3> I am not sure how it works in eclipse but in IntelliJ IDEA when you start using some class without proper dependency IDEA suggest you to add proper dependency automatically. The same approach should be in eclipse.

Adding a plugin dependency to my plugin breaks existing non-plugin library (Google Data API)

I'm writing an eclipse plugin. This plugin uses a few local jar files, and additionally has a few dependencies on other plugins.
I'm using the Google Code Search API from jar files, and it works fine; but after I add the plugin dependency org.eclipse.zest.dot.ui to my project, the Google Code Search API does no longer work - on calling new CodeSearchService("my_ID"), I'm getting the following run-time error:
Analysis failed: java.lang.NoSuchMethodError exception raised.
com.google.common.collect.ImmutableSet.buider()Lcom/google/common/collect/ImmutableSet$Builder;
I have carefully checked and reproduced this: if the plugin appears in the dependency list, the CodeSearchService can no longer be used; if it doesn't, it works perfectly. The actual project code does not change, only a dependency is added.
This is very strange to me, as I don't see how adding a plugin dependency should suddenly make some methods disappear. Has anyone encountered anything similar, and can share any insights about this problem and a possible solution? I'm not even sure if this issue is specific to these two libraries or not.
The org.eclipse.zest.dot.ui bundle pulls in dependencies that depend on the Google Collections, so my guess is that the Google Code Search API requires a different version of these, and is now trying to use the other version. Not sure how to solve this, but you could try to update both to the latest version (see http://wiki.eclipse.org/Zest#Zest_2.x for the newest org.eclipse.zest.dot.ui bundle).

Categories

Resources