annotate_models icon indicating copy to clipboard operation
annotate_models copied to clipboard

Comments by multi-byte characters are ignored

Open a-suenami opened this issue 4 years ago • 4 comments

Hi, everyone. So thank you for great product.

I occurred in trouble and want to hear everyone's opinion.

I'm Japanese developer so often add some comment for each database column in Japanese.

For example:

create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci", comment: "ユーザ", force: :cascade do |t|
  t.string "name", null: false, comment: "名前"
  t.string "email", null: false, comment: "メールアドレス"
end

However, they're ignored because they don't match a regular expression which checks diff between old schema and new schema, It's specified here.

If we don't have any problems, I want to fix the problem as follows.

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

# I expect
column_pattern = /^#[\t ]+[^\t ]+[\t ]+.+$/

What do you think?

Commands

$ bundle exec annotate
Model files unchanged.

Version

  • annotate version
    • 3.1.1
  • rails version
    • 6.0.3.2
  • ruby version
    • 2.7.1

a-suenami avatar Sep 12 '20 12:09 a-suenami

Same here

younthu avatar Oct 22 '20 09:10 younthu

Same here

igaiga avatar Mar 24 '21 04:03 igaiga

Same here

jiikko avatar Sep 09 '22 08:09 jiikko

Same here

tkfric avatar Jul 10 '23 04:07 tkfric