Skip to content

CI Fix argument in get_comment.py on failed linting - #34767

Merged
lesteve merged 2 commits into
scikit-learn:mainfrom
DeaMariaLeon:get-comment
Aug 19, 2026
Merged

lesteve merged 2 commits into
scikit-learn:mainfrom
DeaMariaLeon:get-comment

Conversation

@DeaMariaLeon

Copy link
Copy Markdown
Member

Reference Issues/PRs

While adding sphinx-lint I noticed

What does this implement/fix? Explain your changes.

Line 333 calls get_message using a keyword argument repo=, but the function signature at line 75 defines the parameter as repo_str. So, if there is a long comment that exceeds the limit, this would fail.

Original PR #32804

@AnneBeyer AnneBeyer 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.

Thank you for catching this, @DeaMariaLeon!
It looks like a typo indeed. From what I understand, the repo variable is only needed to get the actual PR content in line 299 (though I find it a bit confusing that the variable is called issue, but that is outside the scope of this PR). So repo_str should be passed here.
I just think that the parameter name needs to be adapted as well, see below.

Comment thread build_tools/get_comment.py Resolved
@AnneBeyer AnneBeyer added Quick Review For PRs that are quick to review Waiting for Second Reviewer First reviewer is done, need a second one! good first PR to review Simple atomic PR to review labels Aug 18, 2026
@DeaMariaLeon

Copy link
Copy Markdown
Member Author

Thanks @AnneBeyer.. I wrote too fast :-/

@lesteve lesteve 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.

Nice catch, thanks!

Out of curiosity did it cause an issue in the CI or you bumped into it when looking at the file?

@lesteve lesteve changed the title CI - Fix argument in get_comment.py on failed linting CI Fix argument in get_comment.py on failed linting Aug 19, 2026
@lesteve
lesteve merged commit 312e728 into scikit-learn:main Aug 19, 2026
49 checks passed
@lesteve

lesteve commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

Naively, I thought why doesn't ruff catch this kind of mistakes? Asking a LLM it turns out that:

It mainly performs linting through syntax and limited semantic analysis; it is not a type checker or full name/signature inference engine

It turns out that pyrefly would have caught it, but we only run it in scikit-learn folder from our pyproject.toml config.

With this diff below pyrefly catches the issue, see output below. I personally think this worth adding the build_tools and maint_tools folders 1: and fixing the problem in build_tools/circle/list_versions.py (basically adding a if regex_match is None: raise ValueError("some good error message")). PR more than welcome 🙏!

pyproject.toml diff to add maint_tools and build_tools:

diff --git a/pyproject.toml b/pyproject.toml
index c9caa9cff25..b0f33b9d70c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -165,7 +165,7 @@ ban-relative-imports = "all"
 "sklearn/utils/_metadata_requests.py"=["CPY001"]
 
 [tool.pyrefly]
-project-includes = ["sklearn"]
+project-includes = ["sklearn", "build_tools", "maint_tools"]
 project-excludes = ["**/sklearn/externals*"]
 preset = "legacy"
 ignore-missing-imports = [

pyrefly errors:

❯ pre-commit run pyrefly-check --all-files
Pyrefly (type checking)..................................................Failed
- hook id: pyrefly-check
- exit code: 1

WARN PYTHONPATH environment variable is set to ``. Checks in other environments may not include these paths.
 INFO Checking project configured at `/home/lesteve/dev/scikit-learn/pyproject.toml`
ERROR Object of class `NoneType` has no attribute `group` [missing-attribute]
  --> build_tools/circle/list_versions.py:89:23
   |
89 |         version_num = VERSION_RE.search(html).group(1)
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
ERROR Missing argument `repo_str` in function `get_message` [missing-argument]
   --> build_tools/get_comment.py:348:34
    |
348 |               message = get_message(
    |  __________________________________^
349 | |                 log_file,
350 | |                 repo=repo,
351 | |                 pr_number=pr_number,
352 | |                 sha=sha,
353 | |                 run_id=run_id,
354 | |                 details=False,
355 | |                 versions=versions,
356 | |             )
    | |_____________^
    |
ERROR Unexpected keyword argument `repo` in function `get_message` [unexpected-keyword]
   --> build_tools/get_comment.py:350:17
    |
350 |                 repo=repo,
    |                 ^^^^
    |
 INFO 3 errors (2 suppressed, 33 warnings not shown)

Footnotes

  1. for completeness I don't think it's worth adding the examples folders we don't want to add type hints or fight with the typechecker in examples. ↩

@DeaMariaLeon
DeaMariaLeon deleted the get-comment branch August 19, 2026 06:41
@DeaMariaLeon

Copy link
Copy Markdown
Member Author

Out of curiosity did it cause an issue in the CI or you bumped into it when looking at the file?

I bumped into it when looking at the file.

PR more than welcome 🙏!

OK. I'll look into it.

Thanks for the review and merge.

@DeaMariaLeon DeaMariaLeon moved this to Done in Labs Aug 20, 2026
prady0t pushed a commit to prady0t/scikit-learn that referenced this pull request Sep 2, 2026
@jeremiedbb jeremiedbb mentioned this pull request Sep 8, 2026
14 tasks done
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 8, 2026
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 9, 2026
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build / CI good first PR to review Simple atomic PR to review Quick Review For PRs that are quick to review Waiting for Second Reviewer First reviewer is done, need a second one!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants