Skip to content

Commit 3f2e1eb

Browse files
authored
Filter Scans on Tags (#49)
* Deprecate fileProtocol.group and add ability to filter on tags * Add tags scan documentation example * Update parent version and bump pom minor version * Update copyright to 2021 * Update NOTICE description * Fix flatten config specs with config update
1 parent 99691e1 commit 3f2e1eb

File tree

65 files changed

+174
-266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+174
-266
lines changed

.test/bad-parent-2.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
file-protocols:
33
- name: Maven Parent
44
description: Maven Parent is correct
5-
group: maven
65
tags:
76
- maven
87
- parent

.test/bad-parent.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
file-protocols:
33
- name: Maven Parent
44
description: Maven Parent is correct
5-
group: maven
65
tags:
76
- maven
87
- parent

.test/glob-example.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
file-protocols:
33
- name: Maven Parent
44
description: Maven Parent is correct
5-
group: maven
65
tags:
76
- maven
87
- parent

.test/override.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
file-protocols:
33
- name: Maven Parent
44
description: Maven Parent is correct
5-
group: maven
65
tags:
76
- maven
87
- parent
@@ -11,7 +10,6 @@ file-protocols:
1110
- enforcer: .maven.MavenParentEquals
1211
expected-coordinates: com.optum.sourcehawk:sourcehawk-jar-parent
1312

14-
1513
# Composable recursive source hawk configs (Must be public repo)
1614
config-locations:
1715
- .test/bad-parent.yml

.test/tags.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
file-protocols:
3+
- name: Maven Parent
4+
description: Maven Parent is correct
5+
tags:
6+
- maven
7+
- parent
8+
repository-path: pom.xml
9+
enforcers:
10+
- enforcer: .maven.MavenParentEquals
11+
expected-coordinates: com.optum.sourcehawk:sourcehawk-jar-parent
12+
- name: Lombok
13+
description: Lombok config is correct
14+
tags:
15+
- config
16+
- lombok
17+
repository-path: lombok.config
18+
enforcers:
19+
- enforcer: .common.StringPropertyEquals
20+
property-name: config.stopBubbling
21+
expected-property-value: false

NOTICE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
sourcehawk
22

3-
Copyright 2020 Optum
3+
Copyright 2021 Optum
44

55
Project Description:
66
====================
7-
Sourcehawk is a source code compliance as code automation suite of tools.
7+
Sourcehawk is an extensible compliance as code automation tool which enables teams to run tailored compliance scans on their source code.
88

99
Contributors:
1010
@brianwyka - Project Lead

bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.optum.sourcehawk</groupId>
1010
<artifactId>sourcehawk</artifactId>
11-
<version>0.5.1-SNAPSHOT</version>
11+
<version>0.6.0-SNAPSHOT</version>
1212
</parent>
1313

1414
<artifactId>sourcehawk-bom</artifactId>

cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<artifactId>sourcehawk</artifactId>
1010
<groupId>com.optum.sourcehawk</groupId>
11-
<version>0.5.1-SNAPSHOT</version>
11+
<version>0.6.0-SNAPSHOT</version>
1212
</parent>
1313

1414
<artifactId>sourcehawk-cli</artifactId>

cli/src/main/asciidoc/_scan-examples.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ sourcehawk scan --config-file-url https://raw.githubsercontent.com/optum/sourceh
2525
sourcehawk scan -f MARKDOWN --fail-on-warnings > sourcehawk-scan-results.md
2626
----
2727

28+
.Scan only the provided tags to limit the scope
29+
[source,sh]
30+
----
31+
sourcehawk scan --tags "config" --tags "build"
32+
----
33+
2834
.Output in JSON format and pretty print with jq
2935
[source,sh]
3036
----

cli/src/main/java/com/optum/sourcehawk/cli/AbstractExecCommand.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ protected ExecOptions buildExecOptions() {
4848
.map(Object::toString)
4949
.ifPresent(builder::configurationFileLocation);
5050
Optional.ofNullable(exec.verbosity).ifPresent(builder::verbosity);
51+
Optional.ofNullable(exec.tags).ifPresent(builder::tags);
5152
Optional.ofNullable(exec.outputFormat).ifPresent(builder::outputFormat);
5253
if (exec.outputFormat == OutputFormat.JSON || exec.outputFormat == OutputFormat.MARKDOWN) {
5354
builder.verbosity(Verbosity.ZERO);
5455
}
55-
builder.failOnWarnings(exec.failOnWarnings);
56-
return builder.build();
56+
return builder.failOnWarnings(exec.failOnWarnings)
57+
.build();
5758
}
5859

5960
/**

0 commit comments

Comments
 (0)