init
This commit is contained in:
19
linter/BlankPrintlnCheck.java
Normal file
19
linter/BlankPrintlnCheck.java
Normal file
@@ -0,0 +1,19 @@
|
||||
// Nik Johnson
|
||||
// 2-24-2024
|
||||
// TA: Andy Ruan
|
||||
|
||||
import java.util.*;
|
||||
|
||||
// checks lines for the characters "System.out.println("")"
|
||||
public class BlankPrintlnCheck implements Check {
|
||||
|
||||
// if the line being checked has a blank println statement, return a new error (code 3)
|
||||
// takes line and line number
|
||||
// returns error inside optional
|
||||
public Optional<Error> lint(String line, int lineNumber) {
|
||||
if (line.contains("System.out.println(\"\")")) {
|
||||
return Optional.of(new Error(3, lineNumber, "Line contains blank print statement"));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user