File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,6 @@ group :development, :test do
1212 if RUBY_VERSION . to_f >= 2.7
1313 gem 'benchmark-ips' , '~> 2.1'
1414 gem 'gouteur' , '~> 1.1'
15- gem 'rubocop' , '~> 1.59 '
15+ gem 'rubocop' , '>= 1.80.2 '
1616 end
1717end
Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ task ragel: 'ragel:install' do
1616 File
1717 . read ( RAGEL_OUTPUT_PATH )
1818 . gsub ( /[ \t ]+$/ , '' ) # remove trailing whitespace emitted by ragel
19+ . gsub ( / then$/ , '' ) # remove redundant then keywords emitted by ragel
1920 . gsub ( /(?<=\d ,)[ \t ]+|^[ \t ]+(?=-?\d )/ , '' ) # compact FSM tables (saves ~6KB)
21+ . gsub ( /(?<=\S ) +/ , '' ) # compact in-line spaces
2022 . gsub ( /\n (?:[ \t ]*\n ){2,}/ , "\n \n " ) # compact blank lines
2123
2224 File . open ( RAGEL_OUTPUT_PATH , 'w' ) do |file |
@@ -31,6 +33,10 @@ task ragel: 'ragel:install' do
3133
3234 file . write ( cleaned_contents )
3335 end
36+
37+ # Remove redundant begin/end blocks emitted by ragel.
38+ # This saves 1KB, but is disabled for now because it increases build time from 0.2s to 1s.
39+ # `bundle exec rubocop --only Style/RedundantBegin --autocorrect #{RAGEL_OUTPUT_PATH}`
3440end
3541
3642namespace :ragel do
You can’t perform that action at this time.
0 commit comments