Skip to content

Commit 36faeac

Browse files
authored
Consider 'src/test' test directories (#2706)
The Maven 'Standard Directory Layout' [0] is fairly widely used, not only in Maven but also in adjacent ecosystems like Gradle and clojure. Longer-term this would become part of the default policy, see discussion at #1408 (comment) etc. [0]: https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html Signed-off-by: Arnout Engelen <[email protected]>
1 parent 846fb19 commit 36faeac

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

checks/fileparser/listing.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ func isMatchingPath(fullpath string, matchPathTo PathMatcher) (bool, error) {
5252
func isTestdataFile(fullpath string) bool {
5353
// testdata/ or /some/dir/testdata/some/other
5454
return strings.HasPrefix(fullpath, "testdata/") ||
55-
strings.Contains(fullpath, "/testdata/")
55+
strings.Contains(fullpath, "/testdata/") ||
56+
strings.HasPrefix(fullpath, "src/test/") ||
57+
strings.Contains(fullpath, "/src/test/")
5658
}
5759

5860
// PathMatcher represents a query for a filepath.

checks/fileparser/listing_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,13 @@ func Test_isTestdataFile(t *testing.T) {
375375
},
376376
want: true,
377377
},
378+
{
379+
name: "testdata file",
380+
args: args{
381+
fullpath: "archiva-modules/archiva-base/archiva-checksum/src/test/resources/examples/redback-authz-open.jar",
382+
},
383+
want: true,
384+
},
378385
}
379386
for _, tt := range tests {
380387
tt := tt // Re-initializing variable so it is not changed while executing the closure below

0 commit comments

Comments
 (0)