Skip to content

Overview

Features

What is Rulebook?


  • Library extension
    A set of additional rules for static code analysis tools

Features


  • Multiple languages
    Originally written for Kotlin, it now supports Java, Groovy and Python

  • Follows guidelines
    Works together with standard rules from linter tools and respects common coding convention

Compatibility table

Legend

The rule is fully implemented Functionality already exists in other rules The rule is already supported by the linter It is possible but currently not implemented It will not be supported due to technical limitations Not applicable to this language
Rule Java Groovy Kotlin Python
Block tag punctuation46
Built-in types35
Confusing predicate32
File size39
Null equality40
Redundant qualifier24
TODO comment26
Trailing comma in call41
Trailing comma in collection50
Trailing comma in declaration41
Unused import4
Wildcard import18
Declaring group
Abstract class definition1
Contract function definition34
Exception inheritance48
Number suffix for double21
Number suffix for float21
Number suffix for integer21
Number suffix for long21
String quotes14
Unnecessary parentheses in lambda47
Utility class definition5
Naming group
Class name acronym27
Class name43
Constant property name43
File name38
Identifier name43
Illegal class final name27
Illegal variable name6
Package name43
Property name interop37
Required generic name49
Ordering group
Block tag order8
Built-in function position2
Import order17
Inner class position29
Member order29
Overload function position36
Static import position17
Spacing group
Block comment spaces45
Block comment trim3
Block tag indentation15
Case separator30
Code block trim12
Comment spaces10
Comment trim3
Duplicate blank line20
Duplicate blank line in block comment3
Duplicate blank line in comment3
Member separator20
Missing blank line before block tags33
Unnecessary blank line before package19
Stating group
Illegal catch48
Illegal throw48
Missing braces9
Nested if-else22
Redundant default23
Redundant else23
Unnecessary switch25
Wrapping group
Assignment wrap16
Chain call wrap42
Elvis wrap7
Empty code block join13
Infix call wrap11
Lambda wrap16
Operator wrap11
Parameter wrap28
Short block comment join31
Statement wrap44

Download

Integrate the linter tools

Download the library

Maven PyPI


  1. Abstraction not needed 

  2. Business logic first 

  3. Clean comment 

  4. Imports not optimized 

  5. Instance not allowed 

  6. Purposeful name 

  7. Trailing elvis 

  8. Android: Block tags ↗ 

  9. Android: Braces ↗ 

  10. Android: Horizontal whitespace ↗ 

  11. Android: Where to break ↗ 

  12. Google: Nonempty blocks ↗ 

  13. Google: Empty blocks ↗ 

  14. Google: Use single quotes ↗ 

  15. Google: Block tags ↗ 

  16. Google: Where to break ↗ 

  17. Google: Ordering and spacing ↗ 

  18. Google: Import statements ↗ 

  19. Google: Source file structure ↗ 

  20. Google: Vertical whitespace ↗ 

  21. Groovy: Number type suffixes ↗ 

  22. JetBrains: Invert if statement ↗ 

  23. JetBrains: Redundant else keyword ↗ 

  24. JetBrains: Redundant qualifier name ↗ 

  25. JetBrains: Minimum switch branches ↗ 

  26. JetBrains: TODO comments ↗ 

  27. Kotlin: Choose good names ↗ 

  28. Kotlin: Class headers ↗ 

  29. Kotlin: Class layout ↗ 

  30. Kotlin: Control flow statements ↗ 

  31. Kotlin: Documentation comments ↗ 

  32. Kotlin: Filter by predicate ↗ 

  33. Kotlin: KDoc syntax ↗ 

  34. Kotlin: Kotlin contracts ↗ 

  35. Kotlin: Mapped types ↗ 

  36. Kotlin: Overload layout ↗ 

  37. Kotlin: Calling Kotlin from Java ↗ 

  38. Kotlin: Source file names ↗ 

  39. Kotlin: Source file organization ↗ 

  40. Kotlin: Structural equality ↗ 

  41. Kotlin: Trailing commas 

  42. Kotlin: Wrap chained calls ↗ 

  43. Oracle: Naming conventions ↗ 

  44. Oracle: Simple statements ↗ 

  45. Oracle: Javadoc reference ↗ 

  46. Oracle: Javadoc tool ↗ 

  47. Oracle: Lambda expressions ↗ 

  48. Oracle: How to Throw Exceptions ↗ 

  49. Oracle: Generic types ↗ 

  50. Python: When to use trailing commas ↗