MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / singleAlert

Method singleAlert

src/test/java/org/htmlunit/CodeStyleTest.java:500–512  ·  view source on GitHub ↗

Single @Alert does not need curly brackets.

(final List<String> lines, final String relativePath)

Source from the content-addressed store, hash-verified

498 * Single @Alert does not need curly brackets.
499 */
500 private void singleAlert(final List<String> lines, final String relativePath) {
501 int i = 0;
502 for (final String line : lines) {
503 if (line.trim().startsWith("@Alerts") && line.contains("@Alerts({") && line.contains("})")) {
504 final String alert = line.substring(line.indexOf('{'), line.indexOf('}'));
505 if (!alert.contains(",") && alert.contains("\"")
506 && alert.indexOf('"', alert.indexOf('"') + 1) != -1) {
507 addFailure(relativePath, i + 1, "No need for curly brackets");
508 }
509 }
510 i++;
511 }
512 }
513
514 /**
515 * Verifies that only static loggers exist.

Callers 1

processMethod · 0.95

Calls 6

addFailureMethod · 0.95
trimMethod · 0.80
substringMethod · 0.80
containsMethod · 0.65
startsWithMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected