New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix fmt and lint re-runs under pantsd #9869
Fix fmt and lint re-runs under pantsd #9869
Conversation
Sorry: the first commit definitely should have been two. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Glad to see this code get simplified. Thanks!
…fix `__eq__` for that type by extending dataclass to include all members in equality. [ci skip-rust-tests] [ci skip-jvm-tests]
# Delete this line to force CI to run Clippy and the Rust tests. [ci skip-rust-tests] # Delete this line to force CI to run the JVM tests. [ci skip-jvm-tests]
# Delete this line to force CI to run Clippy and the Rust tests. [ci skip-rust-tests] # Delete this line to force CI to run the JVM tests. [ci skip-jvm-tests]
9986123
to
4aeefb5
Compare
requests.append(all_source_files_request) | ||
requirements_pex, specified_source_files, *rest = cast( | ||
Union[Tuple[Pex, SourceFiles], Tuple[Pex, SourceFiles, SourceFiles]], | ||
await MultiGet(requests), | ||
) | ||
|
||
all_source_files_snapshot = ( | ||
request.field_sets.prior_formatter_result | ||
if request.field_sets.prior_formatter_result | ||
request.request.prior_formatter_result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, hm. This is weird naming. It'd be great to rename the parameter to setup_request
and rename the property SetupRequest.request
to SetupRequest.docformatter_request
. Ditto on Black and Isort.
Problem
The
FmtFieldSets
andLinterFieldSets
types extendedCollection
(which implements usefuleq
/hash
), but then added an additional optional field,prior_formatter_result
. But that additional field was not included in theeq
/hash
for the type, and this meant that instances of these objects would be equal regardless of the previous result. This resulted inpantsd
memoizing the wrong input for runs: in short, havoc.Solution
Extract
StyleRequest
to replaceFmtFieldSets
andLinterFieldSets
, and fix__eq__
for that type by extending dataclass. Additionally, align allFmt
andLint
FieldSets
types around the nameRequest
.Result
Operation of
fmt
andlint
is correct underpantsd
.[ci skip-rust-tests]
[ci skip-jvm-tests]