Skip to content

feat: add pyansys-quality-check hook - #486

Draft
Revathyvenugopal162 wants to merge 55 commits into
mainfrom
feat/pyansys-quality-report
Draft

feat: add pyansys-quality-check hook#486
Revathyvenugopal162 wants to merge 55 commits into
mainfrom
feat/pyansys-quality-report

Conversation

@Revathyvenugopal162

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions Bot added the enhancement New features or code improvements label Sep 1, 2026
@RobPasMue

Copy link
Copy Markdown
Member

Just letting you know... I see a lot of overlap with https://github.com/ansys/pre-commit-hooks/blob/main/src/ansys/pre_commit_hooks/tech_review.py

Maybe we can try and merge them into the same hook? Probably bringing in whatever is missing from https://github.com/ansys/pre-commit-hooks/blob/main/src/ansys/pre_commit_hooks/tech_review.py into your hook. Or the other way around

@jorgepiloto jorgepiloto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Big addition (new quality-report engine plus 12 rule modules), structure is reasonable, but a few things need fixing before merge.

Request (blocking)

  • .pre-commit-hooks.yaml/setup.py swap out the tech-review hook id and console script instead of adding the new one alongside it. Any config pinned to id: tech-review breaks, and this repo's own .pre-commit-config.yaml:62 still uses it. Keep the old id/script around (deprecated is fine) or call this an intentional breaking change and update the config.

  • project_metadata.py:216, PM010's Poetry-README regex (r"\[^\"']+[\"']") never matches. Tested against readme = "README.rst" under [tool.poetry], it returns None. Every Poetry project fails this check. Reuse the readme in content check from the branch below.

  • project_metadata.py:346-372, PM014's author/maintainer regexes have no closing bound and bleed from authors into maintainers. Tested with a wrong authors name plus a correct maintainers block: both name_ok and email_ok come back True for the wrong author. Bound each regex to its own array, or parse the TOML instead of scanning raw text.

  • pyansys_quality_report.py:552-557, check_dirs_exist gets called twice with identical args in _bootstrap_legacy_files. Copy-paste leftover, remove the second call.

Suggestion

  • pyansys_quality_report.py:774, main() swapped parse_args() for parse_known_args(argv), so a typoed flag now gets dropped silently instead of erroring. Keep it strict unless there's a reason not to.
  • security.py:112-131, SEC004 passes if just one uses: line is SHA-pinned anywhere in the workflow. Compare pinned vs. total count instead.
  • 40+ repeats of "return None if file missing, else file_contains" across dependabot.py, documentation.py, pre_commit.py, labeler.py, vale.py. Worth a checked_contains() helper in common.py.
  • test_pyansys_quality_report.py, three tests os.chdir() into a tmp_path and never chdir back, unlike test_tech_review.py's teardown. Can bite later tests depending on run order.

Comment

  • doc/source/conf.py hides tech_review.py from autoapi rather than removing or deprecating it. Is it staying as dead code on purpose?

Requesting changes: the regex bugs flip pass/fail on real Poetry and author/maintainer configs, and the hook-id removal breaks this repo's own config.

@jorgepiloto jorgepiloto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Line-level notes for the earlier review.

Comment thread .pre-commit-hooks.yaml
name: "Ansys Technical Review"
description: "Perform initial technical review on a repository"
entry: tech-review
- id: "pyansys-quality-report"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Blocking: this replaces the tech-review hook id instead of adding pyansys-quality-report alongside it. setup.py drops the tech-review console script too. Any config pinned to id: tech-review breaks, including this repo's own .pre-commit-config.yaml:62. Keep the old id/script (deprecated is fine) or treat this as an intentional breaking change and update the config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now It is using V8 of pre-commit hook. I have to reformat to local, to replace this new hook. i will do that.

Comment thread src/ansys/pre_commit_hooks/quality_rules/project_metadata.py
Comment thread src/ansys/pre_commit_hooks/quality_rules/project_metadata.py
Comment thread src/ansys/pre_commit_hooks/pyansys_quality_report.py Outdated
Comment thread src/ansys/pre_commit_hooks/pyansys_quality_report.py
Comment thread src/ansys/pre_commit_hooks/quality_rules/security.py Outdated
Comment thread src/ansys/pre_commit_hooks/quality_rules/dependabot.py Outdated
Comment thread tests/test_pyansys_quality_report.py Outdated
Comment thread doc/source/conf.py Outdated

@jorgepiloto jorgepiloto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have re-reviewed the updates and most prior threads are now addressed.

I am still seeing one blocking backward-compatibility break: .pre-commit-hooks.yaml now exposes only id: pyansys-quality-report and setup.py exposes only the pyansys-quality-report console script, while this repo and existing consumers still use id: tech-review (for example .pre-commit-config.yaml:62). As written, upgrading to this release will break existing pre-commit configs. I suggest keeping tech-review as a compatibility alias (deprecated is fine) until consumers can migrate safely.

@Revathyvenugopal162

Copy link
Copy Markdown
Contributor Author

I have re-reviewed the updates and most prior threads are now addressed.

I am still seeing one blocking backward-compatibility break: .pre-commit-hooks.yaml now exposes only id: pyansys-quality-report and setup.py exposes only the pyansys-quality-report console script, while this repo and existing consumers still use id: tech-review (for example .pre-commit-config.yaml:62). As written, upgrading to this release will break existing pre-commit configs. I suggest keeping tech-review as a compatibility alias (deprecated is fine) until consumers can migrate safely.

reverted in 9c5d29b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New features or code improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants