Open matthiasschaub opened 2 years ago
for context: the following works:
def test():
"""
Request osmcha analysis for changeset ids and update edits table with flags.
All cs ids are passed as a parameter to the api request (in case of a large
number of changesets,they will be split into multiple lists, i.e. this will
result in multiple requests).
The flags of each cs are aggregated and uploaded into the db.
To see possible values of reasons look at osmcha_reasons.md.
:param settings:
:return:
"""
pass
where The flags of each **changeset** are aggregated...
has been changed.
This is also a false positive:
def update_file_list(self) -> None:
"""Update file path list with paths specified on initialization.
Clear the current file list. Then get the file and directory paths specified with
:py:attr:`self.check_paths` attribute set on initialization and search them for rst files
to check. Add those files to the file list.
"""
src/rstcheck/runner.py:66:9: Q440 keyword Update is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword file is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword path is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword with is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword on is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword current is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword file is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword Then is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword get is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword file is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword and is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword directory is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword with is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword set is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword on is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword and is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword search is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword for is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword to is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword Add is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword to is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q440 keyword file is not uppercase [flake8-sql]
src/rstcheck/runner.py:66:9: Q441 name Clear is not valid, must be snake_case, and cannot end with `_` [flake8-sql]
src/rstcheck/runner.py:66:9: Q447 root_keywords Update and and are not right aligned [flake8-sql]
src/rstcheck/runner.py:66:9: Q447 root_keywords Update and set are not right aligned [flake8-sql]
src/rstcheck/runner.py:66:9: Q447 root_keywords Update and and are not right aligned [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token Clear should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token the should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token :py should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token : should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token attr should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token : should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token `self.check_paths` should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token to should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token check should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token . should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token Add should be aligned to the right of the river [flake8-sql]
src/rstcheck/runner.py:66:9: Q449 token those should be aligned to the right of the river [flake8-sql]
I have also encountered this issue. It is due to the regex used to detect query strings. Here are examples of false positive matches with the above docstrings: https://regex101.com/r/gYdthu/2 (see unit tests on the left)
Some ways I can think of to avoid false positives like these for docstrings are:
One simple regex change which could mitigate the problem in the meantime is to enforce that the string must start with whitespace and then an SQL keyword e.g. ^\s*insert...
. Docstrings will still have to avoid starting with 'insert' or 'update' etc.
A minimally less complex regex which avoids some common false positives:
^\s*(select\s.*from\s|delete\s+from\s|insert\s+into\s.*values\s|update\s.*set\s[^=]+=)
If flake8 is run on a file containing following code, errors listed below will get raised
Python version and installed depdencies (venv) are: