Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"minversion" should be a string, not a float #12244

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

DimitriPapadopoulos
Copy link
Contributor

Subject: fix repo-review crash

Feature or Bugfix

  • Bugfix

Purpose

This fixes a crash of repo-review:

Traceback (most recent call last):
  File "/lib/python311.zip/_pyodide/_base.py", line 468, in eval_code
    .run(globals, locals)
     ^^^^^^^^^^^^^^^^^^^^
  File "/lib/python311.zip/_pyodide/_base.py", line 310, in run
    coroutine = eval(self.code, globals, locals)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 9, in 
  File "/lib/python3.11/site-packages/repo_review/processor.py", line 214, in process
    result = apply_fixtures({"name": name, **fixtures}, tasks[name].check)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/repo_review/fixtures.py", line 106, in apply_fixtures
    return func(**kwargs)
           ^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/sp_repo_review/checks/pyproject.py", line 92, in check
    return "minversion" in options and int(options["minversion"].split(".")[0]) >= 6
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'float' object has no attribute 'split'

Details

Relates

@AA-Turner
Copy link
Member

A string seems semantically wrong here -- the minimum version is a number as it currently stands.

A

@DimitriPapadopoulos
Copy link
Contributor Author

Versions are not floats. Omitting the quotes results in 6.0 being interpreted as a float, which is semantically wrong. The only way in TOML to not read this is as a float is a string. Besides, if you look at pyproject.toml, versions always appear as strings.

Also, the documentation of pytest itself suggests a string in TOML files (and only TOML file):
https://docs.pytest.org/en/7.3.x/reference/customize.html#pyproject-toml

@AA-Turner AA-Turner merged commit be9b934 into sphinx-doc:master Apr 9, 2024
7 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2024
@AA-Turner AA-Turner added this to the 7.3.0 milestone Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants