funkelab / motile

Multi-Object Tracker using Integer Linear Equations
https://funkelab.github.io/motile/
MIT License
24 stars 5 forks source link

Use ruff instead of flake8, use pre-commit as a lint-runner #6

Closed tlambert03 closed 1 year ago

tlambert03 commented 1 year ago

This PR does two things:

  1. It adds a file .pre-commit-config.yaml config file, allowing the use of pre-commit for running linting & formatting checks. Now, instead of running flake8 motile, you would run pre-commit run -a. Pre-commit is nice because:
    • it lets you add additional versioned tools (e.g. black, or mypy #5 ) to one config file, and run them all with a single command (it runs in a virtual env, so devs don't really even need to have these tools installed their environment)
    • optionally: you can run pre-commit install which will automatically run these checks whenever you commit, unless you pass the --no-verify flag to git commit. I love this, but if you'd rather leave the linting cleanup until a later commit, you don't have to install it locally.
    • for ci on github, you can (optionally) use pre-commit.ci, which will run pre-commit on all pull requests for you, and even add commits to the PR that fix easily fixable problems. (meaning, in some cases, motile contributors needn't even know/care that linting and formatting is ever happening)
  2. it replaces flake8 with ruff. Ruff is just an amazing linter, written in rust. (particularly when running checks during pre-commit, the extra speed here is super useful)
codecov-commenter commented 1 year ago

Codecov Report

Merging #6 (d38b66b) into main (114d7e2) will not change coverage. The diff coverage is 91.66%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##             main       #6   +/-   ##
=======================================
  Coverage   82.59%   82.59%           
=======================================
  Files          23       23           
  Lines         408      408           
=======================================
  Hits          337      337           
  Misses         71       71           
Impacted Files Coverage Δ
motile/track_graph.py 49.35% <ø> (ø)
motile/utils.py 0.00% <0.00%> (ø)
motile/constraints/max_children.py 100.00% <100.00%> (ø)
motile/constraints/max_parents.py 100.00% <100.00%> (ø)
motile/constraints/pin.py 100.00% <100.00%> (ø)
motile/constraints/select_edge_nodes.py 100.00% <100.00%> (ø)
motile/costs/edge_distance.py 42.85% <100.00%> (ø)
motile/solver.py 96.55% <100.00%> (ø)
motile/variables/node_appear.py 100.00% <100.00%> (ø)
motile/variables/node_split.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.