githubEdit

General Snippets

1. Files In ext Package Must Have Name Ending With Ext

@Test
fun `files in 'ext' package must have name ending with 'Ext'`() {
    Konsist
        .scopeFromProject()
        .files
        .withPackage("..ext..")
        .assertTrue { it.hasNameEndingWith("Ext") }
}

2. All Data Class Properties Are Defined In Constructor

@Test
fun `all data class properties are defined in constructor`() {
    Konsist
        .scopeFromProject()
        .classes()
        .withModifier(KoModifier.DATA)
        .properties()
        .assertTrue { it.isConstructorDefined }
}

3. Every Class Has Test

4. Every Class - Except Data And Value Class - Has Test

5. Properties Are Declared Before Functions

6. Every Constructor Parameter Has Name Derived From Parameter Type

7. Every Class Constructor Has Alphabetically Ordered Parameters

8. Enums Has Alphabetically Ordered Consts

9. Companion Object Is Last Declaration In The Class

10. Every Value Class Has Parameter Named value

11. No Empty Files Allowed

12. No Field Should Have m Prefix

13. No Class Should Use Field Injection

14. No Class Should Use Java Util Logging

15. Package Name Must Match File Path

16. No Wildcard Imports Allowed

17. Forbid The Usage Of forbiddenString In File

18. All Function Parameters Are Interfaces

19. All Parent Interfaces Are Public

20. Return Type Of All Functions Are Immutable

Last updated