Conversation
Address the open issues reported by SonarCloud and Codacy on the current branch so the quality gates pass on the next scan. Library: - Drop redundant isinstance(env_info, dict) checks in SMTP/IMAP credential resolution (S2589); get_mail_thunder_os_environ always returns a dict. - Replace list()/dict() constructor calls with literals in imap_wrapper for hot-path readability (S7498). - Remove json.JSONDecodeError from the except tuple in json_file since it is already a ValueError subclass (S5713). - Iterate execute_action results via .values() in the socket server handler (S7512). - Extract the "/mail_thunder_content.json" literal into a module constant in mail_thunder_content_save (S1192). - Widen execute_action type hint to Union[list, dict] so dict payloads with auto_control are correctly typed (S5655). Tests: - Generate fake credentials with secrets.token_hex instead of hardcoded literals (S2068, B105). - Drop unused result assignment, unused threading/tempfile/shutil imports (S1481, F401). - Replace try/except/pass with logged OSError handling in the socket server teardown (B110). - Mark CLI subprocess test calls with nosec since arguments are test-controlled constants (B404, B603). Tooling: - Add .bandit and [tool.bandit] in pyproject.toml so Bandit skips the test directory and B101, which is the standard pytest assert pattern, eliminating ~85 noise findings.
Align dev.toml with the setuptools floor already on pyproject.toml and add the GitHub Actions workflow that publishes the stable package to PyPI on pushes to main.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 2 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Move contents:write from workflow scope to the publish job and restrict the test job to contents:read so the broad write capability is only granted where the version-bump commit, tag push, and release creation actually need it (githubactions:S8233).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
test/directory via.banditand[tool.bandit]inpyproject.tomlsinceassertis the standard pytest idiom.isinstancechecks (S2589), prefer literals overlist()/dict()(S7498), remove redundantjson.JSONDecodeErrorfrom except tuple (S5713), iterate result via.values()(S7512), extract repeated content-file path into a constant (S1192), widenexecute_actiontype hint toUnion[list, dict](S5655).secrets.token_hex(S2068/B105), remove unused imports/variables, replacetry/except/passwith loggedOSErrorhandling, mark CLI subprocess test calls with# nosecsince args are test-controlled constants.dev.tomlsetuptools floor to matchpyproject.tomland add thepublish_stable.ymlworkflow that releases to PyPI on pushes tomain.Test plan
pytest— 55/55 passing locally on Python 3.14bandit -c pyproject.toml -r je_mail_thunder— only one residual low-severity false positive onpassword: Noneliteral defaultpublish_stable.ymltriggers correctly on the merge tomain