Skip to content

Bumping sigils with rubocop comments yields invalid results #427

Closed
@jakebrady5

Description

@jakebrady5

Describe the bug

Bumping files containing sorbet sigils with inline rubocop comments yields invalid sigils and bumps files incorrectly.

Consider sample.rb:

# typed: false # rubocop:todo Sorbet/StrictSigil

class Sample; end
Sample.method_that_does_not_exist

Executing spoom bump --from false --to true yields the following sigil:

# typed: true# rubocop:todo Sorbet/StrictSigil

Sorbet's parser treats this as an invalid sigil (playground), and will not typecheck the file.

Because there are no sorbet errors, spoom considers the file successfully bumped.

To Reproduce

Spoom version: 1.2.2

Bumping the sample file above will reproduce, and should reproduce from and to any strictness level.

Expected behavior

The whitespace between the original sigil level and subsequent text should be preserved. This will yield a valid resulting sorbet sigil and allow spoom to more accurately gauge the validity of a bump.

Metadata

Metadata

Assignees

No one assigned

    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