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

Rule SIM210 cause autofix error #7076

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

Rule SIM210 cause autofix error #7076

qarmin opened this issue Sep 3, 2023 · 0 comments · Fixed by #7118
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 --fix *.py  --no-cache --select SIM210

file content:

def subresource_integrity(reqs: dict, expectation='sri-implemented-and-external-scripts-loaded-securely') -> dict:
    output = {
    }
    if response.headers.get('Content-Type', '').split(';')[0] not in HTML_TYPES:
        try:
            soup = bs(reqs['resources']['__path__'], 'html.parser')
        except:
            output['result'] = 'html-not-parsable'
        for script in scripts:
                samesld = True if (psl.privatesuffix(urlparse(response.url).netloc) ==
                                   psl.privatesuffix(src.netloc)) else False
                if src.scheme == '':
                    securescheme = True

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 `7675231.py`, the rule codes SIM210, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

7675231.py:10:27: SIM210 Use `bool(psl.privatesuffix(urlparse(response.url).netloc) == psl.privatesuffix(src.netloc))` instead of `True if psl.privatesuffix(urlparse(response.url).netloc) == psl.privatesuffix(src.netloc) else False`
Found 1 error.

7675231.py.zip

@charliermarsh charliermarsh added bug Something isn't working fuzzer Surfaced via fuzzing. labels Sep 3, 2023
@charliermarsh charliermarsh self-assigned this 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.

2 participants