-
Notifications
You must be signed in to change notification settings - Fork 0
Home
- Alex Westerman
- Nick Bohner
- Alec Polster
- Saayeh Siahmakoun
In order to use DesignLint, the system must meet the following requirements:
- Java Runtime 8 or Later (Any Flavor)
- At Least 1 GB RAM
- Access to a terminal
In addition to the user requirements, the following is needed for developing DesignLint:
- Apache Maven
- Java Development Kit (JDK) 8 or Later (Any Flavor)
DesignLint is distributed as an executable JAR that is invoked with arguments. At minimum, it requires a path argument to a Java compiled class (.class
) or to a directory containing the set of .class
files. The latter type of path will automatically recurse into subdirectories of the specified path to find all .class
files, and will throw an error if it finds a Symbolic Link. The following are example of basic invocations of DesignLint:
(NOTE - the $
indicates that this should be inputted in a terminal)
$ java -jar <Path to DesignLint JAR> ./ExampleClass.class
$ java -jar <Path to DesignLint JAR> /home/user/ExampleDir
DesignLint offers multiple options to expand output or to only use specific analyzers. These options are detailed below, or are outputted by the program if given the -h
argument or given bad arguments. We also provide a copy of this output below:
Usage Syntax:
$ java -jar <Path to DesignLint JAR> [-v[v[v]]] [-h] [[-a{XX|YY|...}] [-a...] ...] <.class file | directory>
Switches:
Switch | Description |
---|---|
-v |
Includes summary output of analyzer-specific findings. |
-vv |
Display all errors found by the analyzers. Includes output of -v
|
-vvv |
Display all output generated by analyzers (Errors, Warnings, Info, and Pattern Detection). Includes output of -v and -vv
|
-h |
Show the help output |
-aXX |
Only run the analyzer specified by the code XX. This switch is used once for each analyzer desired, but excluding this switch will run all available analyzers. |
Analyzer Codes (Used with -a
):
Code | Associated Analyzer | Description |
---|---|---|
GN |
Generic Name Analyzer | Checks for bad generic class names |
VN |
Variable Name Analyzer | Checks for bad variable names |
ET |
Exception Thrown Analyzer | Checks for bad exception handling practices |
EH |
equals() and hashcode() Analyzer |
Throws warnings if a class doesn't override the equals() or hashcode() methods |
HC |
High Coupling Analyzer | Checks for classes with high coupling |
LK |
Principle of Least Knowledge Analyzer | Checks for proper encapsulation |
DR |
Don't Repeat Yourself (DRY) Analyzer | Checks for possible areas of repetition |
CI |
Code to Interface Analyzer | Checks if object types use interfaces if they exist |
SI |
Singleton Pattern Detector | Detects if a class implements the Singleton Pattern |
OA |
Object Adapter Pattern Detector | Detects what classes represent an Object Adapter pattern |
ST |
Strategy Pattern Detector | Detects what classes/interfaces implement a Strategy pattern |
TM |
Template Method Pattern Detector | Detects what classes implement a Template Method Pattern |
This will serve as a brief primer for building, unit testing, and mutation testing the code. For more details about specific parts of DesignLint, see the developer documentation.
The source for DesignLint is available from the Git repository at https://github.com/rhit-westeraj/DesignLint. To make it available on your local machine for modification, simply clone the repository remote:
$ git clone https://github.com/rhit-westeraj/DesignLint
DesignLint uses Apache Maven for dependency management and build pipelines. This means that compiling the program is as simple as running <maven executable> compile
in the directory of the cloned repository. For a packaged build (i.e. a JAR Executable), this can be done with the package
lifecycle, which will also run the compile
step in the lifecycle, as well as testing. Compiled output can be found within the target
subdirectory within the cloned repository once run.
It should be noted that most modern Java IDEs also have built-in support for processing Maven projects, therefore it may be worth looking at the IDE documentation to understand how it interacts with Maven.
Because DesignLint uses Maven for the build lifecycle, it allows for automated running of test prior to packaging or deployment operations. Testing uses JUnit 5 as the unit testing library, with Maven Surefire being used as the integration in Maven for automated unit testing within the build lifecycle. Running test is as simple as running <maven executable> test
within the cloned repository directory.
We also have added the PITesting plugin to the Maven dependency list to allow for analysis of mutation coverage of tests, improving test robustness. To invoke analysis of the PITesting plugin, it is also as simple as running <maven executable> pitest:mutationCoverage
in the cloned repository directory. The results of the PITesting Analysis can be found within the target/pit-reports
subdirectory within the cloned repository once run.
Because this program uses OW2 ASM for bytecode-level analysis, we include the following 3-Clause BSD license declaration for ASM:
ASM: a very small and fast Java bytecode manipulation framework Copyright (c) 2000-2011 INRIA, France Telecom All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.