Instagram / Instagram/LibCST

Codemod to convert assignments to augmented assignments

Open
#541 2 comments 0 reactions 0 assignees View on GitHub
codemod enhancement good first issue
Dominant language
Python
Stars
1.9k
Forks
229
PR merge metrics
No merged PRs in 30d

Description

:eyes: Some source code analysis tools can help to find opportunities for improving software components.
:thought_balloon: I propose to [increase the usage of augmented assignment statements](https://docs.python.org/3/reference/simple_stmts.html#augmented-assignment-statements "Augmented assignment statements") accordingly.

Would you like to integrate anything from a transformation result which can be generated by a command like the following?
(:point_right: Please check also for questionable change suggestions because of an evolving search pattern.)
```
lokal> perl -p -i.orig -0777 -e 's/^(?\s+)(?\S+)\s*=\s*\k[ \t]*(?[+\-%&|^@]|\*\*?|\/\/?|<<|>>)/$+{indentation}$+{target} $+{operator}=/gm' $(find ~/Aktivitäten/LibCST/lokal -name '*.py')
```

How do you think about to improve nine source code places? :thinking:

-----

:crystal_ball: How would a corresponding transformation (a “codemod”) be achieved by the means of the software “LibCST”?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.