Skip to content

Comments aggressively removed in refactoring #280

@vigilyn

Description

@vigilyn

Description

Sourcery should not remove comments.

Original code

def some_function(event):
    # league_id is actually stored in event's "id" key and not league_id key
    league_id = event.get("id")
    if league_id:
        res.league_id = league_id

Sourcery Suggested refactoring (use-named-expression)

def some_function(event):
-    # league_id is actually stored in event's "id" key and not league_id key
-    league_id = event.get("id")
-    if league_id:
+    if league_id := event.get("id")
        res.league_id = league_id

Actual Desired refactoring (use-named-expression)

def some_function(event):
     # league_id is actually stored in event's "id" key and not league_id key
-    league_id = event.get("id")
-    if league_id:
+    if league_id := event.get("id")
        res.league_id = league_id

Debug Information

IDE Version:
PyCharm 2022.2.1 (Professional Edition)
Build #PY-222.3739.56, built on August 16, 2022
Runtime version: 17.0.3+7-b469.37 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

Sourcery Version:
sourcery.pycharm-plugin (0.12.8)

Operating system and Version:
macOS 12.6

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions