Skip to content

Commit

Permalink
Show warnings for items not in IO
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonwatson committed Aug 31, 2023
1 parent dbea544 commit 59565a3
Show file tree
Hide file tree
Showing 14 changed files with 437 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ $RECYCLE.BIN/
### Gradle ###
.gradle
/build/
/checker/build/

# Ignore Gradle GUI config
gradle-app.setting
Expand Down
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'

annotationProcessor project(":checker")
}

test {
Expand Down Expand Up @@ -96,6 +98,11 @@ wpi.java.configureTestTasks(test)
// Configure string concat to always inline compile
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
// only run in GH actions
if (System.getenv("GITHUB_ACTOR") != null && !System.getenv("GITHUB_ACTOR").equals("")) {
options.compilerArgs << "-Xplugin:rchk"
outputs.upToDateWhen { false } // Force recompile, even if source file hasn't changed
}
}

javadoc {
Expand Down
27 changes: 27 additions & 0 deletions checker/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

plugins {
id 'java-library'
}
tasks.withType(JavaCompile) {
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED'
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED'
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED'
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED'
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED'
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED'
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED'
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED'
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
options.compilerArgs << '--add-exports' << 'jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED'
}

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

repositories {
mavenCentral()
}

dependencies {

}
18 changes: 18 additions & 0 deletions checker/src/main/java/org/frc5572/robotools/Checks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.frc5572.robotools;

import org.frc5572.robotools.checks.*;

Check warning on line 3 in checker/src/main/java/org/frc5572/robotools/Checks.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/Checks.java#L3 <com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck>

Using the '.*' form of import should be avoided - org.frc5572.robotools.checks.*.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/Checks.java:3:36: warning: Using the '.*' form of import should be avoided - org.frc5572.robotools.checks.*. (com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck)

public class Checks {

Check warning on line 5 in checker/src/main/java/org/frc5572/robotools/Checks.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/Checks.java#L5 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/Checks.java:5:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)

private static final Check[] CHECKS = new Check[] {
new ExampleCheck(),
new IOCheck(),
};

public static void process(CompilationData data) {

Check warning on line 12 in checker/src/main/java/org/frc5572/robotools/Checks.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/Checks.java#L12 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/Checks.java:12:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
for(Check c : CHECKS) {

Check warning on line 13 in checker/src/main/java/org/frc5572/robotools/Checks.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/Checks.java#L13 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'for' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/Checks.java:13:9: warning: 'for' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 13 in checker/src/main/java/org/frc5572/robotools/Checks.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/Checks.java#L13 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'for' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/Checks.java:13:9: warning: WhitespaceAround: 'for' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
c.check(data);
}
}

}
120 changes: 120 additions & 0 deletions checker/src/main/java/org/frc5572/robotools/CompilationData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package org.frc5572.robotools;

import javax.annotation.processing.Messager;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;

import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.LineMap;
import com.sun.source.tree.Tree;
import com.sun.source.util.JavacTask;
import com.sun.source.util.SourcePositions;
import com.sun.source.util.TaskEvent;
import com.sun.source.util.Trees;

public class CompilationData {

Check warning on line 18 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L18 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:18:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)

public Types types;
private Trees trees;
private SourcePositions positions;
private CompilationUnitTree compilationUnitTree;
public TypeElement element;
private Messager messager;

public CompilationData(Types types, Trees trees, SourcePositions positions, CompilationUnitTree compilationUnitTree,

Check warning on line 27 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L27 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 120).
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:27:0: warning: Line is longer than 100 characters (found 120). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)

Check warning on line 27 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L27 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:27:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
TypeElement element, Messager messager) {
this.types = types;
this.trees = trees;
this.positions = positions;
this.compilationUnitTree = compilationUnitTree;
this.element = element;
this.messager = messager;
}

public CompilationData(JavacTask task, TaskEvent event) {
this(task.getTypes(), Trees.instance(task), Trees.instance(task).getSourcePositions(), event.getCompilationUnit(), event.getTypeElement(), null);

Check warning on line 38 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L38 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 153).
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:38:0: warning: Line is longer than 100 characters (found 153). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
}

public CompilationData(ProcessingEnvironment processingEnv, TypeElement element) {
this(processingEnv.getTypeUtils(), null, null, null, element, processingEnv.getMessager());
}

public void error(Element element, Object object) {
echo(element, object.toString(), Diagnostic.Kind.ERROR, "error", "Error");
}

public void warn(Element element, Object object) {
echo(element, object.toString(), Diagnostic.Kind.MANDATORY_WARNING, "warning", "Warning");
}

