Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .flake8

This file was deleted.

10 changes: 4 additions & 6 deletions .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ jobs:
run: python -m pip install --upgrade uv
- name: Install dependencies with uv
run: uv pip install --system --editable . --group dev
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Lint with ruff
run: ruff check --exit-zero .
- name: Check formatting with Ruff
run: uv run ruff format --check .
- name: Lint with Ruff
run: uv run ruff check .
- name: Test with pytest
run: |
pytest
Expand Down
31 changes: 6 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,21 @@ minimum_pre_commit_version: "3.6.0"
# All hooks must be local to allow offline usage

# ─── PYTHON ────────────────────────────────────────────────────────────────────
# NOTE: hooks run in the order they appear – isort before black is critical.
# NOTE: hooks run in the order they appear so Ruff formats before it lints.
repos:
- repo: local
hooks:
# 1️⃣ Sort imports **first** – with Black-compatible style
- id: isort
name: isort (black-profile)
entry: uv run isort --profile=black --filter-files
language: system
types: [python]

- repo: local
hooks:
# 2️⃣ Let Black format everything after isort touched the imports
- id: black
name: black
entry: uv run black --line-length 88
language: system
types: [python]

- repo: local
hooks:
# 3️⃣ Flake8 only checks; it should never re-write files
- id: flake8
name: flake8
entry: uv run flake8 --config=.flake8
- id: ruff-format
name: ruff format
entry: uv run ruff format
language: system
types: [python]

- repo: local
hooks:
- id: ruff
name: ruff
entry: ruff check --exit-zero
name: ruff check
entry: uv run ruff check
language: system
types: [python]

Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Keep commits small and focused.
Use conventional commit messages.
Format code with `black` and/or `prettier`
Run `flake8` for lint checks.
Format Python code with `ruff format` and front-end assets with `prettier`.
Run `ruff check` for linting.
Run `pre-commit run --all-files`.
Run tests with `pytest`.
Use `pyproject.toml` for dependencies; do not use requirements files.
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.PHONY: format format-yaml lint test test-js precommit setup

format:
uv run black .
prettier --write app/static/js/**/*.js app/static/css/**/*.css
uv run ruff format .
prettier --write app/static/js/**/*.js app/static/css/**/*.css
Comment on lines 3 to +5

Choose a reason for hiding this comment

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

P1 Badge Restore tabs in Makefile recipes for format/lint

The format and lint targets now use space indentation for their commands instead of tabs (uv run ruff… lines), so GNU Make treats those lines as malformed and exits with *** missing separator. Running make format or make lint currently fails before any Ruff tooling runs. Replacing the leading spaces with tabs (as still used by the test target below) restores working developer workflows.

Useful? React with 👍 / 👎.

Comment on lines +4 to +5
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

Makefile recipes must be indented with tabs, not spaces. Lines 4, 5, 8, 11, 12, 13, and 25 use spaces, which will cause Make to fail with an error like "*** missing separator". Replace the space indentation with tabs for all recipe lines.

Copilot uses AI. Check for mistakes.

format-yaml:
prettier --write '*.yml'
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

Makefile recipe must be indented with a tab, not spaces. Replace the space indentation with a tab.

Suggested change
prettier --write '*.yml'
prettier --write '*.yml'

Copilot uses AI. Check for mistakes.

lint:
uv run flake8
uv run ruff check --exit-zero .
eslint 'app/static/js/**/*.js'
uv run ruff format --check .
uv run ruff check .
eslint 'app/static/js/**/*.js'
Comment on lines +11 to +13
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

Makefile recipes must be indented with tabs, not spaces. Replace the space indentation with tabs for all three recipe lines.

Copilot uses AI. Check for mistakes.

test:
uv run pytest
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ To set up the project for development:

