mirror of https://github.com/scrapy/scrapy.git
Add ruff with basic rules. (#6565)
This commit is contained in:
parent
37be9da4e4
commit
cc146b9df7
|
|
@ -1,4 +1,8 @@
|
|||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.8.1
|
||||
hooks:
|
||||
- id: ruff
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.7.9
|
||||
hooks:
|
||||
|
|
|
|||
|
|
@ -232,4 +232,25 @@ markers = [
|
|||
"requires_botocore: marks tests that need botocore (but not boto3)",
|
||||
"requires_boto3: marks tests that need botocore and boto3",
|
||||
]
|
||||
filterwarnings = []
|
||||
filterwarnings = []
|
||||
|
||||
[tool.ruff.lint]
|
||||
extend-select = [
|
||||
]
|
||||
ignore = [
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
# Exclude files that are meant to provide top-level imports
|
||||
"scrapy/__init__.py" = ["E402"]
|
||||
"scrapy/core/downloader/handlers/http.py" = ["F401"]
|
||||
"scrapy/http/__init__.py" = ["F401"]
|
||||
"scrapy/linkextractors/__init__.py" = ["E402", "F401"]
|
||||
"scrapy/selector/__init__.py" = ["F401"]
|
||||
"scrapy/spiders/__init__.py" = ["E402", "F401"]
|
||||
|
||||
# Issues pending a review:
|
||||
"docs/conf.py" = ["E402"]
|
||||
"scrapy/utils/url.py" = ["F403", "F405"]
|
||||
"tests/CrawlerRunner/change_reactor.py" = ["E402"]
|
||||
"tests/test_loader.py" = ["E741"]
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ def _get_inputs(
|
|||
|
||||
if not dont_click:
|
||||
clickable = _get_clickable(clickdata, form)
|
||||
if clickable and clickable[0] not in formdata and not clickable[0] is None:
|
||||
if clickable and clickable[0] not in formdata and clickable[0] is not None:
|
||||
values.append(clickable)
|
||||
|
||||
formdata_items = formdata.items() if isinstance(formdata, dict) else formdata
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ class FileDownloadCrawlTestCase(TestCase):
|
|||
|
||||
skip_pillow: str | None
|
||||
try:
|
||||
from PIL import Image # noqa: imported just to check for the import error
|
||||
from PIL import Image # noqa: F401
|
||||
except ImportError:
|
||||
skip_pillow = "Missing Python Imaging Library, install https://pypi.org/pypi/Pillow"
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from scrapy.utils.signal import disconnect_all
|
|||
from scrapy.utils.test import get_crawler
|
||||
|
||||
try:
|
||||
from PIL import Image # noqa: imported just to check for the import error
|
||||
from PIL import Image # noqa: F401
|
||||
except ImportError:
|
||||
skip_pillow: str | None = (
|
||||
"Missing Python Imaging Library, install https://pypi.org/pypi/Pillow"
|
||||
|
|
|
|||
Loading…
Reference in New Issue