This repository has been archived on 2026-03-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
CSE-122/linter/LongLineCheck.java
2026-03-18 00:39:22 -07:00

22 lines
575 B
Java

// Nik Johnson
// 2-24-2024
// TA: Andy Ruan
import java.util.*;
// long line checker
public class LongLineCheck implements Check {
// if the line being checked is 100 characters or longer, return a new error (code 1)
// takes line and line number
// returns error inside optional
public Optional<Error> lint(String line, int lineNumber) {
if (line.length() >= 100) {
return Optional.of(new Error(1, lineNumber,
"Line length exceeded maximum length of 100 characters"));
}
return Optional.empty();
}
}