-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
85 changed files
with
971 additions
and
365 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED | ||
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED | ||
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED | ||
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED | ||
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED | ||
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED | ||
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED | ||
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED | ||
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED | ||
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE module PUBLIC | ||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" | ||
"https://checkstyle.org/dtds/configuration_1_3.dtd"> | ||
|
||
<module name="Checker"> | ||
<module name="BeforeExecutionExclusionFileFilter"> | ||
<property name="fileNamePattern" value="^(?!.*(nl.tudelft.cse1110.andy))" /> | ||
</module> | ||
|
||
<module name="SuppressWarningsFilter" /> | ||
|
||
<module name="TreeWalker"> | ||
<module name="SuppressWarningsHolder" /> | ||
|
||
<module name="MethodLength"> | ||
<property name="severity" value="error"/> | ||
<property name="tokens" value="METHOD_DEF, CTOR_DEF, COMPACT_CTOR_DEF"/> | ||
<property name="max" value="50"/> | ||
</module> | ||
|
||
<module name="CyclomaticComplexity"> | ||
<property name="max" value="10"/> | ||
<property name="tokens" value="LITERAL_WHILE, LITERAL_DO"/> | ||
</module> | ||
|
||
<module name="NestedIfDepthCheck" > | ||
<property name="max" value="2"/> | ||
</module> | ||
|
||
<module name="UnnecessarySemicolonInEnumeration"/> | ||
<module name="UnnecessarySemicolonInTryWithResources"/> | ||
<module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/> | ||
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/> | ||
|
||
<module name="DeclarationOrderCheck" /> | ||
<module name="EmptyStatementCheck" /> | ||
<module name="EqualsHashCodeCheck" /> | ||
<module name="MissingSwitchDefaultCheck" /> | ||
<module name="UnusedLocalVariableCheck" /> | ||
<module name="EmptyBlockCheck" /> | ||
<module name="EmptyCatchBlockCheck" /> | ||
<module name="StringLiteralEqualityCheck" /> | ||
|
||
|
||
</module> | ||
|
||
</module> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
andy/src/main/java/nl/tudelft/cse1110/andy/codechecker/checks/ClassUsedInSolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package nl.tudelft.cse1110.andy.codechecker.checks; | ||
|
||
import org.eclipse.jdt.core.dom.*; | ||
|
||
/** | ||
* Checks whether a class is used - instantiated or one of its methods called. | ||
* Parameter: | ||
* - the name of the method | ||
* Output: | ||
* - true if the class was used. | ||
* | ||
*/ | ||
public class ClassUsedInSolution extends WithinTestMethod { | ||
|
||
private final String classToBeUsed; | ||
private boolean classWasUsed = false; | ||
|
||
public ClassUsedInSolution(String classToBeUsed) { | ||
this.classToBeUsed = classToBeUsed; | ||
} | ||
|
||
/** | ||
* Checks for class instance creations to | ||
* check if the instantiated class if one of the classes | ||
* we are looking for | ||
*/ | ||
@Override | ||
public boolean visit(ClassInstanceCreation cic) { | ||
String className = cic.getType().toString(); | ||
if (classToBeUsed.equals(className)) | ||
classWasUsed = true; | ||
|
||
return super.visit(cic); | ||
} | ||
|
||
/** | ||
* Checks for method invocation to check if a static | ||
* method of the said class is called. Uses Expression | ||
*/ | ||
@Override | ||
public boolean visit(MethodInvocation mi) { | ||
Expression expression = mi.getExpression(); | ||
if (expression != null) { | ||
if (expression.toString().equals(classToBeUsed)) | ||
classWasUsed = true; | ||
|
||
|
||
} | ||
|
||
return super.visit(mi); | ||
} | ||
|
||
|
||
@Override | ||
public boolean result() { | ||
return classWasUsed; | ||
} | ||
|
||
public String toString() { | ||
return classToBeUsed + " class is used"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.