```sh
uv run pre-commit run --all-files
uv run flake8
uv run ruff format --check .
uv run ruff check .
uv run pytest
npm test -- --coverage
```
Expand Down
4 changes: 2 additions & 2 deletions app/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Keep Python modules PEP8 compliant with `black` formatting.
Keep Python modules PEP8 compliant with `ruff format`.
Use descriptive docstrings for all public functions and classes.
Prefer type hints.
Avoid introducing heavy dependencies without discussion.
Run `flake8` and `pytest` before committing changes.
Run `ruff check` and `pytest` before committing changes.
2 changes: 1 addition & 1 deletion app/routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
"""HTTP route handlers and helper utilities.

This module registers all Flask endpoints for the application. Routes handle
Expand Down
6 changes: 3 additions & 3 deletions docs/ci_checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and on pull requests targeting those branches.
The workflow located at `.github/workflows/python-app.yml` performs the
following tasks:

- Formats Python code with `black`, sorts imports with `isort`, and lints with `ruff` and `flake8`.
- Formats and lints Python code with Ruff.
- Checks type hints with `mypy`.
- Lints JavaScript with `eslint` and verifies formatting with `prettier`.
- Executes `pytest` and `jest` test suites and uploads coverage.
Expand All @@ -15,8 +15,8 @@ following tasks:
- Caches Python, Node, and pre-commit dependencies to speed up builds.
- Skips the workflow when only documentation files change.

Running `pre-commit run --all-files` locally will execute the same Black,
isort, Flake8, and mypy checks before they fail in CI. These checks help catch
Running `pre-commit run --all-files` locally will execute the same Ruff and
Mypy checks before they fail in CI. These checks help catch
regressions and security issues before code is merged.
On pull requests the workflow lints only the files that changed, while pushes
to `staging` or `main` run the linter across the entire repository.
7 changes: 3 additions & 4 deletions docs/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ This guide provides tips for extending Glimpser, running tests, and contributing

1. Clone the repository and create a virtual environment:
```sh
ruff check --exit-zero .
git clone https://github.com/KristopherKubicki/glimpser.git
cd glimpser
python -m venv env
Expand Down Expand Up @@ -49,11 +48,11 @@ to the web interface.

## Running Tests

The project uses `pytest` for testing and lints Python with `ruff` and `flake8`. After activating your environment, run:
The project uses `pytest` for testing and relies on Ruff for formatting and linting. After activating your environment, run:

```sh
ruff check --exit-zero .
flake8
uv run ruff format --check .
uv run ruff check .
pytest # runs in parallel via pytest-xdist
```

Expand Down
6 changes: 3 additions & 3 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ python -m coverage html

The HTML report will be generated in `htmlcov/index.html`.

Before submitting a patch, lint the code with `ruff` and `flake8`:
Before submitting a patch, lint and format the code with Ruff:

```sh
ruff check --exit-zero .
flake8
uv run ruff format --check .
uv run ruff check .
```

Refer to [developer_guide.md](developer_guide.md) for setting up your environment.
Expand Down
26 changes: 7 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ glimpser-dashboard = "app.utils.console_dashboard:main"
[project.optional-dependencies]
dev = [
# Core dev tooling - all required for building
"black>=25.1",
"coverage>=7.9",
"flake8>=7.2",
"isort==6.0.1",
"mkdocs>=1.6",
"mypy>=1.16",
"pre-commit>=4.2",
Expand Down Expand Up @@ -122,24 +119,18 @@ packages = ["app", "scripts"]
# ─────────────────────────────────────────────────────────────────────────────
# Tooling configuration
# ─────────────────────────────────────────────────────────────────────────────
[tool.black]
line-length = 88
target-version = ["py311"]
required-version = "25.1.0"

[tool.isort]
profile = "black"
line_length = 88

# Ruff replaces most flake8 / isort / pylint rules, but you can keep the
# originals for now; just run Ruff first so they have little to flag.
[tool.ruff]
line-length = 88
target-version = "py311"
exclude = [".git", "__pycache__", "build", "dist", "node_modules", "env", ".venv"]

# Enable Ruff’s equivalents of common Flake8 & Pylint rules + isort style
extend-select = ["E", "F", "I", "UP", "PL"] # E=pycodestyle, F=pyflakes, I=isort, UP=pyupgrade, PL=pylint
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false

[tool.ruff.lint]
select = ["E", "F", "I", "UP", "PL"] # E=pycodestyle, F=pyflakes, I=isort, UP=pyupgrade, PL=pylint

# MyPy stays as-is
[tool.mypy]
Expand Down Expand Up @@ -170,10 +161,7 @@ tag_format = "v$version"
# Everything here installs with `pip install .[dev]`
dev = [
# ✂︎ existing dev deps kept (versions bumped where useful) ✂︎
"black>=25.1",
"coverage>=7.9", # keep for standalone HTML reports
"flake8>=7.2",
"isort==6.0.1", # now mirrors runtime pin
"mkdocs>=1.6",
"mypy>=1.16",
"pre-commit>=4.2",
Expand Down
2 changes: 1 addition & 1 deletion tests/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
- Write new tests for every feature or bug fix.
- Use `pytest` for Python and Jest for JavaScript.
- Keep tests isolated by using fixtures.
- Run `flake8` and `pytest` (and `npm test` if JS tests change) before committing.
- Run `ruff check` and `pytest` (and `npm test` if JS tests change) before committing.
- The test environment has no network access after setup; design tests accordingly.
Loading
Loading