Skip to content

Commit 4be140b

Browse files
author
Bhikadiya
committed
Add the Plugin Code
0 parents  commit 4be140b

File tree

79 files changed

+3921
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3921
-0
lines changed

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Compiled class file
2+
*.class
3+
4+
# Log file
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.war
15+
*.nar
16+
*.ear
17+
*.zip
18+
*.tar.gz
19+
*.rar
20+
21+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22+
hs_err_pid*
23+
/target/
24+
.gradle
25+
/build
26+
.idea
27+
/gradle
28+
gradlew
29+
gradlew.bat
30+
**/.DS_Store

.gitlab-ci.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This file is a template, and might need editing before it works on your project.
2+
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
3+
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
4+
# it uses echo commands to simulate the pipeline execution.
5+
#
6+
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
7+
# Stages run in sequential order, but jobs within stages run in parallel.
8+
#
9+
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
10+
#
11+
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
12+
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
13+
#
14+
# To contribute improvements to CI/CD templates, please follow the Development guide at:
15+
# https://docs.gitlab.com/ee/development/cicd/templates.html
16+
# This specific template is located at:
17+
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
18+
image: gradle:7.5.1-jdk11
19+
20+
stages: # List of stages for jobs, and their order of execution
21+
- build
22+
- test
23+
- code-quality
24+
25+
build-job: # This job runs in the build stage, which runs first.
26+
stage: build
27+
script:
28+
- gradle build
29+
30+
unit-test-job: # This job runs in the test stage.
31+
stage: test # It only starts when the job in the build stage completes successfully.
32+
script:
33+
- gradle test
34+
35+
include:
36+
- template: Code-Quality.gitlab-ci.yml
37+
38+
code_quality:
39+
stage: code-quality
40+
image: openjdk:17
41+
script:
42+
- java -jar $CI_PROJECT_DIR/src/main/resources/DesigniteJava/DesigniteJava.jar -i $CI_PROJECT_DIR/ -o $CI_PROJECT_DIR/CodeQualityReport/
43+
tags:
44+
- ugrad
45+
artifacts:
46+
paths:
47+
- CodeQualityReport/

README.md

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
[![Build Status](https://travis-ci.com/tushartushar/dj_Intellij.svg?token=qqYCSPgxVmWCxpyzFpz5&branch=master)](https://travis-ci.com/tushartushar/dj_Intellij)
2+
3+
# IntelliJ plugin of DesigniteJava
4+
The plugin analyzes your Java projects and detects implementation, design, architecture, test and testability code smells.
5+
It also computes common code quality metrics to measure complexity, cohesion, and coupling.
6+
The plugin tags methods and classes within IntelliJ suffering from smells to motivate you to refactor the method or class.
7+
Also, the plugin shows a tool window that lists code quality information (i.e., smells and metrics) of the active file to keep an eye on the code quality.
8+
It also shows in-line code smells with the help of a marker. There is a UI tool window that reports the total number of smells in
9+
the project with statistical data.
10+
The plugin uses DesigniteJava to analyze Java source code.
11+
12+
Note: As we started on an existing project, we followed the existing coding practices and tried to extend the original project as much as possible.
13+
14+
#### Build Instructions
15+
###### Prerequisites
16+
1. Gradle 7.5.1
17+
2. Java 17
18+
3. Change gradle configuration:
19+
1. Open gradle folder in the project directory
20+
2. Open wrapper folder
21+
3. Open gradle-wrapper.properties
22+
4. Update "distributionUrl" to distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
23+
24+
###### Dependencies
25+
1. 'org.mockito:mockito-inline:3.12.4'
26+
27+
Library added to provide the mocking framework
28+
2. 'org.mockito:mockito-junit-jupiter:3.12.4'
29+
30+
Library added to provide the ide mocking framework
31+
3. 'org.knowm.xchart:xchart:3.8.1'
32+
33+
Library added to create graphs on UI
34+
35+
###### Build
36+
- Run command “./gradlew shadowJar”
37+
38+
###### Install plugin
39+
1. Open IntelliJ
40+
2. Open IntelliJ settings
41+
3. Go to plugins
42+
4. Click on the settings icon and select install plugin from the disk
43+
5. Go to the project directory --> build --> libs --> select the .jar file
44+
45+
###### How to Run Plugin
46+
1. Go to Tools --> DesigniteJava > Analyze Code
47+
2. Wait for the processing to complete
48+
3. Restart IntelliJ
49+
4. On the bottom right side, you will find the DesigniteJava button click on that to see the code smells
50+
5. To see the UI, go to Tools --> DesigniteJava --> Analysis Report
51+
52+
###### Milestones
53+
1. Detect test smells - DONE
54+
2. Detect Architecture smells - DONE
55+
3. Show the progress bar on the Taskbar - DONE
56+
4. Navigating to the code lines on click of links in the DesigniteJava Tool window - DONE
57+
5. UI to show project-level information using charts and tables – DONE
58+
59+
###### Milestones added after the mid-term review
60+
1. Add testability smells - DONE
61+
62+
63+
## Features
64+
65+
### 1. Project Level User-Interface:
66+
The statistical format taken in UI depicts the smell distribution over the entire project
67+
as well as the project level metrics.
68+
69+
![Project level UI](src/main/resources/Images/projectLevelSmells.png "Project Level UI")
70+
71+
### 2. Specific Snell User-Interface:
72+
The statistical format taken in UI depicts the smell distribution over the entire project of a
73+
particular smell level i.e. design, implementation etc. It shows the various smell types that
74+
occur in the project.
75+
76+
![Specific smell UI](src/main/resources/Images/ImplementationSmellsUI.png "Specific smell UI")
77+
78+
### 3. Test smells:
79+
The test smells specific to a class can be seen in the tool window and the line marker with clickable links.
80+
81+
![Test Smells](src/main/resources/Images/TestSmells.png "Test Smells")
82+
83+
### 4. Architecture smells:
84+
The architecture smells specific to that package can be seen in the tool window and the line marker with clickable links.
85+
86+
![Architecture Smells](src/main/resources/Images/ArchitectureSmells.png "Architecture Smells")
87+
88+
### 5. Testability smells:
89+
The testability smells specific to a class can be seen in the tool window and the line marker with clickable links.
90+
91+
![Testability Smells](src/main/resources/Images/TestabilitySmells.png "Testability Smells")
92+
93+
### 6. Progress Bar:
94+
The video demonstrates the implementation of a progress bar in the project.
95+
96+
[Click here to see demonstration of the Progress Bar](https://youtu.be/XpiTzPRpIfA)
97+
98+
### 7. Method Links:
99+
The video demonstrates the functioning of method links added for test and implementation smells in Designite Tool window in the project.
100+
101+
[Click here to see demonstration](https://youtu.be/MQ3TxMR_MQ0)
102+
103+
### 8. Class Link:
104+
The video demonstrates the functioning of Class links added for design and testability smells in the project.
105+
106+
[Click here to see demonstration](https://youtu.be/_Lbp1ES6VFE)
107+
108+
### 9. Package Link :
109+
The video demonstrates the functioning of Package links added in Architecture smells in the project.
110+
111+
[Click here to see demonstration](https://youtu.be/xtCmkN4FShg)
112+
113+
## Smells
114+
Existing coding practice have been followed during the addition of new features in the project.
115+
This is why there are multiple smells.
116+
117+
Also, the creation of a user-interface required us to add a number of characteristics like
118+
height, width, border etc to the elements. That has resulted in a large number of magic number code
119+
smells.
120+
121+
The link to smells list and their justifications is added
122+
[here](src/main/resources/Reports/CodeSmellSummary.xlsx)
123+
124+
## Contribution Statement and rating
125+
The link to contribution statement for the group [here](src/main/resources/Reports/group2.docx)
126+
127+
### Link to Jira Board [Group: 2 Designite](https://group25308.atlassian.net/jira/software/projects/IIP/boards/1)
128+
129+
130+
### Test coverage
131+
- We were not able to achieve good test coverage as most of our project deals with file system and UI elements.

build.gradle

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
plugins {
2+
id 'java'
3+
id 'org.jetbrains.intellij' version '0.7.3'
4+
id 'com.github.johnrengelman.shadow' version '7.0.0'
5+
}
6+
7+
group = 'org.designite.intellij.plugin'
8+
version = '1.8.1'
9+
description = """
10+
The plugin analyzes your Java projects and identifies code smells at implementation, design, and architecture granularity. It also computes common code quality metrics to measure complexity, cohesion, and coupling.
11+
12+
The plugin tags methods and classes within IntelliJ suffering from smells to motivate you to refactor the method or class. Also, the plugin shows a tool window that lists code quality information (i.e., smells and metrics) of the active file to keep an eye on the code quality.
13+
"""
14+
15+
sourceCompatibility = 1.9
16+
targetCompatibility = 1.9
17+
18+
repositories {
19+
mavenCentral()
20+
}
21+
22+
dependencies {
23+
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
24+
testImplementation 'org.mockito:mockito-inline:3.12.4'
25+
testImplementation 'org.mockito:mockito-junit-jupiter:3.12.4'
26+
implementation 'org.knowm.xchart:xchart:3.6.3'
27+
}
28+
29+
jar {
30+
from configurations.implementation
31+
}
32+
33+
configurations {
34+
implementation {
35+
canBeResolved = true
36+
}
37+
}
38+
39+
shadowJar {
40+
configurations = [project.configurations.runtimeClasspath]
41+
includeEmptyDirs = false
42+
mergeServiceFiles()
43+
relocate('org.knowm.xchart', 'lib.xchart')
44+
}
45+
46+
// See https://github.com/JetBrains/gradle-intellij-plugin/
47+
intellij {
48+
version '2019.1.3'
49+
updateSinceUntilBuild false
50+
// plugins 'java'
51+
}
52+
patchPluginXml {
53+
// sinceBuild '191'
54+
// untilBuild '192'
55+
changeNotes """
56+
- Usability improvements
57+
- Bug fixes (including the issue with the plugin not showing code quality information and markers when multiple instances of IntelliJ are open)
58+
"""
59+
}
60+
wrapper{
61+
gradleVersion = '2.0'
62+
}

designiteUI/.classpath

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="src" path="src"/>
5+
<classpathentry kind="lib" path="miglayout15-swing.jar" sourcepath="miglayout-src.zip"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>

designiteUI/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

designiteUI/.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>designiteUI</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.8

0 commit comments

Comments
 (0)