-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supported comments after latest enum element (#1302)
### What's done: * skip EOL_COMMENT, BLOCK_COMMENT, WHITE_SPACE to detect a location for COMMA * supported KDoc in method for adding new line after each enum element
- Loading branch information
Showing
5 changed files
with
204 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
diktat-rules/src/test/resources/test/paragraph3/enum_separated/LastElementCommentExpected.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
package test.paragraph3.enum_separated | ||
|
||
enum class Foo0 { | ||
A, | ||
B, | ||
C, | ||
; | ||
} | ||
|
||
enum class Foo11 { | ||
A, | ||
B, | ||
C, // some comment 11 | ||
; | ||
} | ||
|
||
enum class Foo12 { | ||
A, | ||
B, | ||
C,// some comment 12 | ||
; | ||
} | ||
|
||
enum class Foo13 { | ||
A, | ||
B, | ||
C, | ||
;// some comment 13 | ||
} | ||
|
||
enum class Foo14 { | ||
A, | ||
B, | ||
C, | ||
; // some comment 14 | ||
} | ||
|
||
enum class Foo21 { | ||
A, | ||
B, | ||
C, /* some comment 21 */ | ||
; | ||
} | ||
|
||
enum class Foo22 { | ||
A, | ||
B, | ||
C,/* some comment 22 */ | ||
; | ||
} | ||
|
||
enum class Foo23 { | ||
A, | ||
B, | ||
C, | ||
;/* some comment 23 */ | ||
} | ||
|
||
enum class Foo24 { | ||
A, | ||
B, | ||
C, | ||
; /* some comment 24 */ | ||
} | ||
|
||
enum class Foo31 { | ||
A, | ||
B, | ||
C, | ||
; | ||
/** some comment 31 */ | ||
} | ||
|
||
enum class Foo32 { | ||
A, | ||
B, | ||
C, | ||
; | ||
/** some comment 32 */ | ||
} | ||
|
||
enum class Foo33 { | ||
A, | ||
B, | ||
C, | ||
; | ||
/** some comment 33 */ | ||
} | ||
|
||
enum class Foo34 { | ||
A, | ||
B, | ||
C, | ||
; | ||
/** some comment 34 */ | ||
} |
79 changes: 79 additions & 0 deletions
79
diktat-rules/src/test/resources/test/paragraph3/enum_separated/LastElementCommentTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package test.paragraph3.enum_separated | ||
|
||
enum class Foo0 { | ||
A, | ||
B, | ||
C | ||
} | ||
|
||
enum class Foo11 { | ||
A, | ||
B, | ||
C // some comment 11 | ||
} | ||
|
||
enum class Foo12 { | ||
A, | ||
B, | ||
C// some comment 12 | ||
} | ||
|
||
enum class Foo13 { | ||
A, | ||
B, | ||
C;// some comment 13 | ||
} | ||
|
||
enum class Foo14 { | ||
A, | ||
B, | ||
C; // some comment 14 | ||
} | ||
|
||
enum class Foo21 { | ||
A, | ||
B, | ||
C /* some comment 21 */ | ||
} | ||
|
||
enum class Foo22 { | ||
A, | ||
B, | ||
C/* some comment 22 */ | ||
} | ||
|
||
enum class Foo23 { | ||
A, | ||
B, | ||
C;/* some comment 23 */ | ||
} | ||
|
||
enum class Foo24 { | ||
A, | ||
B, | ||
C; /* some comment 24 */ | ||
} | ||
|
||
enum class Foo31 { | ||
A, | ||
B, | ||
C /** some comment 31 */ | ||
} | ||
|
||
enum class Foo32 { | ||
A, | ||
B, | ||
C/** some comment 32 */ | ||
} | ||
|
||
enum class Foo33 { | ||
A, | ||
B, | ||
C;/** some comment 33 */ | ||
} | ||
|
||
enum class Foo34 { | ||
A, | ||
B, | ||
C; /** some comment 34 */ | ||
} |