File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
main/java/au/com/integradev/delphi/checks
test/java/au/com/integradev/delphi/checks Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ### Changed
11+
12+ - Exclude types annotated with attributes in ` UnusedType ` .
13+
1014### Fixed
1115
1216- Exceptions from empty structures (e.g., ` if ` ) in ` LoopExecutingAtMostOnce ` and ` RedundantJump ` .
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ private boolean isViolation(TypeDeclarationNode node) {
6969 return false ;
7070 }
7171
72+ if (node .getAttributeList () != null ) {
73+ return false ;
74+ }
75+
7276 return node .getTypeNameNode ().getUsages ().stream ()
7377 .allMatch (occurrence -> isWithinType (occurrence , type ));
7478 }
Original file line number Diff line number Diff line change @@ -199,4 +199,17 @@ void testUnusedImplementationTypeWithExcludeApiShouldAddIssue() {
199199 .appendImpl ("end;" ))
200200 .verifyIssues ();
201201 }
202+
203+ @ Test
204+ void testUnusedTypeWithAttributeShouldNotAddIssue () {
205+ CheckVerifier .newVerifier ()
206+ .withCheck (new UnusedTypeCheck ())
207+ .onFile (
208+ new DelphiTestUnitBuilder ()
209+ .appendDecl ("type" )
210+ .appendDecl (" [Bar]" )
211+ .appendDecl (" TFoo = class" )
212+ .appendDecl (" end;" ))
213+ .verifyNoIssues ();
214+ }
202215}
You can’t perform that action at this time.
0 commit comments