Skip to content

chore: better linting - #642

Merged
jjfrench merged 5 commits into
developfrom
chore/better-linting
Sep 17, 2026
Merged

jjfrench merged 5 commits into
developfrom
chore/better-linting

Conversation

@jjfrench

@jjfrench jjfrench commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Issue

  • No relevant GitHub issue

What?

  • Enforces better linting in preparation for some dependency changes

Why?

  • Consistent linting across VEDA repositories. Will make version upgrades easier.

Testing?

  • GitHub actions passing

@jjfrench jjfrench self-assigned this Aug 21, 2026
@jjfrench
jjfrench requested a review from a team August 21, 2026 17:52
@jjfrench
jjfrench marked this pull request as ready for review August 21, 2026 17:52

@jjfrench jjfrench left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed a self review and added comments on common patterns addressed by linting

Comment thread pyproject.toml

[tool.ruff.lint]
select = [
"FAST", # fastapi

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds fastapi linting with the exception of FAST003 which doesn't recognize the path parameter being used within the Depends() call

Comment thread pyproject.toml
]
ignore = [
"BLE001", # Blind Exceptions
"B008", # Function calls in argument defaults (Fastapi: Depends)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring B008 because Depends() is a fastapi functionality

Comment thread pyproject.toml
Comment on lines -28 to -30
"mypy>=2.3.0",
"pre-commit>=3.8.0",
"ruff>=0.5.6",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moves mypy to pre-commit, relies on pre-commit-ruff rather than running ruff directly.

Preferred linting:
make lint or uv run pre-commit run --all-files

Comment thread Makefile
Comment on lines +11 to -24
uv sync --all-groups --locked

install:
uv sync --no-dev --frozen
uv sync --no-dev --locked

lint:
uv run ruff format --diff
uv run ruff check
uv run mypy .

format:
uv run ruff check --fix
uv run ruff check --select I --fix
uv run ruff format

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates dependency installs to use --locked

Updates make lint to run pre-commit hooks

Removes ruff direct usage

Comment thread .pre-commit-config.yaml
Comment on lines +37 to +38
- pydantic>=2.13.4
- pydantic-settings>=2.4.1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Equivalent to pydantic.mypy plugin that existed in pyproject.toml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combines context managers (nested with statements)

Comment on lines +57 to +58
except client.exceptions.NoSuchBucket as e:
raise ValueError("Bucket doesn't exist.") from e

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exceptions should be raised "as e from e"

Comment on lines +13 to +14
if TYPE_CHECKING:
from pypgstac.db import PgstacDB

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PgstacDB used as a type

Comment on lines +90 to +93
return next(
(member for member in cls if member.value.lower() == value.lower()),
cls.unknown,
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returning the first member in cls that meets conditions, functionally the same.
both with cls.unknown fallback value

)

all_tenants = sorted(list(set(collection_tenants + item_tenants)))
all_tenants = sorted(set(collection_tenants + item_tenants))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorted will output a new list

@jjfrench
jjfrench force-pushed the chore/better-linting branch from fd045e9 to 391b018 Compare September 17, 2026 14:14
@jjfrench
jjfrench merged commit c9050fb into develop Sep 17, 2026
4 checks passed
@jjfrench
jjfrench deleted the chore/better-linting branch September 17, 2026 15:36

This branch was successfully deployed

1 active deployment
dev 8969ccdd Deployed Sep 17, 2026 by jjfrench via predeploy #1300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants