Giter Site home page Giter Site logo

jqassistant / jqa-xml-plugin Goto Github PK

View Code? Open in Web Editor NEW
2.0 7.0 2.0 243 KB

XML Plugin of jQAssistant. It enables jQAssistant to scan and to analyze XML related artifacts.

Home Page: https://www.jqassistant.org

License: GNU General Public License v3.0

Java 100.00%
jqa jqassistant xml

jqa-xml-plugin's Introduction

jQAssistant XML Plugin

This is the XML Plugin of jQAssistant. It enables jQAssistant to scan and to analyze XML related artifacts like:

  • XML documents

  • XML Schema Documents

For more information on jQAssistant see https://jqassistant.org.

jqa-xml-plugin's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jqa-xml-plugin's Issues

XML Plugin creates two text nodes instead of one.

While writing rules for jQAssistant the XML Plugin returned two text nodes for the following element in the Maven POM of the plugin parent

<description>
    The parent POM for all plugins developed by the jQAssistant team.
    It defines a standard of actions, checks and dependencies
    required by each jQAssistant plugin.
</description>

To reproduce use commit 35213e9 of the jQAssistant Plugin parent.

Use Github Actions to provide a simple CI/CD Buildchain

As core developer of jQAssistant, I want this project to be build on various plattforms with different JDK versions on each commit, so that I know if the change done my the commit does not break the build and the software is fully functional.

The following acceptance criterias must be met:

  • mvn -DskipTests -Djqassistant.skip clean install must pass
  • mvn -Djqassistant.skip clean install must pass
  • mvn -P IT clean install must pass
  • mvn -DskipTests -Djqassistant.skip=false clean install must pass

XMLFileFilter should ignore initial comments

XMLFileFilter is used identify the JPA version of persistence.xml files but currently fails if the first element in the file is a comment, e.g.

<?xml version="1.0" encoding="UTF-8"?>
<!--
Some comment
  -->
<persistence version="2.1" ..

Many XML files are not labled with label Xml

While running jQAssistant 1.1.1 on the current checkout of the jQAssistant project I recognized that where are many XML documents not labled with Xml.

To reproduce build jQAsisstant from source and run the server interface of jQAssistant. Then run the query MATCH (f:File) WHERE f.fileName =~ ".*\\.xml" RETURN f LIMIT 25. You will find a lot of XML files labled only with File.

Maven POM not correctly scanned

Currently we are not able to scan the Maven POM of the RDBMS plugin correctly. I set the tag mark-repository-element-not-scanable in the repository of the RDBMS plugin to mark the affected code.

Because of the incomplete/incorrect scan we following query has always an empty result set:

MATCH (rp:RootProject)-[:HAS_MODEL]->(m:Xml:Pom:Maven)
          -[:HAS_ROOT_ELEMENT]->(rootElement:Element:Xml)
          -[:HAS_ELEMENT]->(reps:Element:Xml {name: "repositories"})
          -[:HAS_ELEMENT]->(r:Xml:Element {name: "repository"})
          -[:HAS_ELEMENT]->(url:Xml:Element)
          -[:HAS_TEXT]->(t:Text:Xml {
                 value: "https://oss.sonatype.org/content/repositories/snapshots"}
           )
WITH r

MATCH (r)-[:HAS_ELEMENT]->(s:Xml:Element {name: "snapshots"})
                -[:HAS_ELEMENT]->(e:Xml:Element)-[:HAS_TEXT]->(v:Xml:Text {value: 'true'})
RETURN r

If I revoke all plugin related sections the scan will find all nodes and the query succeeds.

Actually this is a strange problem as this problem does not occure for other projects.

Failing XML test report scan while using bolt protocol

Problem
Exception during Surefire XML test report scan while communicating via the bolt protocol.

Steps to reproduce

  • Check out https://github.com/buschmais/spring-petclinic
  • Uncomment the bolt connection properties in the pom.xml
  • Start an appropriate Neo4j server (starting the embedded Neo4j server is enough)
  • Build the whole project with mvn clean install

Environment

  • Windows 10 64-Bit
  • Git Bash
  • Java JDK 8 u131
  • Maven 3.5.0

Notes

  • This only occurs while using the bolt protocol. There are no problems while communicating with the embedded Neo4j instance directly.
  • Maybe the evaluated new line of the property line.separator in the Surefire XML report causes the trouble:
    <property name="line.separator" value="
"/>
    <property name="java.vm.specification.vendor" value="Oracle Corporation"/>

Current workaround

  • Scan succeeds with -DskipTests

Maven debug log snippet

