Skip to content

Commit

Permalink
chore: Improve NCD author deduplication, fix config file location
Browse files Browse the repository at this point in the history
  • Loading branch information
rsenden committed Oct 23, 2023
1 parent d31c1f4 commit 9decd6b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@Command(name = OutputHelperMixins.CreateConfig.CMD_NAME)
public class MspReportCreateConfigCommand extends AbstractGenerateConfigCommand {
@Getter @Mixin private OutputHelperMixins.CreateConfig outputHelper;
@Getter private final String resourceFileName = "com/fortify/cli/util/msp_report/MspReportConfig.yml";
@Getter private final String resourceFileName = "com/fortify/cli/license/msp_report/MspReportConfig.yml";

@Option(names = {"-c", "--config"}, defaultValue = "MspReportConfig.yml")
@Getter private String outputFileName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@Command(name = OutputHelperMixins.CreateConfig.CMD_NAME)
public class NcdReportCreateConfigCommand extends AbstractGenerateConfigCommand {
@Getter @Mixin private OutputHelperMixins.CreateConfig outputHelper;
@Getter private final String resourceFileName = "com/fortify/cli/util/ncd_report/NcdReportConfig.yml";
@Getter private final String resourceFileName = "com/fortify/cli/license/ncd_report/NcdReportConfig.yml";

@Option(names = {"-c", "--config"}, defaultValue = "NcdReportConfig.yml")
@Getter private String outputFileName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ public default ObjectNode toExpressionInput() {
var lcEmailDomain = StringUtils.substringAfter(lcEmail, "@");
var lcEmailName = StringUtils.substringBefore(lcEmail, "@");
var cleanName = lcName.replaceAll("[^a-z]", "");
var cleanEmailName = lcEmailName.replaceAll("[^a-z]", "");
// Remove all special characters, then remove leading digits unless remaining string contains only digits
// TODO Any better way of doing this instead of having to iterate through the string 3 times?
var cleanEmailName = lcEmailName.replaceAll("[^a-z0-9]", "");
if ( !cleanEmailName.matches("[0-9]+") ) {
cleanEmailName = cleanEmailName.replaceAll("^[0-9]+", "");
}
return JsonHelper.getObjectMapper().createObjectNode()
.put("name", name)
.put("email", email)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
# - lcEmailDomain: Lowercase author email domain name
# - lcEmailName: Lowercase author email name (everything before '@')
# - cleanName: Lowercase author name with all non-letters removed
# - cleanEmailName: Lowercase author email name with all non-letters removed
# - cleanEmailName: Lowercase author email name with all special characters
# and leading digits removed
contributor:
# Ignore all contributors matching the given Spring Expression Language
# expression, based on the author properties listed above. Commonly used
Expand Down

0 comments on commit 9decd6b

Please sign in to comment.