From 15bce0357323e7ec40d1d662b9597692b8cd6e36 Mon Sep 17 00:00:00 2001 From: George Tay Date: Fri, 12 Jan 2024 20:08:45 +0800 Subject: [PATCH 1/2] Reduce level of code nesting --- .../reposense/parser/RepoConfigCsvParser.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/reposense/parser/RepoConfigCsvParser.java b/src/main/java/reposense/parser/RepoConfigCsvParser.java index c461fb83cb..00c1cb44ab 100644 --- a/src/main/java/reposense/parser/RepoConfigCsvParser.java +++ b/src/main/java/reposense/parser/RepoConfigCsvParser.java @@ -114,20 +114,19 @@ protected void processLine(List results, CSVRecord record) th // If file diff limit is specified if (fileSizeLimitStringList.size() > 0) { + String fileSizeLimitString = fileSizeLimitStringList.get(0).trim(); + int parseValue; + if (isFileSizeLimitIgnored) { logger.warning("Ignoring file size limit column since file size limit is ignored"); isFileSizeLimitOverriding = false; + } else if (!StringsUtil.isNumeric(fileSizeLimitString) + || (parseValue = Integer.parseInt(fileSizeLimitString)) <= 0) { + logger.warning(String.format("Values in \"%s\" column should be positive integers.", + FILESIZE_LIMIT_HEADER[0])); + isFileSizeLimitOverriding = false; } else { - String fileSizeLimitString = fileSizeLimitStringList.get(0).trim(); - int parseValue; - if (!StringsUtil.isNumeric(fileSizeLimitString) - || (parseValue = Integer.parseInt(fileSizeLimitString)) <= 0) { - logger.warning(String.format("Values in \"%s\" column should be positive integers.", - FILESIZE_LIMIT_HEADER[0])); - isFileSizeLimitOverriding = false; - } else { - fileSizeLimit = parseValue; - } + fileSizeLimit = parseValue; } } @@ -146,6 +145,9 @@ protected void processLine(List results, CSVRecord record) th isStandaloneConfigIgnored, isShallowCloningPerformed, isFindingPreviousAuthorsPerformed); } + private void process() { + } + /** * Returns true if value from {@code record}, that matches any of the equivalent headers in * {@code equivalentHeaders}, is the same as the given {@code keyword}, else false. From 43ab3d9a34e3ba918c6851eccd1cafed62bac762 Mon Sep 17 00:00:00 2001 From: George Tay Date: Fri, 12 Jan 2024 22:58:15 +0800 Subject: [PATCH 2/2] Remove unused method --- src/main/java/reposense/parser/RepoConfigCsvParser.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/reposense/parser/RepoConfigCsvParser.java b/src/main/java/reposense/parser/RepoConfigCsvParser.java index 00c1cb44ab..1248fdf75f 100644 --- a/src/main/java/reposense/parser/RepoConfigCsvParser.java +++ b/src/main/java/reposense/parser/RepoConfigCsvParser.java @@ -145,9 +145,6 @@ protected void processLine(List results, CSVRecord record) th isStandaloneConfigIgnored, isShallowCloningPerformed, isFindingPreviousAuthorsPerformed); } - private void process() { - } - /** * Returns true if value from {@code record}, that matches any of the equivalent headers in * {@code equivalentHeaders}, is the same as the given {@code keyword}, else false.