Skip to content

Incorrect parsing when a percent sign does not precede a macro #495

@m-blaha

Description

@m-blaha

What happened? What is the problem?

Sometimes the percent sign doesn't indicate a macro, it's just the percent sign :). ValueParser still parses it as an empty MacroSubstitution element:

>>> from specfile.value_parser import ValueParser
>>> ValueParser().parse("- 100% of tests now pass")
[StringLiteral('- 100'), MacroSubstitution(''), StringLiteral(' of tests now pass')]

(discovered while trying to use ValueParser for changelog line sanitization packit/packit#2655 (comment))

What did you expect to happen?

>>> from specfile.value_parser import ValueParser
>>> ValueParser().parse("- 100% of tests now pass")
[StringLiteral('- 100% of tests now pass')]

Participation

  • I am willing to submit a pull request for this issue. (Packit team is happy to help!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity/single-taskRegular task; should be done within daysgain/lowDoesn't bring much value to usersimpact/lowAffects only few of the userskind/bugAn unexpected problem or behavior

    Type

    No type

    Projects

    Status

    backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions