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 @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
1010## [ 1.14.1] - 2025-03-05
1111
12+ ### Changed
13+
14+ - Exclude types annotated with attributes in ` UnusedType ` .
15+
1216### Fixed
1317
1418- File pointer errors around ` >= ` and ` <= ` tokens.
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 testUnusedTypeWithAttributeShouldAddIssue () {
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