astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
29.42k stars 957 forks source link

NPY003 cause infinite loop #7077

Closed qarmin closed 11 months ago

qarmin commented 11 months ago

Ruff 0.0.287 (latest changes from main branch)

ruff --fix *.py  --no-cache --select NPY003

file content:

from numpy import alltrue as all
def _split(string, char=','):
        return []
class Sofd(table.Table):
    FILENAME = os.path.join(templates.get_template_dir(),
                    '{ins}', '{wkf}', 'sofd_{ins}_{wkf}_{step}.dat')
    def _complement_dataset(self, dataset, datalog):
                keep = all([sublog[g] == frame0[g] for g in group_by], axis=0)

error:

error: Failed to converge after 100 iterations.

This indicates a bug in `ruff`. If you could open an issue at:

    https://github.com/astral-sh/ruff/issues/new?title=%5BInfinite%20loop%5D

...quoting the contents of `588514.py`, the rule codes NPY003, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

588514.py:8:24: NPY003 `np.alltrue` is deprecated; use `np.all` instead
Found 101 errors (100 fixed, 1 remaining).

588514.py.zip

charliermarsh commented 11 months ago

Haha that's such a brutal one.