New check: Use single-statement dict initialization #2876
Labels
Enhancement ✨
Improvement to a component
Good first issue
Friendly and approachable by new contributors
Hacktoberfest
Help wanted 🙏
Outside help would be appreciated, good for new contributors
Milestone
Here's an ugly pattern, commonly found in eg config files:
An empty dict is initialized and then mutated several times. It would
be better to use declarative literal syntax:
No mutation! No repetition!
I'm imagining a check that would look for an empty dict initialization
and then see if any following lines are bare dict assignments. It
could get tricky though, as this pattern horrible pattern is sometimes
recursive:
Yuck!
And I know, a check like this gets released, CIs start showing failing
builds, and everyone thinks the sky is falling. Maybe make it
optional? Or a warning or something? Anything to discourage this
pattern.
The text was updated successfully, but these errors were encountered: