Skip to content

Autofix of Single branch condition lint removed method comment #12916

Closed
@astares

Description

@astares
  • Pharo 11
  • create a method with a top comment like this:
foo: param
	"Hello World"

	param ifTrue: 
		[ Transcript show: 'Pharo rocks'.
		  Transcript show: 'Pharo rocks' ]

The system will show a critique like "Replace single branch conditional with guard clause" (last one at the bottom in screenshot)
Click on the button to "Automatically resolve the issue" and the system provides an automatic refactoring that transforms the code into the following code with an early return:

foo: param

	param ifFalse: [ ^ self ].
	Transcript show: 'Pharo rocks'.
	Transcript show: 'Pharo rocks'

BUT IT ALSO REMOVED THE METHOD COMMENT WHICH IS A BUG

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions