Skip to content

Conversation

@edbjunwang
Copy link
Contributor

@edbjunwang edbjunwang commented Dec 1, 2025

Python treats the parentheses as grouping for an expression instead of defining a tuple, for code define a single item tuple as below:

t = ("node_modules")
print(t)          
print(type(t))
print("module" in t)
...
node_modules
<class 'str'>
True

We need to add a trailing comma to get a real tuple, as below:

t = ("node_modules",)
print(t)          
print(type(t))
print("module" in t)
...
('node_modules',)
<class 'tuple'>
False

@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

Walkthrough

Changed EXCLUDE_DIR from a string to a one-element tuple in the copyright updater tool. This corrects membership testing during directory filtering in os.walk operations, preventing unintended character-level iteration over the string.

Changes

Cohort / File(s) Summary
Variable type fix
tools/copyright_updater.py
Modified EXCLUDE_DIR from "node_modules" (string) to ("node_modules",) (tuple) for correct membership testing in directory exclusion logic

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Verify tuple syntax is correct and aligns with intended membership testing behavior in os.walk filtering

Pre-merge checks and finishing touches

✅ Passed checks (3 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 fix: changing EXCLUDE_DIR from a string to a tuple to properly skip folders like 'node_modules' during directory traversal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56040aa and ffa24e2.

📒 Files selected for processing (1)
  • tools/copyright_updater.py (1 hunks)
🔇 Additional comments (1)
tools/copyright_updater.py (1)

26-45: EXCLUDE_DIR tuple change correctly fixes directory exclusion logic

Defining EXCLUDE_DIR = ("node_modules",) ensures d not in EXCLUDE_DIR at Line 44 performs membership checks against full directory names instead of substring checks on a single string. This prevents accidentally excluding directories like "modules" while still skipping "node_modules" as intended. Looks good and matches the PR objective.

Please run the updater on a tree containing both node_modules and modules (or similar) to confirm only node_modules is skipped in the walk as expected.


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.

@akshay-joshi akshay-joshi merged commit f55fcf7 into pgadmin-org:master Dec 2, 2025
34 of 37 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