tskit icon indicating copy to clipboard operation
tskit copied to clipboard

Switch to ruff linting

Open benjeffery opened this issue 1 year ago • 8 comments
trafficstars

For numpy2 checks etc.

benjeffery avatar May 23 '24 15:05 benjeffery

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.65%. Comparing base (998d710) to head (54dabad).

:exclamation: Current head 54dabad differs from pull request most recent head 872880c

Please upload reports for the commit 872880c to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2952      +/-   ##
==========================================
- Coverage   89.63%   86.65%   -2.99%     
==========================================
  Files          29       11      -18     
  Lines       30189    22932    -7257     
  Branches     5877     4254    -1623     
==========================================
- Hits        27061    19872    -7189     
+ Misses       1789     1754      -35     
+ Partials     1339     1306      -33     
Flag Coverage Δ
c-tests 86.20% <ø> (ø)
lwt-tests 80.78% <ø> (ø)
python-c-tests 88.72% <ø> (ø)
python-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 18 files with indirect coverage changes

codecov[bot] avatar May 23 '24 15:05 codecov[bot]

Codecov Report

Attention: Patch coverage is 98.95833% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.63%. Comparing base (998d710) to head (d9256d9). Report is 148 commits behind head on main.

Files with missing lines Patch % Lines
python/tskit/trees.py 95.45% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2952      +/-   ##
==========================================
- Coverage   89.63%   89.63%   -0.01%     
==========================================
  Files          29       29              
  Lines       30189    30173      -16     
  Branches     5877     5877              
==========================================
- Hits        27061    27045      -16     
  Misses       1789     1789              
  Partials     1339     1339              
Flag Coverage Δ
c-tests 86.20% <ø> (ø)
lwt-tests 80.78% <ø> (ø)
python-c-tests 88.72% <ø> (ø)
python-tests 99.03% <98.95%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
python/tskit/cli.py 96.96% <100.00%> (ø)
python/tskit/combinatorics.py 99.36% <100.00%> (ø)
python/tskit/drawing.py 99.23% <100.00%> (-0.01%) :arrow_down:
python/tskit/exceptions.py 100.00% <100.00%> (ø)
python/tskit/formats.py 99.46% <100.00%> (ø)
python/tskit/genotypes.py 99.07% <100.00%> (ø)
python/tskit/intervals.py 100.00% <100.00%> (ø)
python/tskit/metadata.py 99.04% <100.00%> (-0.01%) :arrow_down:
python/tskit/provenance.py 100.00% <ø> (ø)
python/tskit/stats.py 100.00% <100.00%> (ø)
... and 5 more
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar May 23 '24 23:05 codecov-commenter

Well this was a lot noisier than I was expecting, although it did show up a couple of actual errors.

benjeffery avatar May 24 '24 00:05 benjeffery

Ruff is quite opinionated about getting people to use f strings etc isn't it?

What were the errors?

LGTM though, happy to switch.

Given the noisiness we may want to try and flush a few open PRs through first.

jeromekelleher avatar May 24 '24 08:05 jeromekelleher

If we don't want to enforce f-strings we can switch that off - they do generally read better though.

The errors were: A test where a subsequent pytest.raises was nested inside the first, such that the second didn't run. An ibd test that was missing an assert so the value was evaluated, but not checked.

benjeffery avatar May 24 '24 08:05 benjeffery

I'm happy with whatevery you all think, but I did find two places I wished it was less opinionated (see comments).

petrelharp avatar Jun 06 '24 15:06 petrelharp

I've been using ruff and it's much quicker than our previous linter, which makes development a little slicker and more palatable, so I would be happy with switching over.

hyanwong avatar Jul 08 '24 09:07 hyanwong

Still planning to do this - waiting till the number of in-flight PRs is a bit lower.

benjeffery avatar Sep 23 '24 10:09 benjeffery

I've just tried to bring this up-to-date and while doing so noticed quite a few new changes that weren't in this original PR as ruff had added new checks. As such I don't think we want to switch as our usual PR's moving forward will have lint changes in, black has been relatively stable. I'm open to ruff once/if things have settled down in a year or two, but right now I think it will be too noisey.

benjeffery avatar Mar 24 '25 14:03 benjeffery