[[1;34mINFO[m] Entering C:/Temp/spring-petclinic/target/surefire-reports
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.model.ValidatorTests.txt
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.service.ClinicServiceJdbcTests.txt
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.service.ClinicServiceJpaTests.txt
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.service.ClinicServiceSpringDataJpaTests.txt
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.web.CrashControllerTests.txt
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.web.OwnerControllerTests.txt
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.web.PetControllerTests.txt
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.web.PetTypeFormatterTests.txt
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.web.VetControllerTests.txt
[[1;36mDEBUG[m] Scanning /org.springframework.samples.petclinic.web.VisitControllerTests.txt
[[1;36mDEBUG[m] Scanning /TEST-org.springframework.samples.petclinic.model.ValidatorTests.xml
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] [1;31mBUILD FAILURE[m
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] Total time: 02:00 min
[[1;34mINFO[m] Finished at: 2018-04-23T09:04:14+02:00
[[1;34mINFO[m] Final Memory: 47M/432M
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;31mERROR[m] Failed to execute goal [32mcom.buschmais.jqassistant:jqassistant-maven-plugin:1.3.0:scan[m [1m(default-cli)[m on project [36mspring-petclinic[m: [1;31mExecution default-cli of goal com.buschmais.jqassistant:jqassistant-maven-plugin:1.3.0:scan failed: Unexpected problem encountered while scanning: item='MavenProject: org.springframework.samples:spring-petclinic:4.2.6-SNAPSHOT @ C:\Temp\spring-petclinic\pom.xml', path='C:\Temp\spring-petclinic\pom.xml', scope='PROJECT', pipeline='[com.buschmais.jqassistant.plugin.maven3.impl.scanner.MavenProjectScannerPlugin@3397c8c0]'. Please report this error including the full stacktrace (continueOnError=false).[m: Unexpected problem encountered while scanning: item='C:\Temp\spring-petclinic\target\surefire-reports', path='C:\Temp\spring-petclinic\target/surefire-reports', scope='TESTREPORTS', pipeline='[com.buschmais.jqassistant.plugin.junit.impl.scanner.TestReportDirectoryScannerPlugin@482034fb]'. Please report this error including the full stacktrace (continueOnError=false). Unexpected problem encountered while scanning: item='C:\Temp\spring-petclinic\target\surefire-reports\TEST-org.springframework.samples.petclinic.model.ValidatorTests.xml', path='/TEST-org.springframework.samples.petclinic.model.ValidatorTests.xml', scope='TESTREPORTS', pipeline='[com.buschmais.jqassistant.plugin.common.impl.scanner.FileResourceScannerPlugin@769d0ef2, com.buschmais.jqassistant.plugin.junit.impl.scanner.TestReportScannerPlugin@57386162]'. Please report this error including the full stacktrace (continueOnError=false). Unexpected problem encountered while scanning: item='javax.xml.transform.stream.StreamSource@f905f3e', path='/TEST-org.springframework.samples.petclinic.model.ValidatorTests.xml', scope='TESTREPORTS', pipeline='[com.buschmais.jqassistant.plugin.xml.impl.scanner.XmlSourceScannerPlugin@2c2dfde3]'. Please report this error including the full stacktrace (continueOnError=false). NullPointerException -> [1m[Help 1][m
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal [32mcom.buschmais.jqassistant:jqassistant-maven-plugin:1.3.0:scan[m [1m(default-cli)[m on project [36mspring-petclinic[m: [1;31mExecution default-cli of goal com.buschmais.jqassistant:jqassistant-maven-plugin:1.3.0:scan failed: Unexpected problem encountered while scanning: item='MavenProject: org.springframework.samples:spring-petclinic:4.2.6-SNAPSHOT @ C:\Temp\spring-petclinic\pom.xml', path='C:\Temp\spring-petclinic\pom.xml', scope='PROJECT', pipeline='[com.buschmais.jqassistant.plugin.maven3.impl.scanner.MavenProjectScannerPlugin@3397c8c0]'. Please report this error including the full stacktrace (continueOnError=false).[m
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal com.buschmais.jqassistant:jqassistant-maven-plugin:1.3.0:scan failed: Unexpected problem encountered while scanning: item='MavenProject: org.springframework.samples:spring-petclinic:4.2.6-SNAPSHOT @ C:\Temp\spring-petclinic\pom.xml', path='C:\Temp\spring-petclinic\pom.xml', scope='PROJECT', pipeline='[com.buschmais.jqassistant.plugin.maven3.impl.scanner.MavenProjectScannerPlugin@3397c8c0]'. Please report this error including the full stacktrace (continueOnError=false).
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	... 20 more
Caused by: java.lang.IllegalStateException: Unexpected problem encountered while scanning: item='MavenProject: org.springframework.samples:spring-petclinic:4.2.6-SNAPSHOT @ C:\Temp\spring-petclinic\pom.xml', path='C:\Temp\spring-petclinic\pom.xml', scope='PROJECT', pipeline='[com.buschmais.jqassistant.plugin.maven3.impl.scanner.MavenProjectScannerPlugin@3397c8c0]'. Please report this error including the full stacktrace (continueOnError=false).
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:93)
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:59)
	at com.buschmais.jqassistant.scm.maven.ScanMojo.execute(ScanMojo.java:93)
	at com.buschmais.jqassistant.scm.maven.AbstractModuleMojo$1.run(AbstractModuleMojo.java:21)
	at com.buschmais.jqassistant.scm.maven.AbstractMojo.execute(AbstractMojo.java:326)
	at com.buschmais.jqassistant.scm.maven.AbstractModuleMojo.execute(AbstractModuleMojo.java:24)
	at com.buschmais.jqassistant.scm.maven.AbstractMojo.execute(AbstractMojo.java:211)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 more
Caused by: java.lang.IllegalStateException: Unexpected problem encountered while scanning: item='C:\Temp\spring-petclinic\target\surefire-reports', path='C:\Temp\spring-petclinic\target/surefire-reports', scope='TESTREPORTS', pipeline='[com.buschmais.jqassistant.plugin.junit.impl.scanner.TestReportDirectoryScannerPlugin@482034fb]'. Please report this error including the full stacktrace (continueOnError=false).
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:93)
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:59)
	at com.buschmais.jqassistant.plugin.maven3.impl.scanner.MavenProjectScannerPlugin.scanPath(MavenProjectScannerPlugin.java:328)
	at com.buschmais.jqassistant.plugin.maven3.impl.scanner.MavenProjectScannerPlugin.scanPath(MavenProjectScannerPlugin.java:299)
	at com.buschmais.jqassistant.plugin.maven3.impl.scanner.MavenProjectScannerPlugin.scan(MavenProjectScannerPlugin.java:94)
	at com.buschmais.jqassistant.plugin.maven3.impl.scanner.MavenProjectScannerPlugin.scan(MavenProjectScannerPlugin.java:39)
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:82)
	... 28 more
Caused by: java.lang.IllegalStateException: Unexpected problem encountered while scanning: item='C:\Temp\spring-petclinic\target\surefire-reports\TEST-org.springframework.samples.petclinic.model.ValidatorTests.xml', path='/TEST-org.springframework.samples.petclinic.model.ValidatorTests.xml', scope='TESTREPORTS', pipeline='[com.buschmais.jqassistant.plugin.common.impl.scanner.FileResourceScannerPlugin@769d0ef2, com.buschmais.jqassistant.plugin.junit.impl.scanner.TestReportScannerPlugin@57386162]'. Please report this error including the full stacktrace (continueOnError=false).
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:93)
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:59)
	at com.buschmais.jqassistant.plugin.common.api.scanner.AbstractContainerScannerPlugin.scan(AbstractContainerScannerPlugin.java:50)
	at com.buschmais.jqassistant.plugin.common.api.scanner.AbstractContainerScannerPlugin.scan(AbstractContainerScannerPlugin.java:29)
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:82)
	... 34 more
Caused by: java.lang.IllegalStateException: Unexpected problem encountered while scanning: item='javax.xml.transform.stream.StreamSource@f905f3e', path='/TEST-org.springframework.samples.petclinic.model.ValidatorTests.xml', scope='TESTREPORTS', pipeline='[com.buschmais.jqassistant.plugin.xml.impl.scanner.XmlSourceScannerPlugin@2c2dfde3]'. Please report this error including the full stacktrace (continueOnError=false).
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:93)
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:59)
	at com.buschmais.jqassistant.plugin.xml.api.scanner.AbstractXmlFileScannerPlugin.scan(AbstractXmlFileScannerPlugin.java:48)
	at com.buschmais.jqassistant.plugin.xml.api.scanner.AbstractXmlFileScannerPlugin.scan(AbstractXmlFileScannerPlugin.java:25)
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:82)
	... 38 more
Caused by: java.lang.NullPointerException
	at com.buschmais.jqassistant.plugin.xml.impl.scanner.XmlSourceScannerPlugin.scan(XmlSourceScannerPlugin.java:63)
	at com.buschmais.jqassistant.plugin.xml.impl.scanner.XmlSourceScannerPlugin.scan(XmlSourceScannerPlugin.java:24)
	at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:82)
	... 42 more
[[1;31mERROR[m] 
[[1;31mERROR[m] 
[[1;31mERROR[m] For more information about the errors and possible solutions, please read the following articles:
[[1;31mERROR[m] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[[1;34mINFO[m] Closing store in directory 'bolt://localhost:7687'.

Migrate the Plugin Documentation of the XML Plugin to the new Reference Manual

Task Description

Migrate the existing documentation of the XML Plugin to the new reference manul.

Definition of Done for the Implementers

  • The reference manual contains the same information as the old user manual
  • The section on the XML Plugin in the old user manual points to the section for the plugin in the reference manual

Explicitly exclude XML files to scan instead of including them

Currently, when adding additional XML files to the scan, not only the scan.include.files property but also the xml.file.includeproperties need to be set accordingly. This is redundant and inconsistent to other scanner plugin.

I propose to remove the need for redundancy by only keeping the standard scan.include.files way. In case large XML files need to be excluded due to performance issues, the already existing property xml.file.excludecan be used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.