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

cannot create an xml report #1709

Closed
gocarlos opened this issue Dec 11, 2023 · 9 comments
Closed

cannot create an xml report #1709

gocarlos opened this issue Dec 11, 2023 · 9 comments
Labels
bug Something isn't working fixed xml

Comments

@gocarlos
Copy link

gocarlos commented Dec 11, 2023

Describe the bug

I create the coverage of some tests by calling the coverage API according to the documentation, then pytest.main(... etc according to the documentation

import coverage

# running the application under `/my` but my plugin code is under `my_envs/my_model`
cov = coverage.Coverage(
            source=['/my_envs/my_model'],
            messages=True
)
cov.start()

pytest.main(...)

cov.stop()
cov.save()

# works
cov.report()

# works
cov.html_report()

# ERROR: does not work
cov.xml_report(outfile="coverage.xml")

The html report works perfectly, the stdout terminal also works...

the xml_report crashes, then tried the terminal way: coverage xml -o coverage.xml to convert the existing .coverage file to xml, same issue as with the function xml_report:

Traceback (most recent call last):
  File "/home/my_user/.local/bin/coverage", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/my_user/.local/lib/python3.11/site-packages/coverage/cmdline.py", line 973, in main        
    status = CoverageScript().command_line(argv)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my_user/.local/lib/python3.11/site-packages/coverage/cmdline.py", line 733, in command_line
    total = self.coverage.xml_report(
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my_user/.local/lib/python3.11/site-packages/coverage/control.py", line 1215, in xml_report 
    return render_report(self.config.xml_output, XmlReporter(self), morfs, self._message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my_user/.local/lib/python3.11/site-packages/coverage/report_core.py", line 61, in render_report
    ret = reporter.report(morfs, outfile=outfile)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my_user/.local/lib/python3.11/site-packages/coverage/xmlreport.py", line 130, in report
    for _, class_elt in human_sorted_items(pkg_data.elements.items()):
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/my_user/.local/lib/python3.11/site-packages/coverage/misc.py", line 377, in human_sorted_items
    return sorted(items, key=lambda item: (_human_key(item[0]), *item[1:]), reverse=reverse)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'Element' and 'Element'

To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:

  1. What version of Python are you using?
    3.11.6
  2. What version of coverage.py shows the problem? The output of coverage debug sys is helpful.
-- sys -------------------------------------------------------
coverage_version: 7.3.2
coverage_module: /home/my_user/.local/lib/python3.11/site-packages/coverage/__init__.py
         tracer: -none-
        CTracer: available
plugins.file_tracers: -none-
plugins.configurers: -none-
plugins.context_switchers: -none-
configs_attempted: .coveragerc
                 setup.cfg
                 tox.ini
                 pyproject.toml
   configs_read: -none-
    config_file: None
config_contents: -none-
      data_file: -none-
         python: 3.11.6 (main, Nov 29 2023, 04:47:02) [GCC 10.2.1 20210110]
       platform: Linux-6.1.0-13-amd64-x86_64-with-glibc2.31
 implementation: CPython
     executable: /usr/local/bin/python
   def_encoding: utf-8
    fs_encoding: utf-8
            pid: 174
            cwd: /my
           path: /home/my_user/.local/bin
                 /usr/local/lib/python311.zip
                 /usr/local/lib/python3.11
                 /usr/local/lib/python3.11/lib-dynload
                 /home/my_user/.local/lib/python3.11/site-packages
                 /usr/local/lib/python3.11/site-packages
    environment: HOME = /home/my_user
                 PYTHON_GET_PIP_SHA256 = 9cc01665956d22b3bf057ae8287b035827bfd895da235bcea200ab3b811790b6
                 PYTHON_GET_PIP_URL = https://github.com/pypa/get-pip/raw/4cfa4081d27285bda1220a62a5ebf5b4bd749cdb/public/get-pip.py
                 PYTHON_PIP_VERSION = 23.2.1
                 PYTHON_SETUPTOOLS_VERSION = 65.5.1
                 PYTHON_VERSION = 3.11.6
   command_line: /home/my_user/.local/bin/coverage debug sys
sqlite3_sqlite_version: 3.34.1
sqlite3_temp_store: 0
sqlite3_compile_options: COMPILER=gcc-10.2.1 20210110, ENABLE_COLUMN_METADATA, ENABLE_DBSTAT_VTAB,
                 ENABLE_FTS3, ENABLE_FTS3_PARENTHESIS, ENABLE_FTS3_TOKENIZER, ENABLE_FTS4,
                 ENABLE_FTS5, ENABLE_JSON1, ENABLE_LOAD_EXTENSION, ENABLE_PREUPDATE_HOOK,
                 ENABLE_RTREE, ENABLE_SESSION, ENABLE_STMTVTAB, ENABLE_UNLOCK_NOTIFY,
                 ENABLE_UPDATE_DELETE_LIMIT, HAVE_ISNAN, LIKE_DOESNT_MATCH_BLOBS,
                 MAX_SCHEMA_RETRY=25, MAX_VARIABLE_NUMBER=250000, OMIT_LOOKASIDE,
                 SECURE_DELETE, SOUNDEX, TEMP_STORE=1, THREADSAFE=1, USE_URI

  1. What versions of what packages do you have installed? The output of pip freeze is helpful.
annotated-types==0.6.0
anyio==4.1.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
asgiref==3.7.2
astroid==3.0.1
attrs==23.1.0
Babel==2.13.1
bcrypt==4.1.1
Cerberus==1.3.5
certifi==2023.11.17
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
contextlib2==21.6.0
coverage==7.3.2
cryptography==41.0.7
cx-Oracle==8.3.0
dill==0.3.7
distlib==0.3.7
Django==4.2.7
djangorestframework==3.14.0
djangorestframework-simplejwt==5.3.0
docopt==0.6.2
drf-spectacular==0.26.5
environs==9.5.0
et-xmlfile==1.1.0
ghp-import==2.1.0
gitdb==4.0.11
GitPython==3.1.40
graphviz==0.20.1
gunicorn==21.2.0
h11==0.14.0
httpcore==1.0.2
httpx==0.25.2
idna==3.6
inflection==0.5.1
iniconfig==2.0.0
isodate==0.6.1
isort==5.13.0
jedi==0.19.1
Jinja2==3.1.2
jsonschema==4.20.0
jsonschema-specifications==2023.11.1
lxml==4.9.3
Markdown==3.5.1
MarkupSafe==2.1.3
marshmallow==3.20.1
mccabe==0.7.0
mergedeep==1.3.4
minio==7.2.0
mkdocs==1.5.3
mkdocs-material==9.4.11
mkdocs-material-extensions==1.3.1
mkdocs-render-swagger-plugin==0.1.1
mssql-django==1.3
openpyxl==3.1.2
outcome==1.3.0.post0
packaging==23.2
page-objects==1.1.0
paginate==0.5.6
paramiko==3.3.1
parso==0.8.3
pathspec==0.11.2
pem==23.1.0
pep517==0.13.1
Pillow==10.1.0
pip-api==0.0.30
pipreqs==0.4.13
platformdirs==4.0.0
plette==0.4.4
pluggy==1.3.0
psutil==5.9.6
psycopg2==2.9.9
py-markdown-table==0.4.0
pyasn1==0.5.1
pycparser==2.21
pycryptodome==3.19.0
pydantic==2.5.2
pydantic_core==2.14.5
pygit2==1.13.3
Pygments==2.17.2
PyJWT==2.8.0
pylint==3.0.2
pymdown-extensions==10.5
PyNaCl==1.5.0
pyodbc==5.0.1
pysftp==0.2.9
pysmb==1.2.9.1
PySocks==1.7.1
pytest==7.4.3
pytest-cov==4.1.0
python-box==7.1.1
python-dateutil==2.8.2
python-dotenv==1.0.0
pytz==2023.3.post1
PyYAML==6.0.1
pyyaml_env_tag==0.1
referencing==0.31.0
regex==2023.10.3
reportlab==4.0.7
requests==2.31.0
requests-file==1.5.1
requests-toolbelt==1.0.0
requirementslib==3.0.0
rpds-py==0.13.1
schema==0.7.5
selenium==4.16.0
setproctitle==1.3.3
sh==2.0.6
six==1.16.0
smmap==5.0.1
sniffio==1.3.0
sortedcontainers==2.4.0
sqlparse==0.4.4
tomlkit==0.12.3
tqdm==4.66.1
trio==0.23.1
trio-websocket==0.11.1
typing_extensions==4.9.0
uritemplate==4.1.1
urllib3==2.1.0
validators==0.22.0
watchdog==3.0.0
webcolors==1.13
whitenoise==6.6.0
wsproto==1.2.0
xlrd==2.0.1
yarg==0.1.9
zeep==4.2.1
  1. What code shows the problem? Give us a specific commit of a specific repo that we can check out. If you've already worked around the problem, please provide a commit before that fix.

its clients code, that I can't share

Expected behavior
the coverage.xml file exists, no errors

@gocarlos gocarlos added bug Something isn't working needs triage labels Dec 11, 2023
@gocarlos
Copy link
Author

copied the .coverage file as well as the source code from a kubernetes pod to a windows machine and executed there again coverage xml -o coverage.xml on the same folder as the .coverage file -> same error

@nedbat
Copy link
Owner

nedbat commented Dec 11, 2023

It looks like you have two different files which are reported at the same location. For example, two files both known as module/code.py. Do you have multiple source settings? Can you provide me with the .coverage file, or the output of coverage debug data?

@nedbat
Copy link
Owner

nedbat commented Dec 11, 2023

No, sorry, you have files with numbers in their names, and some have leading zeros, like two files: x1y.py and x01y.py, is that correct?

@nedbat
Copy link
Owner

nedbat commented Dec 12, 2023

Fixed in commit be28121

@gocarlos
Copy link
Author

No, sorry, you have files with numbers in their names, and some have leading zeros, like two files: x1y.py and x01y.py, is that correct?

yes, we have a lot of files like gk_npool_01.py or VEF06_PK_D.py

@gocarlos
Copy link
Author

Fixed in commit be28121

just tested locally with the .coverage file and it works as expected!
thank you very much for the fast feedback and response

could I ask to create a trigger patch release with this fix in it?

thank you

@nedbat
Copy link
Owner

nedbat commented Dec 12, 2023

There will be a release soon.

@nedbat
Copy link
Owner

nedbat commented Dec 14, 2023

This is now released as part of coverage 7.3.3.

@gocarlos
Copy link
Author

@nedbat thank you very much 🍰

renovate bot referenced this issue in allenporter/flux-local Dec 16, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [coverage](https://togithub.com/nedbat/coveragepy) | `==7.3.2` ->
`==7.3.3` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/coverage/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/coverage/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/coverage/7.3.2/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/coverage/7.3.2/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>nedbat/coveragepy (coverage)</summary>

###
[`v7.3.3`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-733--2023-12-14)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.3.2...7.3.3)

- Fix: function definitions with multi-line signatures can now be
excluded by
matching any of the lines, closing `issue 684`*. Thanks, `Jan Rusak,
    Maciej Kowalczyk and Joanna Ejzel <pull 1705_>`*.

- Fix: XML reports could fail with a TypeError if files had numeric
components
    that were duplicates except for leading zeroes, like `file1.py` and
    `file001.py`.  Fixes `issue 1709`\_.

- The `coverage annotate` command used to announce that it would be
removed
in a future version. Enough people got in touch to say that they use it,
so
it will stay. Don't expect it to keep up with other new features though.

-   Added new :ref:`debug options <cmd_run_debug>`:

    -   `pytest` writes the pytest test name into the debug output.

- `dataop2` writes the full data being added to CoverageData objects.

.. \_issue
684:[https://github.com/nedbat/coveragepy/issues/684](https://togithub.com/nedbat/coveragepy/issues/684)4
.. \_pull
1705[https://github.com/nedbat/coveragepy/pull/1705](https://togithub.com/nedbat/coveragepy/pull/1705)05
.. \_issue
170[https://github.com/nedbat/coveragepy/issues/1709](https://togithub.com/nedbat/coveragepy/issues/1709)709

.. \_changes\_7-3-2:

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy45My4xIiwidXBkYXRlZEluVmVyIjoiMzcuOTMuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
lengau referenced this issue in canonical/craftcraft Dec 19, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [dev/coverage](https://togithub.com/nedbat/coveragepy) | `==7.3.2` ->
`==7.3.3` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/dev%2fcoverage/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/dev%2fcoverage/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/dev%2fcoverage/7.3.2/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/dev%2fcoverage/7.3.2/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [lint/black](https://togithub.com/psf/black)
([changelog](https://togithub.com/psf/black/blob/main/CHANGES.md)) |
`==23.11.0` -> `==23.12.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/lint%2fblack/23.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/lint%2fblack/23.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/lint%2fblack/23.11.0/23.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/lint%2fblack/23.11.0/23.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [lint/ruff](https://docs.astral.sh/ruff)
([source](https://togithub.com/astral-sh/ruff),
[changelog](https://togithub.com/astral-sh/ruff/blob/main/CHANGELOG.md))
| `==0.1.6` -> `==0.1.8` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/lint%2fruff/0.1.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/lint%2fruff/0.1.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/lint%2fruff/0.1.6/0.1.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/lint%2fruff/0.1.6/0.1.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [types/pyright](https://togithub.com/RobertCraigie/pyright-python) |
`==1.1.338` -> `==1.1.341` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/types%2fpyright/1.1.341?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/types%2fpyright/1.1.341?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/types%2fpyright/1.1.338/1.1.341?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/types%2fpyright/1.1.338/1.1.341?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>nedbat/coveragepy (dev/coverage)</summary>

###
[`v7.3.3`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-733--2023-12-14)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.3.2...7.3.3)

- Fix: function definitions with multi-line signatures can now be
excluded by
matching any of the lines, closing `issue 684`*. Thanks, `Jan Rusak,
    Maciej Kowalczyk and Joanna Ejzel <pull 1705_>`*.

- Fix: XML reports could fail with a TypeError if files had numeric
components
    that were duplicates except for leading zeroes, like `file1.py` and
    `file001.py`.  Fixes `issue 1709`\_.

- The `coverage annotate` command used to announce that it would be
removed
in a future version. Enough people got in touch to say that they use it,
so
it will stay. Don't expect it to keep up with other new features though.

-   Added new :ref:`debug options <cmd_run_debug>`:

    -   `pytest` writes the pytest test name into the debug output.

- `dataop2` writes the full data being added to CoverageData objects.

.. \_issue
684:[https://github.com/nedbat/coveragepy/issues/684](https://togithub.com/nedbat/coveragepy/issues/684)4
.. \_pull
1705[https://github.com/nedbat/coveragepy/pull/1705](https://togithub.com/nedbat/coveragepy/pull/1705)05
.. \_issue
170[https://github.com/nedbat/coveragepy/issues/1709](https://togithub.com/nedbat/coveragepy/issues/1709)709

.. \_changes\_7-3-2:

</details>

<details>
<summary>psf/black (lint/black)</summary>

###
[`v23.12.0`](https://togithub.com/psf/black/blob/HEAD/CHANGES.md#23120)

[Compare
Source](https://togithub.com/psf/black/compare/23.11.0...23.12.0)

##### Highlights

It's almost 2024, which means it's time for a new edition of *Black*'s
stable style!
Together with this release, we'll put out an alpha release 24.1a1
showcasing the draft
2024 stable style, which we'll finalize in the January release. Please
try it out and
[share your feedback](https://togithub.com/psf/black/issues/4042).

This release (23.12.0) will still produce the 2023 style. Most but not
all of the
changes in `--preview` mode will be in the 2024 stable style.

##### Stable style

- Fix bug where `# fmt: off` automatically dedents when used with the
`--line-ranges`
option, even when it is not within the specified line range.
([#&#8203;4084](https://togithub.com/psf/black/issues/4084))
- Fix feature detection for parenthesized context managers
([#&#8203;4104](https://togithub.com/psf/black/issues/4104))

##### Preview style

- Prefer more equal signs before a break when splitting chained
assignments ([#&#8203;4010](https://togithub.com/psf/black/issues/4010))
- Standalone form feed characters at the module level are no longer
removed ([#&#8203;4021](https://togithub.com/psf/black/issues/4021))
- Additional cases of immediately nested tuples, lists, and dictionaries
are now
indented less
([#&#8203;4012](https://togithub.com/psf/black/issues/4012))
- Allow empty lines at the beginning of all blocks, except immediately
before a
docstring ([#&#8203;4060](https://togithub.com/psf/black/issues/4060))
- Fix crash in preview mode when using a short `--line-length`
([#&#8203;4086](https://togithub.com/psf/black/issues/4086))
- Keep suites consisting of only an ellipsis on their own lines if they
are not
functions or class definitions
([#&#8203;4066](https://togithub.com/psf/black/issues/4066))
([#&#8203;4103](https://togithub.com/psf/black/issues/4103))

##### Configuration

- `--line-ranges` now skips *Black*'s internal stability check in
`--safe` mode. This
avoids a crash on rare inputs that have many unformatted same-content
lines. ([#&#8203;4034](https://togithub.com/psf/black/issues/4034))

##### Packaging

- Upgrade to mypy 1.7.1
([#&#8203;4049](https://togithub.com/psf/black/issues/4049))
([#&#8203;4069](https://togithub.com/psf/black/issues/4069))
- Faster compiled wheels are now available for CPython 3.12
([#&#8203;4070](https://togithub.com/psf/black/issues/4070))

##### Integrations

- Enable 3.12 CI
([#&#8203;4035](https://togithub.com/psf/black/issues/4035))
- Build docker images in parallel
([#&#8203;4054](https://togithub.com/psf/black/issues/4054))
- Build docker images with 3.12
([#&#8203;4055](https://togithub.com/psf/black/issues/4055))

</details>

<details>
<summary>astral-sh/ruff (lint/ruff)</summary>

###
[`v0.1.8`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#018)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.1.7...v0.1.8)

This release includes opt-in support for formatting Python snippets
within
docstrings via the `docstring-code-format` setting.
[Check out the blog post](https://astral.sh/blog/ruff-v0.1.8) for more
details!

##### Preview features

- Add `"preserve"` quote-style to mimic Black's
skip-string-normalization
([#&#8203;8822](https://togithub.com/astral-sh/ruff/pull/8822))
- Implement `prefer_splitting_right_hand_side_of_assignments` preview
style ([#&#8203;8943](https://togithub.com/astral-sh/ruff/pull/8943))
- \[`pycodestyle`] Add fix for
`unexpected-spaces-around-keyword-parameter-equals`
([#&#8203;9072](https://togithub.com/astral-sh/ruff/pull/9072))
- \[`pycodestyle`] Add fix for comment-related whitespace rules
([#&#8203;9075](https://togithub.com/astral-sh/ruff/pull/9075))
- \[`pycodestyle`] Allow `sys.path` modifications between imports
([#&#8203;9047](https://togithub.com/astral-sh/ruff/pull/9047))
- \[`refurb`] Implement `hashlib-digest-hex` (`FURB181`)
([#&#8203;9077](https://togithub.com/astral-sh/ruff/pull/9077))

##### Rule changes

- Allow `flake8-type-checking` rules to automatically quote
runtime-evaluated references
([#&#8203;6001](https://togithub.com/astral-sh/ruff/pull/6001))
- Allow transparent cell magics in Jupyter Notebooks
([#&#8203;8911](https://togithub.com/astral-sh/ruff/pull/8911))
- \[`flake8-annotations`] Avoid `ANN2xx` fixes for abstract methods with
empty bodies
([#&#8203;9034](https://togithub.com/astral-sh/ruff/pull/9034))
- \[`flake8-self`] Ignore underscore references in type annotations
([#&#8203;9036](https://togithub.com/astral-sh/ruff/pull/9036))
- \[`pep8-naming`] Allow class names when `apps.get_model` is a
non-string
([#&#8203;9065](https://togithub.com/astral-sh/ruff/pull/9065))
- \[`pycodestyle`] Allow `matplotlib.use` calls to intersperse imports
([#&#8203;9094](https://togithub.com/astral-sh/ruff/pull/9094))
- \[`pyflakes`] Support fixing unused assignments in tuples by renaming
variables (`F841`)
([#&#8203;9107](https://togithub.com/astral-sh/ruff/pull/9107))
- \[`pylint`] Add fix for `subprocess-run-without-check` (`PLW1510`)
([#&#8203;6708](https://togithub.com/astral-sh/ruff/pull/6708))

##### Formatter

- Add `docstring-code-format` knob to enable docstring snippet
formatting
([#&#8203;8854](https://togithub.com/astral-sh/ruff/pull/8854))
- Use double quotes for all docstrings, including single-quoted
docstrings
([#&#8203;9020](https://togithub.com/astral-sh/ruff/pull/9020))
- Implement "dynamic" line width mode for docstring code formatting
([#&#8203;9098](https://togithub.com/astral-sh/ruff/pull/9098))
- Support reformatting Markdown code blocks
([#&#8203;9030](https://togithub.com/astral-sh/ruff/pull/9030))
- add support for formatting reStructuredText code snippets
([#&#8203;9003](https://togithub.com/astral-sh/ruff/pull/9003))
- Avoid trailing comma for single-argument with positional separator
([#&#8203;9076](https://togithub.com/astral-sh/ruff/pull/9076))
- Fix handling of trailing target comment
([#&#8203;9051](https://togithub.com/astral-sh/ruff/pull/9051))

##### CLI

- Hide unsafe fix suggestions when explicitly disabled
([#&#8203;9095](https://togithub.com/astral-sh/ruff/pull/9095))
- Add SARIF support to `--output-format`
([#&#8203;9078](https://togithub.com/astral-sh/ruff/pull/9078))

##### Bug fixes

- Apply unnecessary index rule prior to enumerate rewrite
([#&#8203;9012](https://togithub.com/astral-sh/ruff/pull/9012))
- \[`flake8-err-msg`] Allow `EM` fixes even if `msg` variable is defined
([#&#8203;9059](https://togithub.com/astral-sh/ruff/pull/9059))
- \[`flake8-pie`] Prevent keyword arguments duplication
([#&#8203;8450](https://togithub.com/astral-sh/ruff/pull/8450))
- \[`flake8-pie`] Respect trailing comma in `unnecessary-dict-kwargs`
(`PIE804`)
([#&#8203;9015](https://togithub.com/astral-sh/ruff/pull/9015))
- \[`flake8-raise`] Avoid removing parentheses on ctypes.WinError
([#&#8203;9027](https://togithub.com/astral-sh/ruff/pull/9027))
- \[`isort`] Avoid invalid combination of `force-sort-within-types` and
`lines-between-types`
([#&#8203;9041](https://togithub.com/astral-sh/ruff/pull/9041))
- \[`isort`] Ensure that from-style imports are always ordered first in
`__future__`
([#&#8203;9039](https://togithub.com/astral-sh/ruff/pull/9039))
- \[`pycodestyle`] Allow tab indentation before keyword
([#&#8203;9099](https://togithub.com/astral-sh/ruff/pull/9099))
- \[`pylint`] Ignore `@overrides` and `@overloads` for
`too-many-positional`
([#&#8203;9000](https://togithub.com/astral-sh/ruff/pull/9000))
- \[`pyupgrade`] Enable `printf-string-formatting` fix with comments on
right-hand side
([#&#8203;9037](https://togithub.com/astral-sh/ruff/pull/9037))
- \[`refurb`] Make `math-constant` (`FURB152`) rule more targeted
([#&#8203;9054](https://togithub.com/astral-sh/ruff/pull/9054))
- \[`refurb`] Support floating-point base in `redundant-log-base`
(`FURB163`)
([#&#8203;9100](https://togithub.com/astral-sh/ruff/pull/9100))
- \[`ruff`] Detect `unused-asyncio-dangling-task` (`RUF006`) on unused
assignments
([#&#8203;9060](https://togithub.com/astral-sh/ruff/pull/9060))

###
[`v0.1.7`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#017)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.1.6...v0.1.7)

##### Preview features

- Implement multiline dictionary and list hugging for preview style
([#&#8203;8293](https://togithub.com/astral-sh/ruff/pull/8293))
- Implement the `fix_power_op_line_length` preview style
([#&#8203;8947](https://togithub.com/astral-sh/ruff/pull/8947))
- Use Python version to determine typing rewrite safety
([#&#8203;8919](https://togithub.com/astral-sh/ruff/pull/8919))
- \[`flake8-annotations`] Enable auto-return-type involving `Optional`
and `Union` annotations
([#&#8203;8885](https://togithub.com/astral-sh/ruff/pull/8885))
- \[`flake8-bandit`] Implement `django-raw-sql` (`S611`)
([#&#8203;8651](https://togithub.com/astral-sh/ruff/pull/8651))
- \[`flake8-bandit`] Implement `tarfile-unsafe-members` (`S202`)
([#&#8203;8829](https://togithub.com/astral-sh/ruff/pull/8829))
- \[`flake8-pyi`] Implement fix for `unnecessary-literal-union`
(`PYI030`)
([#&#8203;7934](https://togithub.com/astral-sh/ruff/pull/7934))
- \[`flake8-simplify`] Extend `dict-get-with-none-default` (`SIM910`) to
non-literals
([#&#8203;8762](https://togithub.com/astral-sh/ruff/pull/8762))
- \[`pylint`] - add `unnecessary-list-index-lookup` (`PLR1736`) +
autofix ([#&#8203;7999](https://togithub.com/astral-sh/ruff/pull/7999))
- \[`pylint`] - implement R0202 and R0203 with autofixes
([#&#8203;8335](https://togithub.com/astral-sh/ruff/pull/8335))
- \[`pylint`] Implement `repeated-keyword` (`PLe1132`)
([#&#8203;8706](https://togithub.com/astral-sh/ruff/pull/8706))
- \[`pylint`] Implement `too-many-positional` (`PLR0917`)
([#&#8203;8995](https://togithub.com/astral-sh/ruff/pull/8995))
- \[`pylint`] Implement `unnecessary-dict-index-lookup` (`PLR1733`)
([#&#8203;8036](https://togithub.com/astral-sh/ruff/pull/8036))
- \[`refurb`] Implement `redundant-log-base` (`FURB163`)
([#&#8203;8842](https://togithub.com/astral-sh/ruff/pull/8842))

##### Rule changes

- \[`flake8-boolean-trap`] Allow booleans in `@override` methods
([#&#8203;8882](https://togithub.com/astral-sh/ruff/pull/8882))
- \[`flake8-bugbear`] Avoid `B015`,`B018` for last expression in a cell
([#&#8203;8815](https://togithub.com/astral-sh/ruff/pull/8815))
- \[`flake8-pie`] Allow ellipses for enum values in stub files
([#&#8203;8825](https://togithub.com/astral-sh/ruff/pull/8825))
- \[`flake8-pyi`] Check PEP 695 type aliases for `snake-case-type-alias`
and `t-suffixed-type-alias`
([#&#8203;8966](https://togithub.com/astral-sh/ruff/pull/8966))
- \[`flake8-pyi`] Check for kwarg and vararg `NoReturn` type annotations
([#&#8203;8948](https://togithub.com/astral-sh/ruff/pull/8948))
- \[`flake8-simplify`] Omit select context managers from `SIM117`
([#&#8203;8801](https://togithub.com/astral-sh/ruff/pull/8801))
- \[`pep8-naming`] Allow Django model loads in
`non-lowercase-variable-in-function` (`N806`)
([#&#8203;8917](https://togithub.com/astral-sh/ruff/pull/8917))
- \[`pycodestyle`] Avoid `E703` for last expression in a cell
([#&#8203;8821](https://togithub.com/astral-sh/ruff/pull/8821))
- \[`pycodestyle`] Update `E402` to work at cell level for notebooks
([#&#8203;8872](https://togithub.com/astral-sh/ruff/pull/8872))
- \[`pydocstyle`] Avoid `D100` for Jupyter Notebooks
([#&#8203;8816](https://togithub.com/astral-sh/ruff/pull/8816))
- \[`pylint`] Implement fix for `unspecified-encoding` (`PLW1514`)
([#&#8203;8928](https://togithub.com/astral-sh/ruff/pull/8928))

##### Formatter

- Avoid unstable formatting in ellipsis-only body with trailing comment
([#&#8203;8984](https://togithub.com/astral-sh/ruff/pull/8984))
- Inline trailing comments for type alias similar to assignments
([#&#8203;8941](https://togithub.com/astral-sh/ruff/pull/8941))
- Insert trailing comma when function breaks with single argument
([#&#8203;8921](https://togithub.com/astral-sh/ruff/pull/8921))

##### CLI

- Update `ruff check` and `ruff format` to default to the current
directory
([#&#8203;8791](https://togithub.com/astral-sh/ruff/pull/8791))
- Stop at the first resolved parent configuration
([#&#8203;8864](https://togithub.com/astral-sh/ruff/pull/8864))

##### Configuration

- \[`pylint`] Default `max-positional-args` to `max-args`
([#&#8203;8998](https://togithub.com/astral-sh/ruff/pull/8998))
- \[`pylint`] Add `allow-dunder-method-names` setting for
`bad-dunder-method-name` (`PLW3201`)
([#&#8203;8812](https://togithub.com/astral-sh/ruff/pull/8812))
- \[`isort`] Add support for `from-first` setting
([#&#8203;8663](https://togithub.com/astral-sh/ruff/pull/8663))
- \[`isort`] Add support for `length-sort` settings
([#&#8203;8841](https://togithub.com/astral-sh/ruff/pull/8841))

##### Bug fixes

- Add support for `@functools.singledispatch`
([#&#8203;8934](https://togithub.com/astral-sh/ruff/pull/8934))
- Avoid off-by-one error in stripping noqa following multi-byte char
([#&#8203;8979](https://togithub.com/astral-sh/ruff/pull/8979))
- Avoid off-by-one error in with-item named expressions
([#&#8203;8915](https://togithub.com/astral-sh/ruff/pull/8915))
- Avoid syntax error via invalid ur string prefix
([#&#8203;8971](https://togithub.com/astral-sh/ruff/pull/8971))
- Avoid underflow in `get_model` matching
([#&#8203;8965](https://togithub.com/astral-sh/ruff/pull/8965))
- Avoid unnecessary index diagnostics when value is modified
([#&#8203;8970](https://togithub.com/astral-sh/ruff/pull/8970))
- Convert over-indentation rule to use number of characters
([#&#8203;8983](https://togithub.com/astral-sh/ruff/pull/8983))
- Detect implicit returns in auto-return-types
([#&#8203;8952](https://togithub.com/astral-sh/ruff/pull/8952))
- Fix start >= end error in over-indentation
([#&#8203;8982](https://togithub.com/astral-sh/ruff/pull/8982))
- Ignore `@overload` and `@override` methods for too-many-arguments
checks ([#&#8203;8954](https://togithub.com/astral-sh/ruff/pull/8954))
- Lexer start of line is false only for `Mode::Expression`
([#&#8203;8880](https://togithub.com/astral-sh/ruff/pull/8880))
- Mark `pydantic_settings.BaseSettings` as having default copy semantics
([#&#8203;8793](https://togithub.com/astral-sh/ruff/pull/8793))
- Respect dictionary unpacking in `NamedTuple` assignments
([#&#8203;8810](https://togithub.com/astral-sh/ruff/pull/8810))
- Respect local subclasses in `flake8-type-checking`
([#&#8203;8768](https://togithub.com/astral-sh/ruff/pull/8768))
- Support type alias statements in simple statement positions
([#&#8203;8916](https://togithub.com/astral-sh/ruff/pull/8916))
- \[`flake8-annotations`] Avoid filtering out un-representable types in
return annotation
([#&#8203;8881](https://togithub.com/astral-sh/ruff/pull/8881))
- \[`flake8-pie`] Retain extra ellipses in protocols and abstract
methods ([#&#8203;8769](https://togithub.com/astral-sh/ruff/pull/8769))
- \[`flake8-pyi`] Respect local enum subclasses in `simple-defaults`
(`PYI052`)
([#&#8203;8767](https://togithub.com/astral-sh/ruff/pull/8767))
- \[`flake8-trio`] Use correct range for `TRIO115` fix
([#&#8203;8933](https://togithub.com/astral-sh/ruff/pull/8933))
- \[`flake8-trio`] Use full arguments range for zero-sleep-call
([#&#8203;8936](https://togithub.com/astral-sh/ruff/pull/8936))
- \[`isort`] fix: mark `__main__` as first-party import
([#&#8203;8805](https://togithub.com/astral-sh/ruff/pull/8805))
- \[`pep8-naming`] Avoid `N806` errors for type alias statements
([#&#8203;8785](https://togithub.com/astral-sh/ruff/pull/8785))
- \[`perflint`] Avoid `PERF101` if there's an append in loop body
([#&#8203;8809](https://togithub.com/astral-sh/ruff/pull/8809))
- \[`pycodestyle`] Allow space-before-colon after end-of-slice
([#&#8203;8838](https://togithub.com/astral-sh/ruff/pull/8838))
- \[`pydocstyle`] Avoid non-character breaks in `over-indentation`
(`D208`) ([#&#8203;8866](https://togithub.com/astral-sh/ruff/pull/8866))
- \[`pydocstyle`] Ignore underlines when determining docstring logical
lines ([#&#8203;8929](https://togithub.com/astral-sh/ruff/pull/8929))
- \[`pylint`] Extend `self-assigning-variable` to multi-target
assignments
([#&#8203;8839](https://togithub.com/astral-sh/ruff/pull/8839))
- \[`tryceratops`] Avoid repeated triggers in nested `tryceratops`
diagnostics
([#&#8203;8772](https://togithub.com/astral-sh/ruff/pull/8772))

##### Documentation

- Add advice for fixing RUF008 when mutability is not desired
([#&#8203;8853](https://togithub.com/astral-sh/ruff/pull/8853))
- Added the command to run ruff using pkgx to the installation.md
([#&#8203;8955](https://togithub.com/astral-sh/ruff/pull/8955))
- Document fix safety for flake8-comprehensions and some pyupgrade rules
([#&#8203;8918](https://togithub.com/astral-sh/ruff/pull/8918))
- Fix doc formatting for zero-sleep-call
([#&#8203;8937](https://togithub.com/astral-sh/ruff/pull/8937))
- Remove duplicate imports from os-stat documentation
([#&#8203;8930](https://togithub.com/astral-sh/ruff/pull/8930))
- Replace generated reference to MkDocs
([#&#8203;8806](https://togithub.com/astral-sh/ruff/pull/8806))
- Update Arch Linux package URL in installation.md
([#&#8203;8802](https://togithub.com/astral-sh/ruff/pull/8802))
- \[`flake8-pyi`] Fix error in `t-suffixed-type-alias` (`PYI043`)
example ([#&#8203;8963](https://togithub.com/astral-sh/ruff/pull/8963))
- \[`flake8-pyi`] Improve motivation for `custom-type-var-return-type`
(`PYI019`)
([#&#8203;8766](https://togithub.com/astral-sh/ruff/pull/8766))

</details>

<details>
<summary>RobertCraigie/pyright-python (types/pyright)</summary>

###
[`v1.1.341`](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.340...v1.1.341)

[Compare
Source](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.340...v1.1.341)

###
[`v1.1.340`](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.339...v1.1.340)

[Compare
Source](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.339...v1.1.340)

###
[`v1.1.339`](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.338...v1.1.339)

[Compare
Source](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.338...v1.1.339)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekend" in timezone Etc/UTC,
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/canonical/craftcraft).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuOTMuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed xml
Projects
None yet
Development

No branches or pull requests

2 participants