Skip to content

Ruby String interpolation in the String get formatted unexpected. #124

@zw963

Description

@zw963

Rustywind Replace

class: "box f-col #{reply.reply_id ? "ok" : ""}"

With

class: "box f-col #{reply.reply_id ?"ok" : ""}"

When run:

$: rustywind --custom-regex "class(?:=|:\s*)(?:'|\")([^\"']+?)(?:'|\")" --write .

That is, it remove the space between the ? and "ok".

But actually, the ? is the ternary operator in the Ruby/Crystal e.g.

user.is_admin? ? "You are a admin" : "You are not a admin"

Although, this is not caused a error, but, It is conflict with Crystal formatter, which cause the CI broken. (because crystal tool format --check will report there is a format issue which changed by rustywind unexpected, it will change back to original format when run Crystal formatter.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions