Skip to content

AnnotateModels needlessly regenerates identical annotations when wrapper_close matches column_pattern #630

Open
@maxh

Description

@maxh

The column_pattern regex here matched our wrapper_close string:

column_pattern = /^#[\t ]+[\w\*`]+[\t ]+.+$/

This caused old_columns == new_columns a few lines down to be false even though it should have been true.

(byebug) old_columns - new_columns
["# Schema information is auto-generated with: devbox rake annotate_models"]

Demo of regex matching our wrapper_close string:
https://regex101.com/r/0CMZ8M/1

Commands

$ rake annotate_models
Annotated (5): ...
$ rake annotate_models
Annotated (5): ... # unexpected: should be `Model files unchanged.` instead

Version

  • annotate version 2.7.5
  • rails version 5.2.3
  • ruby version 2.6.2p47

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions