Skip to content

Fix Codacy false-positive findings and unused variable warnings#414

Merged
mason-sharp merged 1 commit intomainfrom
review/SPOC-466/codacy-security-triage
Apr 14, 2026
Merged

Fix Codacy false-positive findings and unused variable warnings#414
mason-sharp merged 1 commit intomainfrom
review/SPOC-466/codacy-security-triage

Conversation

@rasifr
Copy link
Copy Markdown
Member

@rasifr rasifr commented Apr 12, 2026

Replace strlen(PSWD_KEYWORD) with sizeof(PSWD_KEYWORD) - 1 since PSWD_KEYWORD is a compile-time string literal; evaluated at compile time with no runtime overhead.

Remove unused COL_LSN and COL_SNAP variables in
spock_create_slot_and_read_progress(); the read_peer_progress result columns 0 and 1 are intentionally skipped in favour of the values already obtained from the replication protocol.

Replace strlen(PSWD_KEYWORD) with sizeof(PSWD_KEYWORD) - 1 since
PSWD_KEYWORD is a compile-time string literal; evaluated at compile
time with no runtime overhead.

Remove unused COL_LSN and COL_SNAP variables in
spock_create_slot_and_read_progress(); the read_peer_progress result
columns 0 and 1 are intentionally skipped in favour of the values
already obtained from the replication protocol.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2c92b28b-79f4-4be6-b6dd-99a4c874546b

📥 Commits

Reviewing files that changed from the base of the PR and between c85bc2f and d7cfbe6.

📒 Files selected for processing (2)
  • src/spock.c
  • src/spock_sync.c

📝 Walkthrough

Walkthrough

The PR contains two minor code improvements: updating password redaction to use compile-time string length calculation instead of runtime scanning, and removing unused local constants while clarifying column offset comments in database query result handling.

Changes

Cohort / File(s) Summary
Password Redaction Optimization
src/spock.c
Changed password keyword length calculation from runtime strlen() to compile-time sizeof() for improved efficiency in the log message filtering function.
Column Constants Cleanup
src/spock_sync.c
Removed unused local constants COL_LSN and COL_SNAP and updated comments to clarify that GP_* column extraction begins at offset 2.

Poem

🐰 A rabbit hops through code so clean,
Passwords safe from prying screens,
Constants gone, comments bright,
Compile-time checks set things right!
Small tweaks make the logic lean.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the changeset: fixing Codacy findings (the strlen → sizeof change) and removing unused variables (COL_LSN and COL_SNAP).
Description check ✅ Passed The description is directly related to the changeset, explaining both modifications: the strlen replacement and the removal of unused column constants.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch review/SPOC-466/codacy-security-triage

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.

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@mason-sharp mason-sharp self-requested a review April 13, 2026 14:52
Copy link
Copy Markdown
Member

@mason-sharp mason-sharp left a comment

Choose a reason for hiding this comment

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

The other flagged issues appear to be typical Postgres style code.

@mason-sharp mason-sharp merged commit 03d7329 into main Apr 14, 2026
10 checks passed
@mason-sharp mason-sharp deleted the review/SPOC-466/codacy-security-triage branch April 14, 2026 01:40
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