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.
Related
Is there a way on Jenkins to check if my code is google style formatted and only pass the build if the formatting is correct? I am using google style formatting but currently haven't found a good answer about this anywhere
maven checkstyle (or findbugs) plugin can report violations, jenkins warnings-ng can generate report (and I hope mark build as failed).
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!
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
I have configured check style plugin in eclipse juno.
I have a following snippet in my code:
articleView.setResponseType("HTML");
articleView.setImageFilePrefix(imageURL);
articleView.setUrlIndicator("Y");
In above code , I want to make checkstyle plugin to check is there any hard coded values or not like "HTML"
I am using built in sun check style xml file.
I have used following check style plugin version for eclipse juno :
"net.sf.eclipsecs-updatesite_6.4.0.201503042206-bin.zip"
How can I make my check style plugin to check is there any hard code values or not mean to say is there, any rule which we can define in check style xml fiel to check hard coded values for string.
Can any one help me out.
Thanks in advance.
Naresh.
How about this? I've copied and modified the existing sun checkstyle configuration and made it default.
Eclipse can do this without check style.
In the Preferences look at 'Java > Compiler > Errors/Warnings'. In the 'Code style' section change 'Non-externalized strings' to Warning or Error.
In Visual Studio land, I used to be able to define a structure in an XSD file and add a special attribute to it which would cause it to be dynamically compiled and available to use with intellisense in the other C# files in the application. I am not sure exactly what the term for this is, perhaps "dynamic code generation."
I am trying to accomplish the same in Java using Eclipse IDE. Basically what I am looking for is a tool that will allow me to specify some template and generate Java code from it in a "hot folder" that will allow me code complete in the other static Java files.
Does anyone know of a solution for this? I know it is possible in Visual Studio, but I can't seem to find anything for Eclipse.
Ok, here is exactly what I want to do.
Step 1. I create a folder called templates
Step 2. I create a file called HelloWord.ibes
Step 3. Code it automatically generated in my src folder HelloWorld.java
I want to be able to do this in eclipse easily.
You may create an ant build file that does the source generation for you. Then you are free to use any code generator you like. Ant support is part of the eclipse IDE. If you prefer maven, there's a nice eclipse pluging available (that's what I actually use for source code generation based on jaxb, javacc and xdoclet...).
Technically spoken, you just add another eclipse builder which is invoked anytime eclipse detects a change in your code base.
If you already have a code generator in mind, just 'ask' the internet if there's a plugin available.
Edit
On how to install a builder: This is done automatically. For maven, you just install the maven plugin (m2eclipse) and enable maven dependencies for a project. Then if you look at the projects properties pages (Builder section), you find a second entry in the list of builders.
It's similiar with ant, even easier, because ant is already integrated. "enable" ant for a project and the builder is added to the list of builders for the project. You can deselect it at any time if it kills performance or switch of automatic building (I don't know by heart how to enable ant builds for a project, but I remember that the eclipse help had sufficiant informations).
All about ant can be found here: Apache Ant
Creating a new builder is difficult, as it has to be coded in java and added to eclipse as a plugin. I bet you don't want to follow that track ;)
I'm not sure whether you have seen the code template option?
Preferences.Java, Code Style then Code Templates
How
to add code templates
Useful
code templates