public void note(Element element, Object object) {
echo(element, object.toString(), Diagnostic.Kind.NOTE, "notice", "Note");
}

private void echo(Element element, String errString, Diagnostic.Kind kind, String ghString, String humanString) {

Check warning on line 57 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L57 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 117).
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:57:0: warning: Line is longer than 100 characters (found 117). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
if (compilationUnitTree == null) {
messager.printMessage(kind, errString, element);
} else {
Tree tree = trees.getTree(element);
LineMap linemap = compilationUnitTree.getLineMap();
long pos = positions.getStartPosition(compilationUnitTree, tree);
long row = linemap.getLineNumber(pos);
String name = compilationUnitTree.getSourceFile().toUri().toString().split("/src/")[1];
System.out.println("::" + ghString + " file=src/" + name + ",line=" + row + "::" + errString);

Check warning on line 66 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L66 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 106).
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:66:0: warning: Line is longer than 100 characters (found 106). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
}
}

private boolean _implements(String qualifiedName, TypeElement elem) {
if(elem.getQualifiedName().toString().equals(qualifiedName)) {

Check warning on line 71 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L71 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:71:9: warning: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 71 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L71 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:71:9: warning: WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
return true;
}
Element superClass = types.asElement(elem.getSuperclass());
if(superClass instanceof TypeElement) {

Check warning on line 75 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L75 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:75:9: warning: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 75 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L75 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:75:9: warning: WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
if(_implements(qualifiedName, (TypeElement) superClass)) {

Check warning on line 76 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L76 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:76:13: warning: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 76 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L76 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:76:13: warning: WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
return true;
}
}
for(var iface : elem.getInterfaces()) {

Check warning on line 80 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L80 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'for' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:80:9: warning: 'for' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 80 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L80 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'for' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:80:9: warning: WhitespaceAround: 'for' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
Element interface_ = types.asElement(iface);
if(interface_ instanceof TypeElement) {

Check warning on line 82 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L82 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:82:13: warning: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 82 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L82 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:82:13: warning: WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
if(_implements(qualifiedName, (TypeElement) interface_)) {

Check warning on line 83 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L83 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:83:17: warning: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 83 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L83 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:83:17: warning: WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
return true;
}
}
}
return false;
}

private boolean _extends(String qualifiedName, TypeElement elem) {
if(elem.getQualifiedName().toString().equals(qualifiedName)) {

Check warning on line 92 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L92 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:92:9: warning: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 92 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L92 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:92:9: warning: WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
return true;
}
Element superClass = types.asElement(elem.getSuperclass());
if(superClass instanceof TypeElement) {

Check warning on line 96 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L96 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:96:9: warning: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 96 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L96 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:96:9: warning: WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
if(_extends(qualifiedName, (TypeElement) superClass)) {

Check warning on line 97 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L97 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:97:13: warning: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 97 in checker/src/main/java/org/frc5572/robotools/CompilationData.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/CompilationData.java#L97 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/CompilationData.java:97:13: warning: WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
return true;
}
}
return false;
}

public boolean implementsInterface(String qualifiedName) {
return _implements(qualifiedName, this.element);
}

public boolean implementsInterface(TypeElement e, String qualifiedName) {
return _implements(qualifiedName, e);
}

public boolean extendsClass(String qualifiedName) {
return _extends(qualifiedName, this.element);
}

public boolean extendsClass(TypeElement e, String qualifiedName) {
return _extends(qualifiedName, e);
}

}
13 changes: 13 additions & 0 deletions checker/src/main/java/org/frc5572/robotools/GetIdentifier.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.frc5572.robotools;

import com.sun.source.util.TreeScanner;
import com.sun.source.tree.IdentifierTree;

public class GetIdentifier extends TreeScanner<String, Void> {

Check warning on line 6 in checker/src/main/java/org/frc5572/robotools/GetIdentifier.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/GetIdentifier.java#L6 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/GetIdentifier.java:6:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)

@Override
public String visitIdentifier(IdentifierTree node, Void p) {
return node.getName().toString();
}

}
35 changes: 35 additions & 0 deletions checker/src/main/java/org/frc5572/robotools/RobotPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.frc5572.robotools;

import javax.lang.model.util.Types;

import com.sun.source.util.JavacTask;
import com.sun.source.util.Plugin;
import com.sun.source.util.SourcePositions;
import com.sun.source.util.TaskEvent;
import com.sun.source.util.TaskListener;
import com.sun.source.util.Trees;

