holoviz / datashader

Quickly and accurately render even the largest data.
http://datashader.org
BSD 3-Clause "New" or "Revised" License
3.24k stars 363 forks source link

Add pre-commit #1295

Closed ianthomas23 closed 8 months ago

ianthomas23 commented 8 months ago

This adds pre-commit to the repo and CI, following a similar approach to that in HoloViews. The initial setup is relatively simple, and we can extend it over time. It includes some of the standard pre-commit hooks as well as codespell and ruff.

It uses the default set of ruff checks, and I have fixed all reported errors. These are in the following categories:

  1. Line length. I have set the max line length to 100 so that there aren't too many changes, and I expect in time the various HoloViz repos will converge on a common value.
  2. Multiple statements on one line.
  3. No bare except.
  4. Ambiguous variable name l.
  5. Module level imports not at top of file.
  6. Use def rather than assigning a lambda.
  7. Use a not in b rather than not a in b.

None of these changes should be controversial, but I accept that this PR is rather large so it may not be acceptable as it is.

codecov[bot] commented 8 months ago

Codecov Report

Merging #1295 (413c257) into main (81ce9b8) will decrease coverage by 0.03%. The diff coverage is 88.63%.

@@            Coverage Diff             @@
##             main    #1295      +/-   ##
==========================================
- Coverage   85.66%   85.63%   -0.03%     
==========================================
  Files          52       52              
  Lines       11114    11128      +14     
==========================================
+ Hits         9521     9530       +9     
- Misses       1593     1598       +5