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

Rules F841 cause autofix error #7094

Closed
qarmin opened this issue Sep 3, 2023 · 0 comments · Fixed by #7110
Closed

Rules F841 cause autofix error #7094

qarmin opened this issue Sep 3, 2023 · 0 comments · Fixed by #7110
Assignees
Labels
bug Something isn't working fuzzer Surfaced via fuzzing.

Comments

@qarmin
Copy link

qarmin commented Sep 3, 2023

Ruff 0.0.287 (latest changes from main branch)

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

file content(at least simple cpython script shows that this is valid python file):

gitm_varnames = {'Argon Mixing Ratio': ['r_Ar', 'linear', ''],
                 'Electron Energy Flux': ['ElectronEnergyFlux', 'exponential',
                                           ''],
                 'Total Absolute EUV': ['TotalAbsoluteEUV', 'linear',
                                           'K per timestep'],
              'AltIntNOCooling (W/m2)': 'linear'}
def _read(varlist, attrs, newfile=True):
    '''
    '''
    if len(rawRecLen) < 4:
        var.append(unpack(endChar+'%is' % (recLen), f.read(recLen))[0])
    attrs['time'] = datetime(yy, mm, dd, hh, mn, ss, ms).replace(
        tzinfo=timezone.utc).isoformat(sep=' ')
    (oldLen) = unpack(endChar+'l', f.read(4))

error

/home/rafal/test/tmp_folder/6735003.py:14:6: F841 Local variable `oldLen` is assigned to but never used
Found 1 error.

error: Autofix introduced a syntax error. Reverting all changes.

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

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

...quoting the contents of `/home/rafal/test/tmp_folder/6735003.py`, the rule codes F841, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!


python_compressed.zip

@zanieb zanieb added the fuzzer Surfaced via fuzzing. label Sep 3, 2023
@charliermarsh charliermarsh self-assigned this Sep 3, 2023
@charliermarsh charliermarsh added the bug Something isn't working label Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fuzzer Surfaced via fuzzing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants