Skip to content

Commit

Permalink
feat: use ruff
Browse files Browse the repository at this point in the history
Also, upgrade to markdownlint-cli2.
  • Loading branch information
gadomski committed Sep 12, 2023
1 parent b915f2f commit 9d77979
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 71 deletions.
12 changes: 0 additions & 12 deletions .flake8

This file was deleted.

5 changes: 5 additions & 0 deletions .github/.markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"config": {
"MD041": false
}
}
4 changes: 1 addition & 3 deletions .github/PULL_REQUEST_TEMPLATE.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion .markdownlintignore

This file was deleted.

28 changes: 12 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docker/format → docker/lint
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -43,3 +42,6 @@ build-backend = "setuptools.build_meta"

[tool.isort]
profile = "black"

[tool.ruff]
select = ["E", "F", "I"]
25 changes: 0 additions & 25 deletions scripts/format

This file was deleted.

7 changes: 2 additions & 5 deletions scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ fi
function usage() {
echo -n \
"Usage: $(basename "$0")
Execute project linters.
Execute project linters and fomatters.
"
}

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
1 change: 0 additions & 1 deletion scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
if [ "${1:-}" = "--help" ]; then
usage
else
./scripts/format
./scripts/lint

codespell -I .codespellignore -f \
Expand Down
1 change: 0 additions & 1 deletion src/stactools/ephemeral/__init__.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
1 change: 0 additions & 1 deletion src/stactools/ephemeral/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import click
from click import Command, Group

from stactools.ephemeral import stac

logger = logging.getLogger(__name__)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 9d77979

Please sign in to comment.