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

False positive WPS319 #3055

Open
KulykDmytro opened this issue Sep 20, 2024 · 1 comment
Open

False positive WPS319 #3055

KulykDmytro opened this issue Sep 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@KulykDmytro
Copy link

What's wrong

using of master version causing false-positive WPS319 violation when using multiline strings in conjunction of function (dedent in our case)

def _insert_query(config: AWSTransformTaskGroup) -> str:
    columns = f"{{{{ athena.column_names('{config.database}', '{config.table}', include_partition_keys=True) }}}}"
    return dedent(f"""
        insert into {config.result_database}.{config.result_table} ({columns})
        select {columns} from {config.inc_database}.{config.inc_table}
    """)

Violation log:

  158:8    WPS319 Found bracket in wrong position
  return dedent(f"""
        insert into {config.result_database}.{config.result_table} ({columns})
        select {columns} from {config.inc_database}.{config.inc_table}
    """)
     ^

How it should be

should pass such expressions

Flake8 version and plugins

7.1.1 (darglint: 1.8.1, flake8-bandit: 4.1.1, flake8-broken-line: 1.0.0,
flake8-bugbear: 24.8.19, flake8-commas: 4.0.0, flake8-comprehensions: 3.15.0,
flake8-debugger: 4.1.2, flake8-docstrings: 1.7.0, flake8-eradicate: 1.5.0,
flake8-isort: 6.1.1, flake8-quotes: 3.4.0, flake8-rst-docstrings: 0.3.0,
flake8-string-format: 0.3.0, mccabe: 0.7.0, pep8-naming: 0.14.1, pycodestyle:
2.12.1, pyflakes: 3.2.0, wemake-python-styleguide: 0.19.2) CPython 3.12.0 on
Linux

pip information

pip 24.2 from /usr/local/lib/python3.12/site-packages/pip (python 3.12)

OS information

Alpine Linux v3.17

@KulykDmytro KulykDmytro added the bug Something isn't working label Sep 20, 2024
@sobolevn
Copy link
Member

It should be:

    return dedent(
        f"""
        insert into {config.result_database}.{config.result_table} ({columns})
        select {columns} from {config.inc_database}.{config.inc_table}
        """
    )

Please, try this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants