Skip to content

Commit fee451b

Browse files
authored
flake8-scrapy → scrapy-lint (#63)
1 parent 75a91a4 commit fee451b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+6056
-5552
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- python-version: "3.11"
1919
- python-version: "3.12"
2020
- python-version: "3.13"
21+
- python-version: "3.14.0-rc.1"
2122
steps:
2223
- uses: actions/checkout@v4
2324
- name: Set up Python ${{ matrix.python-version }}
@@ -39,7 +40,8 @@ jobs:
3940
include:
4041
- python-version: "3.9"
4142
toxenv: "mypy"
42-
- toxenv: "twinecheck"
43+
- toxenv: "pylint"
44+
- toxenv: "twine"
4345
- toxenv: "docs"
4446
steps:
4547
- uses: actions/checkout@v4

.pre-commit-config.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@ repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
rev: v0.12.5
44
hooks:
5-
- id: ruff-check
6-
args: [ --fix ]
7-
- id: ruff-format
5+
- id: ruff-check
6+
args: [ --fix ]
7+
- id: ruff-format
88
- repo: https://github.com/pre-commit/pre-commit-hooks
99
rev: v5.0.0
1010
hooks:
11+
- id: end-of-file-fixer
1112
- id: trailing-whitespace
1213
- repo: https://github.com/adamchainz/blacken-docs
1314
rev: 1.19.1
1415
hooks:
1516
- id: blacken-docs
1617
additional_dependencies:
1718
- black==25.1.0
19+
- repo: https://github.com/sphinx-contrib/sphinx-lint
20+
rev: v1.0.0
21+
hooks:
22+
- id: sphinx-lint

.pre-commit-hooks.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- id: scrapy-lint
2+
name: scrapy-lint
3+
entry: scrapy-lint
4+
language: python

CHANGES.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Release notes
55
0.1.0 (unreleased)
66
==================
77

8+
- Switched from being a `flake8 <https://flake8.pycqa.org/en/latest/>`_
9+
plugin to being a standalone tool, to support rules on non-Python files.
10+
811
- Dropped Python 3.8 support, added Python 3.9+ support.
912

1013
- Requires Scrapy 2.0.1+.
@@ -50,11 +53,10 @@ Release notes
5053
| :ref:`scp41`
5154
| :ref:`scp42`
5255
| :ref:`scp43`
53-
| :ref:`scp44`
5456
| :ref:`scp45`
5557
| :ref:`scp46`
5658
57-
- Added `documentation <https://flake8-scrapy.readthedocs.io/en/latest/>`_.
59+
- Added `documentation <https://scrapy-lint.readthedocs.io/en/latest/>`_.
5860

5961
- Improved CI and achieved full test coverage.
6062

@@ -63,4 +65,4 @@ Earlier releases
6365
================
6466

6567
Find the earlier commit history `at GitHub
66-
<https://github.com/scrapy/flake8-scrapy/commits/4be77a75b5a88f58f20b49067afda8e7e7a9bf6d>`_.
68+
<https://github.com/scrapy/scrapy-lint/commits/4be77a75b5a88f58f20b49067afda8e7e7a9bf6d>`_.

README.rst

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,53 @@
1-
=============
2-
flake8-scrapy
3-
=============
1+
===========
2+
scrapy-lint
3+
===========
44

55
|version| |python_version| |ci|
66

7-
.. |version| image:: https://img.shields.io/pypi/v/flake8-scrapy.svg
8-
:target: https://pypi.org/pypi/flake8-scrapy
7+
.. |version| image:: https://img.shields.io/pypi/v/scrapy-lint.svg
8+
:target: https://pypi.org/pypi/scrapy-lint
99
:alt: PyPI version
1010

11-
.. |python_version| image:: https://img.shields.io/pypi/pyversions/flake8-scrapy.svg
12-
:target: https://pypi.org/pypi/flake8-scrapy
11+
.. |python_version| image:: https://img.shields.io/pypi/pyversions/scrapy-lint.svg
12+
:target: https://pypi.org/pypi/scrapy-lint
1313
:alt: Supported Python versions
1414

15-
.. |ci| image:: https://github.com/scrapy/flake8-scrapy/workflows/CI/badge.svg
16-
:target: https://github.com/scrapy/flake8-scrapy/actions?query=workflow%3ACI
15+
.. |ci| image:: https://github.com/scrapy/scrapy-lint/workflows/CI/badge.svg
16+
:target: https://github.com/scrapy/scrapy-lint/actions?query=workflow%3ACI
1717
:alt: CI
1818

19-
.. intro-start
19+
.. readme-start
20+
21+
**scrapy-lint** is a linter for `Scrapy <https://scrapy.org/>`_ projects.
22+
23+
To install::
2024

21-
A Flake8_ plugin to catch common issues in Scrapy projects.
25+
pip install scrapy-lint
2226

23-
.. _Flake8: https://flake8.pycqa.org/en/latest/
27+
To run::
2428

25-
Install::
29+
scrapy-lint
2630

27-
pip install flake8-scrapy
31+
To use with `pre-commit <https://pre-commit.com/>`__, add the following to your
32+
``.pre-commit-config.yaml``:
2833

29-
And run Flake8_::
34+
.. code-block:: yaml
3035
31-
flake8
36+
- repo: https://github.com/scrapy/scrapy-lint
37+
rev: "0.0.2"
38+
hooks:
39+
- id: scrapy-lint
3240
33-
.. intro-end
41+
Can be combined with `ruff <https://docs.astral.sh/ruff/>`_,
42+
`mypy <https://mypy.readthedocs.io/en/stable/>`_,
43+
`pylint <https://pylint.readthedocs.io/en/stable/>`_ and
44+
`flake8-requirements <https://pypi.org/project/flake8-requirements/>`_.
45+
46+
.. readme-end
47+
48+
Documentation
49+
=============
3450

3551
See the documentation_ for more.
3652

37-
.. _documentation: https://flake8-scrapy.readthedocs.io/en/latest/
53+
.. _documentation: https://scrapy-lint.readthedocs.io/en/latest/

docs/changes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.. include:: ../CHANGES.rst
1+
.. include:: ../CHANGES.rst

docs/conf.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
project = "flake8-scrapy"
1+
project = "scrapy-lint"
22
project_copyright = "Valdir Stumm Junior"
33
author = "Valdir Stumm Junior"
44

@@ -12,9 +12,6 @@
1212
html_theme = "sphinx_rtd_theme"
1313
default_dark_mode = False
1414

15-
intersphinx_mapping = {
16-
"flake8": ("https://flake8.pycqa.org/en/latest/", None),
17-
}
1815
scrapy_intersphinx_enable = [
1916
"shub",
2017
"scrapy-zyte-api",

docs/index.rst

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
1-
===========================
2-
flake8-scrapy documentation
3-
===========================
1+
=========================
2+
scrapy-lint documentation
3+
=========================
44

55
.. include:: ../README.rst
6-
:start-after: intro-start
7-
:end-before: intro-end
8-
9-
.. toctree::
10-
:maxdepth: 1
11-
:caption: Configuration
12-
:hidden:
13-
14-
pre-commit
15-
tools
16-
requirements
17-
zyte
18-
options
6+
:start-after: readme-start
7+
:end-before: readme-end
198

209
.. toctree::
2110
:maxdepth: 1
2211
:caption: Reference
2312
:hidden:
2413

2514
rules/index
26-
changes
15+
options
16+
changes

docs/options.rst

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,73 @@
44
Options
55
=======
66

7-
This is a list of options of flake8-scrapy.
7+
Options that you can set in ``pyproject.toml``, under ``[tool.scrapy-lint]``.
88

9-
See :ref:`configuration` for information on how to configure these options,
10-
disable rules, etc.
9+
.. _ignore:
1110

12-
.. _scrapy-known-settings:
11+
ignore
12+
======
1313

14-
scrapy_known_settings
15-
=====================
14+
:ref:`rules` to ignore for all files.
1615

17-
A comma-separated list of additional setting names to treat as known (i.e. not
18-
trigger :ref:`SCP27`):
16+
For example:
1917

20-
.. code-block:: ini
18+
.. code-block:: toml
2119
22-
[flake8]
23-
scrapy_known_settings = FOO,BAR,MY_CUSTOM_SETTING
20+
[tool.scrapy-lint]
21+
ignore = ["SCP46"]
2422
25-
Use this to silence false positives for custom or project-specific settings.
2623
24+
.. _known-settings:
2725

28-
.. _scrapy-requirements-file:
26+
known-settings
27+
==============
2928

30-
scrapy_requirements_file
31-
========================
29+
Setting names that must not trigger :ref:`SCP27`.
30+
31+
For example:
32+
33+
.. code-block:: toml
34+
35+
[tool.scrapy-lint]
36+
known-settings = [
37+
"FOO",
38+
"BAR",
39+
]
40+
41+
42+
.. _per-file-ignores:
43+
44+
per-file-ignores
45+
================
46+
47+
:ref:`rules` to ignore for specific files.
48+
49+
For example:
50+
51+
.. code-block:: toml
52+
53+
[tool.scrapy-lint.per-file-ignores]
54+
"spiders/toscrape_com.py" = ["SCP46"]
55+
56+
57+
.. _requirements-file:
58+
59+
requirements-file
60+
=================
3261

3362
The path to the requirements file of the Scrapy project:
3463

35-
.. code-block:: ini
64+
.. code-block:: toml
65+
66+
[tool.scrapy-lint]
67+
requirements-file = "path/to/my-requirements.txt"
68+
69+
If not specified, a requirements file is looked up as follows:
3670

37-
[flake8]
38-
scrapy_requirements_file = path/to/my-requirements.txt
71+
#. The requirements file specified in ``scrapinghub.yml`` if such file exists
72+
and contains a root ``requirements`` key with a ``file`` value pointing to
73+
an existing file (path interpreted relative to the project root).
3974

40-
Only necessary if the :ref:`default lookup <requirements>` does not find the
41-
right file.
75+
#. The ``requirements.txt`` file in the project root directory, i.e. where
76+
``scrapy.cfg`` lives.

docs/pre-commit.rst

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)