diff --git a/07-Investigating the Impact of Design Debt on Software Quality.pdf b/07-Investigating the Impact of Design Debt on Software Quality.pdf new file mode 100644 index 00000000..9cc70851 Binary files /dev/null and b/07-Investigating the Impact of Design Debt on Software Quality.pdf differ diff --git a/README.md b/README.md index 5be6f239..f6ac598a 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ It scans your Git repository generates a single page application by runing: - PMD's Coupling Between Objects Code map viewers are powered by [3D Force Graph](https://vasturiano.github.io/3d-force-graph), [sigma.js](https://www.sigmajs.org/), and [GraphViz DOT](https://graphviz.org/docs/layouts/dot/) -
If there are more than 4000 classes + relationships, a simplified 3D viewer will be used to avoid slowdowns. Features will be toggleable in the 3D UI in a future release. +
If there are more than 4,000 classes + relationships, a simplified 3D viewer will be used to avoid slowdowns. Features will be toggleable in the 3D UI in a future release. Take a look at the [Spring Petclinic REST project sample report](https://rawcdn.githack.com/refactorfirst/RefactorFirst/c46d26211a91ffbe08d4089e04a85ff31eb093c0/spring-petclinic-rest-report.html)! @@ -29,12 +29,13 @@ If you use an old JDK release of your chosen Java version, you may encounter iss ## There are several ways to run the analysis on your codebase: ### From The Command Line As an HTML Report -Run the following command from the root of your project (the source code does not need to be built): +Run the following command from the root of your project (the source code does not need to be built), or simply by clicking on the Play icon (a green triangle) in the gutter of IntelliJ IDEA (if you are looking at the source of the README): ```bash mvn org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.7.1:htmlReport ``` -View the report at ```target/site/refactor-first-report.html``` + +View the report [here](target/site/refactor-first-report.html) ### [As Part of GitHub Actions Output](https://github.blog/news-insights/product-news/supercharging-github-actions-with-job-summaries/) This will generate a simplified HTML report (no graphs or images) as the output of a GitHub Action step @@ -53,7 +54,7 @@ Add the following to your project in the build section. **showDetails** will sh org.hjug.refactorfirst.plugin refactor-first-maven-plugin - 0.7.1 + 0.7.1 false @@ -74,14 +75,14 @@ A RefactorFirst report will show up in the site report when you run ```mvn site` org.hjug.refactorfirst.plugin refactor-first-maven-plugin - 0.7.1 + 0.7.1 ... ``` -## Configuraiton Options +## Configuration Options Care has been taken to use sensible defaults, though if you wish to override these defaults you can specify the following parameters. Specify with -D if running on the command line. e.g. ```-DbackEdgeAnalysisCount=0 `DanalyzeCycles=false``` or in the configuration section (as in the above examples) if including in a Maven build. @@ -100,6 +101,7 @@ Specify with -D if running on the command line. e.g. ```-DbackEdgeAnalysisCount ### Seeing Errors? +#### Maven Site 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 @@ -107,33 +109,36 @@ If you see an error similar to you will need to add the following to your pom.xml: ```xml - - - org.apache.maven.plugins - maven-site-plugin - 3.12.1 - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 3.4.5 - + + + org.apache.maven.plugins + maven-site-plugin + 3.12.1 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.4.5 + - + ``` +#### Lombok + +You _may_ see errors during the build process if you haven't installed (and enabled) the Lombok plugin. Make sure to also enable Java Annotation Processing. ## 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: ```xml - 4.0.0 - - com.mycompany.app - my-app - 1.0-SNAPSHOT + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + com.mycompany.app + my-app + 1.0-SNAPSHOT ``` and then (assuming Maven is installed) run @@ -155,7 +160,7 @@ If you have IntelliJ Ultimate, you can install the [Method Reference Diagram](ht ## Additional Details This plugin will work on both single module and multi-module Maven projects that have a typical Maven project layout. -This tool is based on the paper **[Prioritizing Design Debt Investment Opportunities](https://dl.acm.org/doi/10.1145/1985362.1985372)** by Nico Zazworka, Carolyn Seaman, and Forrest Shull. The presentation based on the paper is available at https://resources.sei.cmu.edu/asset_files/Presentation/2011_017_001_516911.pdf +This tool is based on the paper **[Prioritizing Design Debt Investment Opportunities](https://dl.acm.org/doi/10.1145/1985362.1985372)** by Nico Zazworka, Carolyn Seaman, and Forrest Shull. The presentation based on the paper is available [here](07-Investigating the Impact of Design Debt on Software Quality.pdf). ## Limitations * My time. This is a passion project and is developed in my spare time. diff --git a/change-proneness-ranker/src/main/java/org/hjug/git/GitLogReader.java b/change-proneness-ranker/src/main/java/org/hjug/git/GitLogReader.java index 0add55ae..edcb4817 100644 --- a/change-proneness-ranker/src/main/java/org/hjug/git/GitLogReader.java +++ b/change-proneness-ranker/src/main/java/org/hjug/git/GitLogReader.java @@ -48,61 +48,11 @@ public void close() throws Exception { git.close(); } - // Based on - // https://github.com/Cosium/git-code-format-maven-plugin/blob/master/src/main/java/com/cosium/code/format/AbstractMavenGitCodeFormatMojo.java - // MIT License - // Move to a provider? - public Repository gitRepository(File basedir) throws IOException { - Repository gitRepository; - FileRepositoryBuilder repositoryBuilder = new FileRepositoryBuilder().findGitDir(basedir); - String gitIndexFileEnvVariable = System.getenv("GIT_INDEX_FILE"); - if (Objects.nonNull(gitIndexFileEnvVariable) - && !gitIndexFileEnvVariable.trim().isEmpty()) { - log.debug("Setting Index File based on Env Variable GIT_INDEX_FILE {}", gitIndexFileEnvVariable); - repositoryBuilder = repositoryBuilder.setIndexFile(new File(gitIndexFileEnvVariable)); - } - gitRepository = repositoryBuilder.build(); - - return gitRepository; - } - public File getGitDir(File basedir) { FileRepositoryBuilder repositoryBuilder = new FileRepositoryBuilder().findGitDir(basedir); return repositoryBuilder.getGitDir(); } - // https://stackoverflow.com/a/19950970/346247 - // and - // https://github.com/centic9/jgit-cookbook/blob/master/src/main/java/org/dstadler/jgit/api/ReadFileFromCommit.java - public Map listRepositoryContentsAtHEAD(Repository repository) throws IOException { - Ref head = repository.exactRef("HEAD"); - // a RevWalk allows us to walk over commits based on some filtering that is defined - RevWalk walk = new RevWalk(repository); - RevCommit commit = walk.parseCommit(head.getObjectId()); - RevTree tree = commit.getTree(); - - TreeWalk treeWalk = new TreeWalk(repository); - treeWalk.addTree(tree); - treeWalk.setRecursive(false); - - // TODO: extract rest of this method to test it - Map fileContentsCollection = new HashMap<>(); - while (treeWalk.next()) { - if (treeWalk.isSubtree()) { - treeWalk.enterSubtree(); - } else { - if (treeWalk.getPathString().endsWith(JAVA_FILE_TYPE)) { - ObjectId objectId = treeWalk.getObjectId(0); - ObjectLoader loader = repository.open(objectId); - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - loader.copyTo(outputStream); - fileContentsCollection.put(treeWalk.getPathString(), outputStream); - } - } - } - return fileContentsCollection; - } - // log --follow implementation may be worth adopting in the future // https://github.com/spearce/jgit/blob/master/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java