Files
GeoLibre/.gitattributes
85fa29e87d ci(fmt): add ruff + oxfmt auto-format workflow and config (#1327)
* ci(fmt): add ruff + oxfmt auto-format workflow and config

Adds a GitHub Actions workflow that runs ruff format/check on Python and
notebooks and oxfmt on JS/TS/JSON/CSS/YAML/TOML, then pushes a style commit
back to the branch. Mirrors the local pre-commit hooks so CI and local runs
produce identical output.

- .github/workflows/format.yml: pinned ruff==0.15.22, oxfmt@0.59.0
- ruff.toml: line-length 100, rules F/I/W/E, py310 target
- .oxfmtrc.json: width 100, double quotes, lockfile/generated excludes
- .pre-commit-config.yaml: local ruff + oxfmt hooks (offline-friendly)
- .gitattributes: normalize all text to LF, explicit binary rules
- docs/contributing.md: document the new formatting pipeline

* ci(fmt): switch auto-format from GitHub Actions to pre-commit.ci

pre-commit.ci authenticates via its own GitHub App, so the auto-format
bot can push fixes back on fork PRs (where GITHUB_TOKEN is read-only).
It only runs on PRs, so auto-formatted commits never bypass review.

- Delete .github/workflows/format.yml
- Add autofix/autoupdate config to .pre-commit-config.yaml; the ruff and
  oxfmt version pins there are now the single source of truth
- Trim ignorePatterns comments in .oxfmtrc.json
- Rewrite the coding-conventions section in docs/contributing.md

* ci(fmt): address review feedback on ruff.toml and .gitattributes

- .gitattributes: add explicit binary rules for *.icns, *.pbf, *.pmtiles
  (icon.icns, MapLibre glyph pbfs, osm.pbf fixtures, and mini.pmtiles are
  all tracked in-repo; closes the explicit-safety-net gap flagged in review)
- ruff.toml: drop the misleading lines-after-imports = -1 (no-op default)
  and its comment; add .ruff_cache to extend-exclude so the intent survives
  any future change to ruff's default exclusion list
- .gitignore: ignore .ruff_cache/
- .pre-commit-config.yaml: drop the redundant `files: \.(py|ipynb)$` regex
  (types_or already scopes the ruff hooks to python/pyi/jupyter) and fix the
  nbstripout hook indentation

* ci(fmt): exclude generated whitebox-menu-catalog from oxfmt

The file is auto-generated by scripts/gen-whitebox-menu-catalog.mjs
(its header says 'do not hand-edit'), so add it to .oxfmtrc.json's
ignorePatterns alongside the other generated catalogs.

* ci(fmt): run ruff check --fix before ruff format

Lint autofixes (import sorting via I, unused-import removal via F) can
change layout; the formatter must run last so a single pre-commit pass
stabilizes the file. Matches the order recommended by ruff's docs and
astral-sh/ruff-pre-commit.

* Update .gitattributes

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* style: auto-format (ruff + oxfmt) [pre-commit.ci]

* Address Claude review feedback

- docs/contributing.md: note that oxfmt also sorts package.json keys into
  its conventional order, so contributors expect key reordering (not just
  whitespace changes) in future package.json diffs.

* Address Claude review feedback

- .oxfmtrc.json: drop the "python/**" ignore. It was a no-op for .py/.ipynb
  (the hook's types_or never passes them, and *.ipynb is excluded globally)
  while wrongly hiding real JS/TOML under python/ from oxfmt; the generated
  python/src/geolibre/static stays excluded via "**/static/**". Format the
  newly covered python/pyproject.toml and python/src/geolibre/_frontend.js.
- ruff.toml: delete the [lint.pycodestyle] max-line-length block; it equaled
  the top-level line-length, which is already the default, so behavior is
  unchanged. Reworded the E-rules comment that pointed at it.
- docs/contributing.md: restore the 2-space list-continuation indent on the
  mixed-line-ending bullet so the inline code span isn't split oddly.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Qiusheng Wu <giswqs@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-07-18 18:51:44 -04:00

52 lines
1.1 KiB
Plaintext

# Normalize all text files to LF on checkout and commit, regardless of the
# contributor's platform. This is the single source of truth for line endings
# and supersedes per-user core.autocrlf. After changing this file, run
# `git add --renormalize .` once to migrate the index.
* text=auto eol=lf
# Binary files: never touch line endings (git's auto-detection is good, but be
# explicit for formats that ship in this repo so a future blanket rule can't
# corrupt them).
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.webp binary
*.ico binary
*.icns binary
*.svg binary
*.tif binary
*.tiff binary
*.bmp binary
*.pdf binary
*.zip binary
*.gz binary
*.tar binary
*.tgz binary
*.7z binary
*.ttf binary
*.otf binary
*.woff binary
*.woff2 binary
*.eot binary
*.wasm binary
*.dat binary
*.bin binary
*.parquet binary
*.geoparquet binary
*.geojson.gz binary
*.pbf binary
*.pmtiles binary
*.nc binary
*.snap binary
*.deb binary
*.rpm binary
*.msi binary
*.AppImage binary
*.dmg binary
*.exe binary
*.dll binary
*.so binary
*.dylib binary
*.pak binary