diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 2f2a3c0..0000000 --- a/.flake8 +++ /dev/null @@ -1,12 +0,0 @@ -[flake8] -max-line-length = 100 - -## IGNORES - -# E127: flake8 reporting incorrect continuation line indent errors -# on multi-line and multi-level indents - -# W503, W504: flake8 reports this as incorrect, but black changes -# code to it, so let black win. - -ignore = E127,W503,W504 diff --git a/.github/.markdownlint-cli2.jsonc b/.github/.markdownlint-cli2.jsonc new file mode 100644 index 0000000..e943eed --- /dev/null +++ b/.github/.markdownlint-cli2.jsonc @@ -0,0 +1,5 @@ +{ + "config": { + "MD041": false + } +} \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.MD b/.github/PULL_REQUEST_TEMPLATE.MD index 33f5d3b..ed80fc1 100644 --- a/.github/PULL_REQUEST_TEMPLATE.MD +++ b/.github/PULL_REQUEST_TEMPLATE.MD @@ -8,9 +8,7 @@ Please explain the changes you made here. **PR checklist:** -- [ ] Code is formatted (run `scripts/format`). -- [ ] Code lints properly (run `scripts/lint`). - [ ] Tests pass (run `scripts/test`). - [ ] Documentation has been updated to reflect changes, if applicable. - [ ] Examples have been updated to reflect changes, if applicable -- [ ] Changes are added to the [CHANGELOG](../CHANGELOG.md). +- [ ] Changes are added to the [CHANGELOG](../CHANGELOG.md), if applicable diff --git a/.markdownlintignore b/.markdownlintignore deleted file mode 100644 index f6e07b7..0000000 --- a/.markdownlintignore +++ /dev/null @@ -1 +0,0 @@ -PULL_REQUEST_TEMPLATE.MD diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07df519..f9e7114 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,33 +2,29 @@ # Please run `pre-commit run --all-files` when adding or changing entries. repos: - - repo: https://github.com/psf/black - rev: 23.1.0 + - repo: https://github.com/DavidAnson/markdownlint-cli2 + rev: v0.9.2 hooks: - - id: black + - id: markdownlint-cli2 + language_version: "18.17.1" - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.5 hooks: - id: codespell args: [--ignore-words=.codespellignore] types_or: [jupyter, markdown, python, shell] - - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + - repo: https://github.com/psf/black + rev: 23.9.1 hooks: - - id: flake8 + - id: black - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.0.1 + rev: v1.5.1 hooks: - id: mypy additional_dependencies: - click != 8.1.0 - stactools - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.33.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.288 hooks: - - id: markdownlint - language_version: "18.17.1" + - id: ruff diff --git a/docker/format b/docker/lint similarity index 90% rename from docker/format rename to docker/lint index 3d5bd6f..afd37ad 100755 --- a/docker/format +++ b/docker/lint @@ -16,6 +16,6 @@ Run code formatters in a docker container with all prerequisites installed. if [ "${BASH_SOURCE[0]}" = "${0}" ]; then docker run --rm -it \ -v "$(pwd)":/opt/stactools-ephemeral \ - --entrypoint scripts/format \ + --entrypoint scripts/lint \ stactools-packages/ephemeral:dev fi diff --git a/pyproject.toml b/pyproject.toml index 76ab26a..82070ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,12 +25,11 @@ dependencies = ["stactools>=0.4.0"] dev = [ "black~=23.9", "codespell~=2.2", - "flake8~=6.1", - "isort~=5.12", "mypy~=1.5", "pre-commit~=3.4", - "pytest~=7.4", "pytest-cov~=4.1", + "pytest~=7.4", + "ruff==0.0.288", ] [project.urls] @@ -43,3 +42,6 @@ build-backend = "setuptools.build_meta" [tool.isort] profile = "black" + +[tool.ruff] +select = ["E", "F", "I"] diff --git a/scripts/format b/scripts/format deleted file mode 100755 index baf9730..0000000 --- a/scripts/format +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -e - -if [[ -n "${CI}" ]]; then - set -x -fi - -function usage() { - echo -n \ - "Usage: $(basename "$0") -Format code with black and isort -" -} - -if [ "${BASH_SOURCE[0]}" = "${0}" ]; then - if [ "${1:-}" = "--help" ]; then - usage - else - # Sort imports - pre-commit run isort --all-files - # Code formatting - pre-commit run black --all-files - fi -fi diff --git a/scripts/lint b/scripts/lint index b2211f9..cc5106b 100755 --- a/scripts/lint +++ b/scripts/lint @@ -9,7 +9,7 @@ fi function usage() { echo -n \ "Usage: $(basename "$0") -Execute project linters. +Execute project linters and fomatters. " } @@ -17,9 +17,6 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then if [ "${1:-}" = "--help" ]; then usage else - # Lint - pre-commit run flake8 --all-files - # Type checking - pre-commit run mypy --all-files + pre-commit run --all-files fi fi diff --git a/scripts/test b/scripts/test index 6f9ce9f..4f04f9f 100755 --- a/scripts/test +++ b/scripts/test @@ -17,7 +17,6 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then if [ "${1:-}" = "--help" ]; then usage else - ./scripts/format ./scripts/lint codespell -I .codespellignore -f \ diff --git a/src/stactools/ephemeral/__init__.py b/src/stactools/ephemeral/__init__.py index 0df2cb7..f305cc5 100644 --- a/src/stactools/ephemeral/__init__.py +++ b/src/stactools/ephemeral/__init__.py @@ -1,6 +1,5 @@ import stactools.core from stactools.cli.registry import Registry - from stactools.ephemeral.stac import create_collection, create_item __all__ = ["create_collection", "create_item"] diff --git a/src/stactools/ephemeral/commands.py b/src/stactools/ephemeral/commands.py index 1bd4056..bd62ff4 100644 --- a/src/stactools/ephemeral/commands.py +++ b/src/stactools/ephemeral/commands.py @@ -2,7 +2,6 @@ import click from click import Command, Group - from stactools.ephemeral import stac logger = logging.getLogger(__name__) diff --git a/tests/test_commands.py b/tests/test_commands.py index 689fde0..c098b33 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -4,9 +4,8 @@ import pystac from click import Command, Group -from stactools.testing.cli_test import CliTestCase - from stactools.ephemeral.commands import create_ephemeralcmd_command +from stactools.testing.cli_test import CliTestCase class CommandsTest(CliTestCase):