annotate_models icon indicating copy to clipboard operation
annotate_models copied to clipboard

add new_column with chinese comment would cause skip annotate_one_file

Open lyb124553153 opened this issue 3 years ago • 1 comments

https://github.com/ctran/annotate_models/blob/e075a21481ecfea6c7fc984c0978ff807332af62/lib/annotate/annotate_models.rb#L378-L382

Commands

str = "# Table name: foos\n" +
"#\n" +
"#  id                                    :bigint(8)        not null, primary key\n" +
"# test(测试)                       :decimal(, )      not null\n" 
column_pattern = /^#[\t ]+[\w\*\.`]+[\t ]+.+$/ 

columns = str.scan(column_pattern) # expect 3 column only get 2 seems test doesnt match column_pattern
 

Version

  • annotate version v3.1.1
  • rails version v5.2
  • ruby version v2.7.2

lyb124553153 avatar Jun 01 '21 09:06 lyb124553153

Hey lyb124553153,

After running into many problems with annotate myself, I have developed the gem datagaze which fixes those issues.

I expect that the gem might also resolve your issue. Would you like to try it out, and let me know if it has solved your problem?

The gem is to be found at: https://github.com/jurriaanschrofer/datagaze.

Background story of the gem: annotate's lookup system is often rigid and based on very strict conventions. Instead, I have devised a more dynamic way of annotating, through the use of ruby's const_source_location method and rails' ApplicationRecord.descendants.

jurriaanschrofer avatar Oct 04 '21 21:10 jurriaanschrofer