Skip to content

Overview

View DokkaView Pdoc

Features

What is Rulebook?


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

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

Features


  • Follows guidelines
    Works together with standard rules from the linters and respects common coding convention

  • Shared configuration
    Available in standard and Google Style Guide variants with adjusted defaults.

Compatibility table

Legend

 The rule is fully implemented

 Functionality already exists in other rules

 The rule is already supported by the linter

 Not supported due to technical limitations

Empty — not applicable to this language

Rule Java Groovy Kotlin Python
Block tag punctuation51
Built-in types40
Confusing predicate36
Null equality45
Redundant qualifier28
TODO comment30
Trailing comma in call46
Trailing comma in collection55
Trailing comma in declaration46
Unused import8
Wildcard import22
format_text_clip Clipping group Java Groovy Kotlin Python
Empty braces clip16
Empty brackets clip3
Empty parentheses clip3
Empty tags clip3
Short block comment clip35
data_object Declaring group Java Groovy Kotlin Python
Abstract class definition1
Contract function definition39
Exception inheritance53
Number suffix for double25
Number suffix for float25
Number suffix for integer25
Number suffix for long25
String quotes18
Unnecessary parentheses in lambda52
Utility class definition4
draft Formatting group Java Groovy Kotlin Python
File size44
Final newline14
Indent style14
Line length17
label Naming group Java Groovy Kotlin Python
Class name abbreviation31
Class name48
Constant property name48
File name43
Identifier name48
Illegal class final name31
Illegal variable name2
Package name48
Property name interop42
Required generics name54
swap_vert Ordering group Java Groovy Kotlin Python
Block tag order10
Built-in function position7
Import order21
Inner class position33
Member order33
Overload function position41
Static import position21
format_letter_spacing_2 Spacing group Java Groovy Kotlin Python
Block comment spaces50
Block tag indentation19
Case separator34
Comment spaces12
Member separator24
Missing blank line before block tags38
code_blocks Stating group Java Groovy Kotlin Python
Illegal catch53
Illegal throw53
Missing braces11
Nested if-else26
Redundant default27
Redundant else27
Unnecessary switch29
format_letter_spacing_standard Trimming group Java Groovy Kotlin Python
Block comment trim6
Braces trim15
Brackets trim9
Comment trim6
Duplicate blank line24
Duplicate blank line in block comment6
Duplicate blank line in comment6
Duplicate space37
Parentheses trim9
Tags trim9
Unnecessary blank line after colon15
Unnecessary blank line before package23
format_text_wrap Wrapping group Java Groovy Kotlin Python
Assignment wrap20
Chain call wrap47
Elvis wrap5
Infix call wrap13
Lambda wrap20
Operator wrap13
Parameter wrap32
Statement wrap49

Download

Integrate the linter tools

Download the library

  • Maven


    JVM artifacts are available on Maven Central.

    Maven Central

  • PyPI


    The Python package is available on PyPI.

    PyPI


  1. Abstract class require abstract method 

  2. Avoid primitive names 

  3. Concise brackets, parentheses and tags 

  4. Hide utility class instance 

  5. Move trailing elvis to the next line 

  6. No blank lines at initial, final and consecutive comments 

  7. Place built-in methods last 

  8. Remove unused imports 

  9. Strip multiline brackets, parentheses and tags 

  10. Android: Block tags  

  11. Android: Braces  

  12. Android: Horizontal whitespace  

  13. Android: Where to break  

  14. EditorConfig: What's an EditorConfig file look like?  

  15. Google: Nonempty blocks  

  16. Google: Empty blocks  

  17. Google: Column limit: 100  

  18. Google: Use single quotes  

  19. Google: Block tags  

  20. Google: Where to break  

  21. Google: Ordering and spacing  

  22. Google: Import statements  

  23. Google: Source file structure  

  24. Google: Vertical whitespace  

  25. Groovy: Number type suffixes  

  26. JetBrains: Invert if statement  

  27. JetBrains: Redundant else keyword  

  28. JetBrains: Redundant qualifier name  

  29. JetBrains: Minimum switch branches  

  30. JetBrains: TODO comments  

  31. Kotlin: Choose good names  

  32. Kotlin: Class headers  

  33. Kotlin: Class layout  

  34. Kotlin: Control flow statements  

  35. Kotlin: Documentation comments  

  36. Kotlin: Filter by predicate  

  37. Kotlin: Horizontal whitespace  

  38. Kotlin: KDoc syntax  

  39. Kotlin: Kotlin contracts  

  40. Kotlin: Mapped types  

  41. Kotlin: Overload layout  

  42. Kotlin: Calling Kotlin from Java  

  43. Kotlin: Source file names  

  44. Kotlin: Source file organization  

  45. Kotlin: Structural equality  

  46. Kotlin: Trailing commas  

  47. Kotlin: Wrap chained calls  

  48. Oracle: Naming conventions  

  49. Oracle: Simple statements  

  50. Oracle: Javadoc reference  

  51. Oracle: Javadoc tool  

  52. Oracle: Lambda expressions  

  53. Oracle: How to Throw Exceptions  

  54. Oracle: Generic types  

  55. Python: When to use trailing commas