[INJIMOB-3794] refactor: update test_executable finding logic#306
[INJIMOB-3794] refactor: update test_executable finding logic#306KiruthikaJeyashankar wants to merge 1 commit intomosip:developfrom
Conversation
WalkthroughAdds a Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/swift-sonar-analysis.yml:
- Around line 84-89: The script currently finds TEST_EXECUTABLE by scanning
Build/Products again which can pick the wrong test bundle; instead derive the
executable directly from the already-found TEST_BUNDLE to guarantee it matches
the scheme under test. Replace the second find and subsequent construction with
computing TEST_EXECUTABLE from TEST_BUNDLE (e.g. set
TEST_EXECUTABLE="$TEST_BUNDLE/$(basename "$TEST_BUNDLE" .xctest)" or the
bundle's Contents/MacOS/<basename> as appropriate), and keep COVERAGE_PATH
lookup as-is; update references to TEST_EXECUTABLE, TEST_BUNDLE, and
COVERAGE_PATH accordingly.
- Around line 87-88: The basename rewrite unconditionally runs even when
TEST_EXECUTABLE is empty, producing a bogus non-empty value; modify the workflow
so the second assignment that appends "/$(basename ...)" is performed only if
TEST_EXECUTABLE is non-empty—i.e., check [ -n "$TEST_EXECUTABLE" ] (or
equivalent) before performing the basename rewrite on TEST_EXECUTABLE to
preserve the later existence check; reference the TEST_EXECUTABLE variable and
the two lines that set it.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 41fba56e-bc55-4979-9d21-738f732a4f5a
📒 Files selected for processing (1)
.github/workflows/swift-sonar-analysis.yml
- Previous logic sometimes finds framework's test executable as its test executable which results in 0 test coverage - To avoid this issue of flakiness, test executable finding logic has been updated to find the library's scheme tests Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
98347d8 to
f0d10cf
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/swift-sonar-analysis.yml (1)
84-84: Consider quoting$DERIVED_DATAfor defensive shell scripting.While the current value contains no spaces, quoting the variable prevents subtle bugs if the path changes in the future.
- TEST_BUNDLE=$(find $DERIVED_DATA -type d -name "*.xctest" | head -n 1) + TEST_BUNDLE=$(find "$DERIVED_DATA" -type d -name "*.xctest" | head -n 1)- COVERAGE_PATH=$(find $DERIVED_DATA -name "Coverage.profdata" | head -n 1) + COVERAGE_PATH=$(find "$DERIVED_DATA" -name "Coverage.profdata" | head -n 1)Also applies to: 91-91
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/swift-sonar-analysis.yml at line 84, The find invocations that use the shell variable DERIVED_DATA (e.g., the TEST_BUNDLE assignment line "TEST_BUNDLE=$(find $DERIVED_DATA -type d -name \"*.xctest\" | head -n 1)") should quote the variable to guard against spaces or special characters; update the usages of $DERIVED_DATA (including the similar usage around line 91) to use "$DERIVED_DATA" so the find command receives the full path as a single argument.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/swift-sonar-analysis.yml:
- Line 84: The find invocations that use the shell variable DERIVED_DATA (e.g.,
the TEST_BUNDLE assignment line "TEST_BUNDLE=$(find $DERIVED_DATA -type d -name
\"*.xctest\" | head -n 1)") should quote the variable to guard against spaces or
special characters; update the usages of $DERIVED_DATA (including the similar
usage around line 91) to use "$DERIVED_DATA" so the find command receives the
full path as a single argument.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c20b6157-ad51-4e73-b481-28ceb33fecf7
📒 Files selected for processing (1)
.github/workflows/swift-sonar-analysis.yml
Summary by CodeRabbit