Skip to content

#62 mvn site and #70 GH buttons on mvn site generated page #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The graphs generated in the report will look similar to this one:
Run the following command from the root of your project (the source code does not need to be built):

```bash
mvn org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.4.0:report
mvn org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.5.0:report
```

### As Part of a Build
Expand All @@ -24,7 +24,7 @@ Add the following to your project in the build section. **showDetails** will sh
<plugin>
<groupId>org.hjug.refactorfirst.plugin</groupId>
<artifactId>refactor-first-maven-plugin</artifactId>
<version>0.4.0</version>
<version>0.5.0</version>
<!-- optional -->
<configuration>
<showDetails>true</showDetails>
Expand All @@ -35,23 +35,49 @@ Add the following to your project in the build section. **showDetails** will sh
</build>
```

### As a Report
### As a Maven Report
Add the following to your project in the reports section.
Not supported as of Version 0.2.0 due to CVE-2020-13936
```xml
<reporting>
<plugins>
...
<plugin>
<groupId>org.hjug.refactorfirst.plugin</groupId>
<artifactId>refactor-first-maven-plugin</artifactId>
<version>0.1.1</version>
<version>0.5.0</version>
</plugin>
...
</plugins>
</reporting>
```

If you see an error similar to
```
Execution default-site of goal org.apache.maven.plugins:maven-site-plugin:3.3:site failed: A required class was missing while executing org.apache.maven.plugins:maven-site-plugin:3.3:site: org/apache/maven/doxia/siterenderer/DocumentContent
```
you will need to add the following to your pom.xml:
```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.4.5</version>
</plugin>
</plugins>
</build>
```

### As an HTML Report
```bash
mvn org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.5.0:htmlReport
```

## But I'm using Gradle / my project layout isn't typical!
I would like to create a Gradle plugin and (possibly) support non-conventional projects in the future, but in the meantime you can create a dummy POM file in the same directory as your .git directory:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void rankAtfd(List<GodClass> godClasses) {
}

void rankTcc(List<GodClass> godClasses) {
log.info("Calculating Total Cyclomatic Complexity (TCC) Rank");
log.info("Calculating Tight Class Cohesion (TCC) Rank");
godClasses.sort(Comparator.comparing(GodClass::getTcc));

Function<GodClass, Float> getTcc = GodClass::getTcc;
Expand Down
30 changes: 15 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -314,21 +314,21 @@
</executions>
-->
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>6.1.0</version>
<configuration>
<failBuildOnCVSS>8.0</failBuildOnCVSS>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.owasp</groupId>-->
<!-- <artifactId>dependency-check-maven</artifactId>-->
<!-- <version>6.1.0</version>-->
<!-- <configuration>-->
<!-- <failBuildOnCVSS>8.0</failBuildOnCVSS>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!--TODO: Add the SNYK plugin-->
<!-- https://github.com/snyk/snyk-maven-plugin -->

Expand Down
46 changes: 46 additions & 0 deletions refactor-first-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,65 @@
<artifactId>graph-data-generator</artifactId>
</dependency>

<!-- Doxia -->
<!-- Needed since maven-reporting-impl brings in Struts 1.3.8 jars that have CVSS > 8 -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sink-api</artifactId>
<version>2.0.0-M6</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-decoration-model</artifactId>
<version>2.0.0-M6</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-core</artifactId>
<version>2.0.0-M7</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>2.0.0-M11</version>
</dependency>

<!-- Maven Reporting -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.core.version}</version>
</dependency>

<!-- Maven Reporting -->
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>3.1.1</version>
</dependency>

<!-- plugin API and plugin-tools -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.3.3</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@Slf4j
@Mojo(
name = "report",
name = "htmlReport",
defaultPhase = LifecyclePhase.SITE,
requiresDependencyResolution = ResolutionScope.RUNTIME,
requiresProject = false,
Expand Down
Loading