use-named-expression
removes comment before the code #434
Open
Description
Checklist
- I have searched the Sourcery documentation for the issue, and found nothing
- I have read the common issues and fixes listed in the Sourcery troubleshooting page, and found nothing
- I have checked there are no open bugs referencing the same bug or problem
Description
I believe it's a duplicate of #280 and mentioned in FAQ, but I didn't see it being resolved in latest version of sourcery-cli
(not sure when would a new engine be released). I think comments above the code should not have been removed in any case.
Code snippet that reproduces issue
Noticed this when trying to refactor the following code for pymatgen
.
sourcery review src/pymatgen/analysis/graphs.py --enable use-named-expression --fix
- # check we're not trying to add a duplicate edge
- # there should only ever be at most one edge
- # between a given (site, jimage) pair and another
- # (site, jimage) pair
- existing_edge_data = self.graph.get_edge_data(from_index, to_index)
- if existing_edge_data:
+ if existing_edge_data := self.graph.get_edge_data(from_index, to_index):
Debug Information
IDE Version:
Visual Studio Code 1.92.1
Sourcery Version:
Sourcery 1.20.0
Operating system and Version:
MacOS Sonama 14.6.1