public class RobotPlugin implements Plugin {

Check warning on line 12 in checker/src/main/java/org/frc5572/robotools/RobotPlugin.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/RobotPlugin.java#L12 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/RobotPlugin.java:12:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)

@Override
public String getName() {
return "rchk";
}

@Override
public void init(JavacTask task, String... arg1) {
Types types = task.getTypes();
Trees trees = Trees.instance(task);
SourcePositions positions = trees.getSourcePositions();
task.addTaskListener(new TaskListener() {
@Override
public void finished(TaskEvent e) {
if (e.getKind() == TaskEvent.Kind.ANALYZE) {
CompilationData data = new CompilationData(types, trees, positions, e.getCompilationUnit(), e.getTypeElement(), null);

Check warning on line 28 in checker/src/main/java/org/frc5572/robotools/RobotPlugin.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/RobotPlugin.java#L28 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 138).
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/RobotPlugin.java:28:0: warning: Line is longer than 100 characters (found 138). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
Checks.process(data);
}
}
});
}

}
68 changes: 68 additions & 0 deletions checker/src/main/java/org/frc5572/robotools/RobotProcessor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package org.frc5572.robotools;

import java.util.Set;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedOptions;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;

@SupportedAnnotationTypes("*")

Check warning on line 17 in checker/src/main/java/org/frc5572/robotools/RobotProcessor.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/RobotProcessor.java#L17 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/RobotProcessor.java:17:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
@SupportedSourceVersion(SourceVersion.RELEASE_11)
@SupportedOptions("frc_check.skip")
public class RobotProcessor extends AbstractProcessor {

private void processTypeElement(TypeElement typeElement) {
for (Element e3 : typeElement.getEnclosedElements()) {
if (e3 instanceof TypeElement) {
processTypeElement((TypeElement) e3);
}
}
CompilationData data = new CompilationData(processingEnv, typeElement);
Checks.process(data);
}

private boolean hasProcessed;

@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
System.out.println(processingEnv.getOptions().get("frc_check.skip"));
hasProcessed = false;
}

@Override
public boolean process(Set<? extends TypeElement> arg0, RoundEnvironment roundEnv) {
if(hasProcessed) {

Check warning on line 43 in checker/src/main/java/org/frc5572/robotools/RobotProcessor.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/RobotProcessor.java#L43 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck>

'if' is not followed by whitespace.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/RobotProcessor.java:43:9: warning: 'if' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

Check warning on line 43 in checker/src/main/java/org/frc5572/robotools/RobotProcessor.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/RobotProcessor.java#L43 <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck>

WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/RobotProcessor.java:43:9: warning: WhitespaceAround: 'if' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3) (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck)
return false;
}
hasProcessed = true;
for (ModuleElement m : processingEnv.getElementUtils().getAllModuleElements()) {
if (!m.isUnnamed()) {
continue;
}
for (Element e : m.getEnclosedElements()) {
if (e instanceof PackageElement) {
PackageElement pe = (PackageElement) e;
if (pe.getQualifiedName().toString().startsWith("frc.")) {
for (Element e2 : pe.getEnclosedElements()) {
if (e2 instanceof TypeElement) {
TypeElement te = (TypeElement) e2;

Check failure on line 57 in checker/src/main/java/org/frc5572/robotools/RobotProcessor.java

View workflow job for this annotation

GitHub Actions / Spell Check

te ==> the, be, we, to
processTypeElement(te);

Check failure on line 58 in checker/src/main/java/org/frc5572/robotools/RobotProcessor.java

View workflow job for this annotation

GitHub Actions / Spell Check

te ==> the, be, we, to
}
}
}
}
}
}
return true;
}

}
10 changes: 10 additions & 0 deletions checker/src/main/java/org/frc5572/robotools/checks/Check.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.frc5572.robotools.checks;

import org.frc5572.robotools.CompilationData;

@FunctionalInterface

Check warning on line 5 in checker/src/main/java/org/frc5572/robotools/checks/Check.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/checks/Check.java#L5 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/checks/Check.java:5:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
public interface Check {

public boolean check(CompilationData data);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.frc5572.robotools.checks;

import org.frc5572.robotools.CompilationData;

public class ExampleCheck implements Check {

Check warning on line 5 in checker/src/main/java/org/frc5572/robotools/checks/ExampleCheck.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] checker/src/main/java/org/frc5572/robotools/checks/ExampleCheck.java#L5 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./checker/src/main/java/org/frc5572/robotools/checks/ExampleCheck.java:5:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)

@Override
public boolean check(CompilationData data) {

return false;
}

}
Loading

0 comments on commit 59565a3

Please sign in to comment.