Code quality and static analysis
16 questions in 5 subtopics.
SonarQube
What is a SonarQube quality gate, and why do many teams apply it only to new code?Developers complain that SonarQube blocks merges with low-value findings and they now mark many issues as 'won't fix'. How would you make the tool useful again?Should your organisation enforce a single SonarQube quality profile across all teams? Argue both sides and give your decision rule.Your company has run SonarQube for eight years and the quality gate is now seen as bureaucracy. How do you decide whether to keep, change or replace your static analysis setup?SpotBugs, PMD, Checkstyle
What is the difference between SpotBugs, PMD and Checkstyle? Which would catch a possibleNullPointerException, an unused private field, and wrong indentation?You join a team with a 10-year-old codebase producing 40,000 static analysis warnings. How do you introduce SpotBugs and PMD without stopping delivery?A CTO asks whether static analysis tooling is worth its cost across the company. How would you evaluate and answer?Error Prone
What is Error Prone and how does it differ from tools like SpotBugs?You want to add Error Prone to a large Maven or Gradle build. What setup and rollout issues should you expect?Null safety annotations
What are JSpecify annotations and why did Spring Framework 7 adopt them?Given a package annotated@NullMarked, which of these lines would a nullness checker such as NullAway flag, and why?String name(User u) {
return u.nickname().trim();
}
nickname() is declared as '@Nullable String nickname()'.Should your organisation adopt null-safety checking (JSpecify plus NullAway or similar) across all Java services? How would you roll it out?ArchUnit
Write an ArchUnit rule that fails if any class in the ..web.. package accesses a class in the ..repository.. package directly.A team wants to enforce module boundaries inside a Spring Boot monolith. Compare ArchUnit, Java modules (JPMS) and Spring Modulith for this goal.You want the same architecture rules (no web-to-repository access, no cycles between modules, no use of deprecated internal APIs) in 80 services. How would you package and roll out ArchUnit rules across teams?Over a long-lived codebase, architecture tends to erode. What role should automated architecture tests play compared with design reviews and team structure?No question matches these choices.