diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..1018838 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +extend-ignore = E203,E501,E731 \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f785391..960737f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,6 +38,8 @@ jobs: run: poetry run black --check . - name: Check import order run: poetry run isort --check-only . + - name: Check code style + run: poetry run flake8 . test: name: Test runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index ff849ad..c24bb0f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The awesome-pages plugin allows you to customize how your pages show up the navi ## Installation -> **Note:** This package requires Python >=3.8 and MkDocs version 1.0 or higher. +> **Note:** This package requires Python >=3.8.1 and MkDocs version 1.0 or higher. > If you're still on MkDocs 0.17 use [version 1 of this plugin][github-v1]. Install the package with pip: diff --git a/mkdocs_awesome_pages_plugin/tests/e2e/base.py b/mkdocs_awesome_pages_plugin/tests/e2e/base.py index ca42d44..9893052 100644 --- a/mkdocs_awesome_pages_plugin/tests/e2e/base.py +++ b/mkdocs_awesome_pages_plugin/tests/e2e/base.py @@ -1,7 +1,7 @@ import os import tempfile import warnings -from typing import Dict, Iterable, List, Optional, Tuple, TypeVar, Union +from typing import Dict, List, Optional, Tuple, TypeVar, Union from unittest import TestCase import yaml diff --git a/mkdocs_awesome_pages_plugin/tests/navigation/base.py b/mkdocs_awesome_pages_plugin/tests/navigation/base.py index 45e5142..4f54602 100644 --- a/mkdocs_awesome_pages_plugin/tests/navigation/base.py +++ b/mkdocs_awesome_pages_plugin/tests/navigation/base.py @@ -5,11 +5,7 @@ from mkdocs.structure.files import File, Files from mkdocs.structure.nav import Link from mkdocs.structure.nav import Navigation as MkDocsNavigation -from mkdocs.structure.nav import ( - Section, - _add_parent_links, - _add_previous_and_next_links, -) +from mkdocs.structure.nav import Section from mkdocs.structure.pages import Page from ...meta import Meta diff --git a/poetry.lock b/poetry.lock index f4b24ec..ddbca60 100644 --- a/poetry.lock +++ b/poetry.lock @@ -285,6 +285,22 @@ files = [ [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "flake8" +version = "7.0.0" +description = "the modular source code checker: pep8 pyflakes and co" +optional = false +python-versions = ">=3.8.1" +files = [ + {file = "flake8-7.0.0-py2.py3-none-any.whl", hash = "sha256:a6dfbb75e03252917f2473ea9653f7cd799c3064e54d4c8140044c5c065f53c3"}, + {file = "flake8-7.0.0.tar.gz", hash = "sha256:33f96621059e65eec474169085dc92bf26e7b2d47366b70be2f67ab80dc25132"}, +] + +[package.dependencies] +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.11.0,<2.12.0" +pyflakes = ">=3.2.0,<3.3.0" + [[package]] name = "frozenlist" version = "1.3.3" @@ -552,6 +568,17 @@ files = [ {file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"}, ] +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + [[package]] name = "mergedeep" version = "1.3.4" @@ -758,6 +785,28 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "pycodestyle" +version = "2.11.1" +description = "Python style guide checker" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pycodestyle-2.11.1-py2.py3-none-any.whl", hash = "sha256:44fe31000b2d866f2e41841b18528a505fbd7fef9017b04eff4e2648a0fadc67"}, + {file = "pycodestyle-2.11.1.tar.gz", hash = "sha256:41ba0e7afc9752dfb53ced5489e89f8186be00e599e712660695b7a75ff2663f"}, +] + +[[package]] +name = "pyflakes" +version = "3.2.0" +description = "passive checker of Python programs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, + {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, +] + [[package]] name = "pytest" version = "8.1.1" @@ -1054,5 +1103,5 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=4.6)", "pytest-black ( [metadata] lock-version = "2.0" -python-versions = ">=3.8" -content-hash = "2500c3458e52a127a3e3e2b873bfa5f1c70cd06d017dbaa6525e579996fd86c4" +python-versions = ">=3.8.1" +content-hash = "bbb8813e8d492eebe70091a811849f17603f07d22a860857c9032af9326ea047" diff --git a/pyproject.toml b/pyproject.toml index 42d4a0d..b641084 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ exclude = ["mkdocs_awesome_pages_plugin/tests"] awesome-pages = "mkdocs_awesome_pages_plugin.plugin:AwesomePagesPlugin" [tool.poetry.dependencies] -python = ">=3.8" +python = ">=3.8.1" mkdocs = ">=1" wcmatch = ">=7" natsort = ">=8.1.0" @@ -29,6 +29,7 @@ beautifulsoup4 = "^4.12.3" mock-open = "^1.4.0" black = { extras = ["d"], version = "^24.2.0" } isort = "^5.13.2" +flake8 = "^7.0.0" [tool.black] line-length = 120