From d7f7c10557de795460603ce1d1b9b2c619099221 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Thu, 11 Jan 2024 14:58:57 -0700 Subject: [PATCH] CI: Use ruff for copyright header checking --- ci/linting_requirements.txt | 1 - pyproject.toml | 9 +++++++-- setup.cfg | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ci/linting_requirements.txt b/ci/linting_requirements.txt index 66d56307723..6c1030560cf 100644 --- a/ci/linting_requirements.txt +++ b/ci/linting_requirements.txt @@ -5,7 +5,6 @@ pycodestyle==2.11.1 pyflakes==3.2.0 flake8-continuation==1.0.5 -flake8-copyright==0.2.4 flake8-isort==6.1.1 isort==5.13.2 flake8-requirements==2.0.1 diff --git a/pyproject.toml b/pyproject.toml index a4ffd8fcd80..51e5d5b5fca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -119,7 +119,7 @@ filterwarnings = [ [tool.ruff] line-length = 95 exclude = ["docs", "build", "src/metpy/io/_metar_parser/metar_parser.py"] -select = ["A", "B", "C", "D", "E", "E226", "F", "G", "I", "N", "Q", "R", "S", "T", "U", "W"] +select = ["A", "B", "C", "CPY001", "D", "E", "E226", "F", "G", "I", "N", "Q", "R", "S", "T", "U", "W"] ignore = ["F405", "I001", "RET504", "RET505", "RET506", "RET507", "RUF100"] preview = true explicit-preview-rules = true @@ -129,7 +129,7 @@ explicit-preview-rules = true "docs/doc-server.py" = ["T201"] "examples/*.py" = ["D", "T201", "B018"] "src/metpy/_vendor/xarray.py" = ["UP032"] -"src/metpy/deprecation.py" = ["UP032"] +"src/metpy/deprecation.py" = ["CPY001", "UP032"] "src/metpy/testing.py" = ["S101"] "src/metpy/io/nexrad.py" = ["S101"] "tests/*/*.py" = ["S101"] @@ -139,6 +139,11 @@ explicit-preview-rules = true "tools/nexrad_msgs/parse_spec.py" = ["B028", "S101"] "tutorials/*.py" = ["D", "T201", "B018"] +[tool.ruff.lint.flake8-copyright] +# Needed to add a comma +notice-rgx = "(?i)Copyright\\s+(\\(C\\)\\s+)?\\d{4}([-,]\\d{4})*" +author = "MetPy Developers" + [tool.ruff.lint.flake8-quotes] inline-quotes = "single" multiline-quotes = "double" diff --git a/setup.cfg b/setup.cfg index 1c0956cbc1c..c6ff519fbcd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,11 +10,10 @@ rst-roles = class, data, doc, func, meth, mod rst-directives = plot, versionchanged known-modules = matplotlib:[matplotlib,mpl_toolkits],netcdf4:[netCDF4] exclude = docs build src/metpy/io/_metar_parser/metar_parser.py -select = C E301 E302 E303 E304 E305 E306 I R +select = E301 E302 E303 E304 E305 E306 I R ignore = F405 W503 RST902 SIM106 per-file-ignores = examples/*.py: D MPY001 tutorials/*.py: D MPY001 - src/metpy/deprecation.py: C801 src/metpy/calc/*.py: RST306 src/metpy/interpolate/*.py: RST306 src/metpy/io/*.py: RST306