chore(tooling): Update static checks#1428
Conversation
There was a problem hiding this comment.
The updated tox static env looks good, @gurukamath! We just need to make sure that we're running with the appropriate ruff config, to avoid another mass format PR.
A few points on config relevant for ruff format :
-
To have the
ruff format-specific config, as close to the target post-weld config as possible, I'd suggest removing this EELS-specificignore:execution-specs/pyproject.toml
Line 483 in 5ddb904
-
What do you think about removing
E501: line-too-longfor all of./tests/for consistency (my preference: as we're doing this for spec and unit tests in ethereum/execution-spec-tests#2152)? This will not only be a reformat; docstrings, comments will cause trouble.
execution-specs/pyproject.toml
Line 492 in 5ddb904
-
We should evaluate the target post-weld docstring rules. Perhaps it's ok to subsequently apply the changes for this ruleset as a separate PR? It will need a little alignment and potentially quite some effort. This is potentially another mass reformat.
Another suggestion, not strictly required in this PR: We will need to update the path(s) here to exclude EEST. So that when we enable EEST ruff commands, these rules aren't applied to tests/eest:
execution-specs/pyproject.toml
Lines 486 to 492 in 5ddb904
danceratopz
left a comment
There was a problem hiding this comment.
Hey @gurukamath, I only reviewed the changes to pyproject.toml and compared them to EEST's ruff config. The [tool.ruff.lint] section looks great; I copied it over to EEST (enabled D400, enabled D415; disabled "A" which will be fixed by Sam's ethereum/execution-spec-tests#2166) and it runs cleanly on our code.
Just one request below to enable D400 🙏
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/osaka #1428 +/- ##
============================================
Coverage 86.07% 86.07%
============================================
Files 743 743
Lines 44072 44072
Branches 3891 3891
============================================
Hits 37936 37936
Misses 5659 5659
Partials 477 477
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Small correction to the above: EEST will need to enable the other ARG checks to have parity with EELS: |
|
@danceratopz @Carsons-Eels Have updated the PR to stop ignoring D400 |
danceratopz
left a comment
There was a problem hiding this comment.
Thanks for enabling D400, @gurukamath. At a first glance the changes look good.
Could you just comment whether the changes were fully automated or not? I.e., how much manual resolution did you do? I assume you manually removed or scripted the ^^^ restructuredText underneath headers? What else was required apart from ruff format?
Can you check the comment below? If that change is fine, then I'll do a more thorough review of the changes, based on your answers to the questions (about "how") above.
Yes. It is a ruff check automated fix + some manual changes. An overwhelming majority of these changes are removing the underline from restructured text. There might be 2-3 slightly more specific cases of manual change. For example like the re-ordering of the restructured test anchor here. Unfortunately, I do not recollect all such cases right now but if you want, I can re-make the commits such that all the automated changes and manual ones are in different commits. Do let me know. |
There was a problem hiding this comment.
LGTM @gurukamath. Here's what I checked:
- I used the
ruffsettings from this PR in EEST with two exceptions:
i.select: without "ARG"; this is still WIP in EEST,
ii.line-length99 instead of 79. - I reviewed a random subset of the changes manually: Small comment below.
- I asked Claude to review the PR on a per-file basis: All good.
About 2.: Tldr: It's fine from my side, but.. The only comment I have is that the titles in the rendered doc might look a little strange with a period at the end of them. We could potentially modify docc to remove them again? It is kinda crazy to add a period for a linter only to remove them again in the doc flow, BUT, it does allow for consistent lint rules.
The review in 1. was worth it, I found two bugs in EEST's ruff config 😄
- We select "C", which doesn't exist. It appears ruff enables both
complexity(C90) andflake8-comprehensions(C4) with this -> we should be more explicit and only enable "C4". EELS should add "C4" to its select (27 issues; separate PR)? There are other rules that start with "C", looking into whether these are enabled, or not. - We reverted enabling of "C420" by accident, will fix.
@SamWilsn What do you think of the point made here about |
Here are my thoughts on the C-space rules. I am ok with ignoring C901 as we had earlier agreed. But I think we should also ignore |
Thanks for looking at this @gurukamath. This change would be outside the scope of this PR. I haven't looked at how difficult it'd be to able the whole C space, but let's follow up on that elsewhere. |
| """ | ||
| (w - R1) value for a given Blake2 flavor. | ||
| Used in the function G | ||
| Used in the function G. |
There was a problem hiding this comment.
Why are we ignoring D205? If we're going to mandate summaries, we should mandate the blank line as well.
There was a problem hiding this comment.
I thought I'd check the consequence of enabling D205. This example errors:
"""
Generate an index file (index.json) of all the fixtures in the specified
directory.
"""As the D checks seemingly expect that the summary is on a single line, i.e., it thinks "directory" is the description.
This makes no sense, but it fixes D205:
"""
Generate an index file (index.json) of all the fixtures in the specified
directory.
"""I'm inclined to disable D200, but enable D205. But it's late and will re-visit tomorrow.
There was a problem hiding this comment.
Ok, enabling D205 gives 1241 errors. These would not be trivial to fix. We typically launch into multiline docstrings without a summary, so they'd have to re-written. It would result in nicer documentation though.
e.g.
"""
A small pytest plugin that shows the a concise help string that only contains
the options defined by the plugins defined in execution-spec-tests.
"""There was a problem hiding this comment.
Funny example, needs fixing anyway 😆
There was a problem hiding this comment.
Will need to be handled as part of the markdown conversion. See #671
There was a problem hiding this comment.
Agreed, it does need to be fixed but can be rolled into #671
Titles should never have a period, whether it's in the rendered output or the source input. The practical effect of this is that we always need to have a summary line before the first title in a docstring, but I think that actually makes a lot of sense. |
I am going to add this to the issue #671 which is aimed at converting all the doc-strings into markdown. I think we should handle this post weld and enforce the following.
|
Co-authored-by: Sam Wilson <57262657+SamWilsn@users.noreply.github.com>
be83dae to
1da0e96
Compare
| """ | ||
| (w - R1) value for a given Blake2 flavor. | ||
| Used in the function G | ||
| Used in the function G. |
There was a problem hiding this comment.
Agreed, it does need to be fixed but can be rolled into #671
|
|
||
|
|
||
| class EthereumException(Exception): # noqa N818 | ||
| class EthereumException(Exception): # noqa N818 |
There was a problem hiding this comment.
Why do we want it to read EthereumException rather than EthereumError?
(closes #1378)
(closes #1397)
(closes #1403 )
What was wrong?
Some of the current static checks are not run on the tests folder. Also,
ruff formatis not being run.Related to Issue #1378
Related to Issue #1397
Related to Issue #1403
How was it fixed?
Extend static checks to the tests folder. Only exclude the eest related code
Add
ruff formatcheck.Cute Animal Picture