Skip to content

chore: configure Codacy to skip assert_used rule in test files#2025

Draft
rayank906 wants to merge 5 commits intohiero-ledger:mainfrom
rayank906:fix-codacy-assert
Draft

chore: configure Codacy to skip assert_used rule in test files#2025
rayank906 wants to merge 5 commits intohiero-ledger:mainfrom
rayank906:fix-codacy-assert

Conversation

@rayank906
Copy link
Copy Markdown
Contributor

@rayank906 rayank906 commented Mar 25, 2026

Description:

Related issue(s):

Fixes #1974

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

cc @exploreriii

@rayank906 rayank906 requested a review from a team as a code owner March 25, 2026 16:39
@rayank906 rayank906 requested a review from nadineloepfe March 25, 2026 16:39
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

Walkthrough

Added a pylintpython3 engine to .codacy.yml with enabled: true and test-file exclusion patterns; updated CHANGELOG.md with an Unreleased note about skipping the assert_used rule in test files.

Changes

Cohort / File(s) Summary
Codacy Configuration
.codacy.yml
Added pylintpython3 engine (enabled: true) and exclude_paths entries to omit **/*_test.py and **/test_*.py; left existing bandit settings unchanged.
Changelog Update
CHANGELOG.md
Inserted an Unreleased → .github bullet noting Codacy is configured to skip the assert_used rule in test files.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: configuring Codacy to skip the assert_used rule in test files, which matches the primary objective.
Description check ✅ Passed The description is related to the changeset, mentioning the .codacy.yml configuration for skipping assert_used rules in test files and linking to issue #1974.
Linked Issues check ✅ Passed The code changes fully implement the requirements from issue #1974: adding pylintpython3 engine configuration with exclude_paths for test files matching **/test.py and **/test.py patterns.
Out of Scope Changes check ✅ Passed All changes are in scope: .codacy.yml configuration and CHANGELOG.md entry directly address the linked issue requirement with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #1974

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
Contributor

@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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0aae1415-e89e-4ab6-a143-7518405a9767

📥 Commits

Reviewing files that changed from the base of the PR and between 6dc812b and d1f5cb4.

📒 Files selected for processing (2)
  • .codacy.yml
  • CHANGELOG.md

.codacy.yml Outdated
Comment on lines +18 to +19
- "*_test.py"
- "*test_*.py"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Narrow the glob patterns to avoid suppressing production-file checks.

*test_*.py is too broad and can match non-test filenames that merely contain test_ (for example, latest_*.py), which violates the goal of keeping assert_used active in production code.

Proposed fix
   pylint:
     enabled: true
     rules:
       assert_used:
         skips:
-          - "*_test.py"
-          - "*test_*.py"
+          - "**/*_test.py"
+          - "**/test_*.py"

@exploreriii exploreriii requested a review from drtoxic69 March 26, 2026 09:13
@exploreriii exploreriii added the status: needs triage review PR needs a review from the triage team label Mar 26, 2026
Copy link
Copy Markdown
Contributor

@MonaaEid MonaaEid left a comment

Choose a reason for hiding this comment

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

Hi @rayank906 nice work, could you please apply the coderabbit suggestion, and test it in your fork

@rayank906
Copy link
Copy Markdown
Contributor Author

Made sure to sync my fork and pushed my changes. I added coderabbit's suggestion as requested.

Copy link
Copy Markdown
Contributor

@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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b3cf0053-a3b3-4917-883a-9b7ab944b98c

📥 Commits

Reviewing files that changed from the base of the PR and between d1f5cb4 and 49272e7.

📒 Files selected for processing (2)
  • .codacy.yml
  • CHANGELOG.md

Copy link
Copy Markdown
Contributor

@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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 178305e9-8702-4c59-9436-bd76bd07225d

📥 Commits

Reviewing files that changed from the base of the PR and between 49272e7 and abba14b.

📒 Files selected for processing (1)
  • .codacy.yml

@MonaaEid
Copy link
Copy Markdown
Contributor

MonaaEid commented Mar 28, 2026

Hi @rayank906 it would be great if you could test this and ensure it works properly
you can follow this steps:

Add some tests to your fork that trigger these warnings.:
1- Push your branch to your fork on GitHub.
2- Codacy will automatically re‑run analysis on your fork.
3- Check the Codacy dashboard/ workflow:
  - Before: test files flagged for assert usage
  - After: those warnings should disappear

@rayank906
Copy link
Copy Markdown
Contributor Author

Yes I will ensure to test properly. I'll make this PR a draft and convert to an actual PR when I have finished testing.

@rayank906 rayank906 marked this pull request as draft March 29, 2026 22:26
Signed-off-by: Rayan Kamdem <rayankdm@umich.edu>
Signed-off-by: Rayan Kamdem <rayankdm@umich.edu>
Signed-off-by: Rayan Kamdem <rayankdm@umich.edu>
Signed-off-by: Rayan Kamdem <rayankdm@umich.edu>
Signed-off-by: Rayan Kamdem <rayankdm@umich.edu>
Copy link
Copy Markdown
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

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

Hi @rayank906
Apologies the issue became more difficult than anticipated

I believe this can be resolved by creating a bandit file
https://bandit.readthedocs.io/en/latest/config.html

and disabling that more directly, since codacy is applying bandit.

Although this might lead to conflicts, I think @manishdait is also looking into it -- so requesting his opinion

@exploreriii exploreriii added status: needs maintainer review PR needs a review from the maintainer team status: needs developer revision PR has requested changes that the developer needs to implement and removed status: needs triage review PR needs a review from the triage team labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs developer revision PR has requested changes that the developer needs to implement status: needs maintainer review PR needs a review from the maintainer team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Beginner]: Configure Codacy to skip assert_used rule in test files

3 participants