Skip to content

Conversation

@ManojTestsigma
Copy link
Contributor

@ManojTestsigma ManojTestsigma commented Dec 4, 2025

please review this addon and publish as PUBLIC

Addon name : ExcelActions_cloud
Addon accont: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira: https://testsigma.atlassian.net/browse/CUS-9450

fix

Summary by CodeRabbit

  • New Features

    • Count non-empty cells in a specific column or row of an Excel file (supports remote URLs and local paths) and store the result in a variable.
    • Count non-empty cells, non-empty rows, or maximum columns within an Excel sheet and store the result in a variable.
  • Chores

    • Project version bumped to 1.0.17.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 4, 2025

Walkthrough

Maven version bumped to 1.0.17 and two new Java WebAction classes were added to count non-empty Excel cells/rows/columns from local paths or remote URLs, with sheet selection, input validation, logging, and error handling.

Changes

Cohort / File(s) Summary
Version Update
excelActions_cloud/pom.xml
Bumped Maven project version from 1.0.16 to 1.0.17.
Excel Counting WebActions
excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountForColumnOrRow.java, excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountWithSheet.java
Added two new WebAction classes that download/read Excel files (remote URL or local), resolve sheets by name/index, compute counts (non-empty cells by column or row, non-empty rows, or max columns), and store results to runtime variables with validation, logging, and error handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Focus review on column-name-to-index resolution, header-name lookup, row/column boundary handling, file download and temp-file cleanup, workbook/sheet selection, and consistency between both classes' helper logic.

Possibly related PRs

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰 I hopped through sheets with nimble feet,

Counting cells both sparse and neat,
Column, row, or whole-sheet cheer,
I stash the totals — bright and clear,
A tiny rabbit's coder beat.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding 2 new NLPs (natural language patterns) for supporting sheet names, which directly aligns with the two new WebAction classes added (StoreNonEmptyCellCountForColumnOrRow and StoreNonEmptyCellCountWithSheet) that both handle sheet name/index resolution.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch CUS-9450

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (3)
excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountForColumnOrRow.java (1)

255-273: Temporary file is never cleaned up after use.

The temp file created at line 260 persists after execution. Consider deleting it in a finally block or marking it with deleteOnExit(). Additionally, copyURLToFile has no timeout, which could cause the action to hang on slow/unresponsive servers.

Consider using the overload with timeout:

-                FileUtils.copyURLToFile(urlObject, tempFile);
+                FileUtils.copyURLToFile(urlObject, tempFile, 30000, 60000); // 30s connect, 60s read timeout
+                tempFile.deleteOnExit();
excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountWithSheet.java (2)

84-109: Consider extracting shared utility methods.

getSheetByNameOrIndex and downloadFileFromUrl are duplicated between this class and StoreNonEmptyCellCountForColumnOrRow. Consider extracting these to a shared utility class (e.g., ExcelFileUtils) to reduce duplication and centralize maintenance.

The downloadFileFromUrl method also has the same temp file leak and missing timeout issues mentioned in the other class.

Also applies to: 171-189


111-123: Silent fallback to 0 for unrecognized count types.

If countType doesn't match any expected value, the method returns 0 without logging. While the @TestData annotation restricts input, consider adding an else clause with a warning log for defensive programming.

         } else if (countType.equalsIgnoreCase("columns")) {
             count = countMaxColumns(sheet);
+        } else {
+            // This shouldn't happen due to allowedValues constraint, but log for safety
+            throw new IllegalArgumentException("Unknown count type: " + countType);
         }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6105fef and f4b0cb9.

📒 Files selected for processing (3)
  • excelActions_cloud/pom.xml (1 hunks)
  • excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountForColumnOrRow.java (1 hunks)
  • excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountWithSheet.java (1 hunks)
🔇 Additional comments (4)
excelActions_cloud/pom.xml (1)

9-9: LGTM!

Version bump to 1.0.17 is appropriate for the new Excel action classes being added.

excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountForColumnOrRow.java (2)

117-155: LGTM!

The column resolution logic correctly handles multiple input formats (numeric index, letter notation, header name) with appropriate fallback and logging.


186-211: LGTM!

Sheet resolution handles both numeric indices (1-based for users) and names correctly with proper bounds checking.

excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountWithSheet.java (1)

155-169: LGTM!

The countMaxColumns method correctly iterates over all cells and tracks the rightmost non-empty column index.

@testsigmahq testsigmahq deleted a comment from coderabbitai bot Dec 4, 2025
@testsigmahq testsigmahq deleted a comment from coderabbitai bot Dec 4, 2025
@testsigmahq testsigmahq deleted a comment from coderabbitai bot Dec 4, 2025
@testsigmahq testsigmahq deleted a comment from coderabbitai bot Dec 4, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (2)
excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountWithSheet.java (1)

112-124: Unhandled count type returns 0 silently.

If an unexpected countType is passed, the method returns 0 without any warning. This could mask configuration errors.

 public static int calculateExcelDataCount(String countType, XSSFSheet sheet) {
-    int count = 0;
-
     if (countType.equalsIgnoreCase("non-empty cells")) {
-        count = countNonEmptyCells(sheet);
+        return countNonEmptyCells(sheet);
     } else if (countType.equalsIgnoreCase("rows")) {
-        count = countNonEmptyRows(sheet);
+        return countNonEmptyRows(sheet);
     } else if (countType.equalsIgnoreCase("columns")) {
-        count = countMaxColumns(sheet);
+        return countMaxColumns(sheet);
+    } else {
+        throw new IllegalArgumentException("Unknown count type: " + countType);
     }
-
-    return count;
 }
excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountForColumnOrRow.java (1)

186-211: Significant code duplication with StoreNonEmptyCellCountWithSheet.

getSheetByNameOrIndex() and downloadFileFromUrl() are identical in both classes. Consider extracting these into a shared utility class.

Create a utility class like ExcelActionUtils:

public final class ExcelActionUtils {
    
    private ExcelActionUtils() {}
    
    public static XSSFSheet getSheetByNameOrIndex(XSSFWorkbook workbook, String sheetNameOrIndex, Logger logger) {
        // shared implementation
    }
    
    public static File downloadFileFromUrl(String url, Logger logger) {
        // shared implementation
    }
}

Also applies to: 254-272

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f4b0cb9 and 9841d73.

📒 Files selected for processing (2)
  • excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountForColumnOrRow.java (1 hunks)
  • excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountWithSheet.java (1 hunks)
🔇 Additional comments (3)
excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountWithSheet.java (1)

1-28: LGTM on class structure and annotations.

The action text, description, and field annotations are well-defined with proper references and allowed values.

excelActions_cloud/src/main/java/com/testsigma/addons/web/StoreNonEmptyCellCountForColumnOrRow.java (2)

123-154: Column resolution logic is well-designed.

The three-tier approach (numeric → Excel letters → header name) with clear logging is user-friendly and robust.


227-252: LGTM on cell counting methods.

The countNonEmptyCellsInColumn and countNonEmptyCellsInRow methods correctly iterate and check for non-empty cells.

@ManojTestsigma ManojTestsigma merged commit 79b2200 into dev Dec 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants