Skip to content

Commit

Permalink
Consider 'src/test' test directories (#2706)
Browse files Browse the repository at this point in the history
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 <arnout@bzzt.net>
  • Loading branch information
raboof committed Mar 3, 2023
1 parent 846fb19 commit 36faeac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion checks/fileparser/listing.go
Expand Up @@ -52,7 +52,9 @@ func isMatchingPath(fullpath string, matchPathTo PathMatcher) (bool, error) {
func isTestdataFile(fullpath string) bool {
// testdata/ or /some/dir/testdata/some/other
return strings.HasPrefix(fullpath, "testdata/") ||
strings.Contains(fullpath, "/testdata/")
strings.Contains(fullpath, "/testdata/") ||
strings.HasPrefix(fullpath, "src/test/") ||
strings.Contains(fullpath, "/src/test/")
}

// PathMatcher represents a query for a filepath.
Expand Down
7 changes: 7 additions & 0 deletions checks/fileparser/listing_test.go
Expand Up @@ -375,6 +375,13 @@ func Test_isTestdataFile(t *testing.T) {
},
want: true,
},
{
name: "testdata file",
args: args{
fullpath: "archiva-modules/archiva-base/archiva-checksum/src/test/resources/examples/redback-authz-open.jar",
},
want: true,
},
}
for _, tt := range tests {
tt := tt // Re-initializing variable so it is not changed while executing the closure below
Expand Down

0 comments on commit 36faeac

Please sign in to comment.