Project

General

Profile

Patch #40010 ยป start_end_with.patch

Go MAEDA, 2024-01-07 05:35

View differences:

app/models/issue_query.rb
481 481
      " WHERE #{Journal.table_name}.journalized_type='Issue' AND #{Journal.table_name}.journalized_id=#{Issue.table_name}.id" +
482 482
      " AND (#{sql_for_field field, operator.sub(/^!/, ''), value, Journal.table_name, 'notes'})" +
483 483
      " AND (#{Journal.visible_notes_condition(User.current, :skip_pre_condition => true)})"
484
    "#{/^!/.match?(operator) ? "NOT EXISTS" : "EXISTS"} (#{subquery})"
484
    "#{operator.start_with?('!') ? "NOT EXISTS" : "EXISTS"} (#{subquery})"
485 485
  end
486 486

  
487 487
  def sql_for_updated_by_field(field, operator, value)
lib/redmine/scm/adapters/abstract_adapter.rb
194 194

  
195 195
        def target(path, sq=true)
196 196
          path ||= ''
197
          base = /^\//.match?(path) ? root_url : url
197
          base = path.start_with?('/') ? root_url : url
198 198
          str = "#{base}/#{path}".gsub(/[?<>\*]/, '')
199 199
          if sq
200 200
            str = shell_quote(str)
lib/redmine/scm/adapters/bazaar_adapter.rb
136 136
            revision = nil
137 137
            parsing  = nil
138 138
            io.each_line do |line|
139
              if /^----/.match?(line)
139
              if line.start_with?('----')
140 140
                revisions << revision if revision
141 141
                revision = Revision.new(:paths => [], :message => '')
142 142
                parsing = nil
......
151 151
                  revision.scmid = $1.strip
152 152
                elsif line =~ /^timestamp: (.+)$/
153 153
                  revision.time = Time.parse($1).localtime
154
                elsif /^    -----/.match?(line)
154
                elsif line.start_with?('    -----')
155 155
                  # partial revisions
156 156
                  parsing = nil unless parsing == 'message'
157 157
                elsif line =~ /^(message|added|modified|removed|renamed):/
lib/redmine/scm/adapters/cvs_adapter.rb
173 173
            file_state = nil
174 174
            branch_map = nil
175 175
            io.each_line() do |line|
176
              if state != "revision" && /^#{ENDLOG}/o.match?(line)
176
              if state != "revision" && line.start_with?(ENDLOG)
177 177
                commit_log = ""
178 178
                revision   = nil
179 179
                state      = "entry_start"
......
186 186
                  logger.debug("Path #{entry_path} <=> Name #{entry_name}")
187 187
                elsif /^head: (.+)$/ =~ line
188 188
                  entry_headRev = $1
189
                elsif /^symbolic names:/.match?(line)
189
                elsif line.start_with?('symbolic names:')
190 190
                  state = "symbolic"
191
                elsif /^#{STARTLOG}/o.match?(line)
191
                elsif line.start_with?(STARTLOG)
192 192
                  commit_log = ""
193 193
                  state      = "revision"
194 194
                end
......
201 201
                  next
202 202
                end
203 203
              elsif state == "tags"
204
                if /^#{STARTLOG}/o.match?(line)
204
                if line.start_with?(STARTLOG)
205 205
                  commit_log = ""
206 206
                  state = "revision"
207
                elsif /^#{ENDLOG}/o.match?(line)
207
                elsif line.start_with?(ENDLOG)
208 208
                  state = "head"
209 209
                end
210 210
                next
211 211
              elsif state == "revision"
212
                if /^#{ENDLOG}/o =~ line || /^#{STARTLOG}/o =~ line
212
                if line.start_with?(ENDLOG, STARTLOG)
213 213
                  if revision
214 214
                    revHelper = CvsRevisionHelper.new(revision)
215 215
                    revBranch = "HEAD"
......
239 239
                  end
240 240
                  commit_log = ""
241 241
                  revision   = nil
242
                  if /^#{ENDLOG}/o.match?(line)
242
                  if line.start_with?(ENDLOG)
243 243
                    state = "entry_start"
244 244
                  end
245 245
                  next
......
267 267
                  #                  version.line_minus = 0
268 268
                  #                end
269 269
                else
270
                  commit_log += line unless /^\*\*\* empty log message \*\*\*/.match?(line)
270
                  commit_log += line unless line.start_with?('*** empty log message ***')
271 271
                end
272 272
              end
273 273
            end
lib/redmine/scm/adapters/subversion_adapter.rb
299 299
        end
300 300

  
301 301
        def target(path = '')
302
          base = /^\//.match?(path) ? root_url : url
302
          base = path.start_with?('/') ? root_url : url
303 303
          uri = "#{base}/#{path}"
304 304
          uri = Addressable::URI.encode(uri)
305 305
          shell_quote(uri.gsub(/[?<>\*]/, ''))
lib/redmine/wiki_formatting/textile/redcloth3.rb
537 537
                # the regexp prevents wiki links with a | from being cut as cells
538 538
                row.scan(/\|(_?#{S}#{A}#{C}\. ?)?((\[\[[^|\]]*\|[^|\]]*\]\]|[^|])*?)(?=\|)/o) do |modifiers, cell|
539 539
                    ctyp = 'd'
540
                    ctyp = 'h' if modifiers && modifiers =~ /^_/
540
                    ctyp = 'h' if modifiers&.start_with?('_')
541 541

  
542 542
                    catts = nil
543 543
                    catts = pba( modifiers, 'td' ) if modifiers
......
637 637
    end
638 638

  
639 639
    def lT( text )
640
        /\#$/.match?(text) ? 'o' : 'u'
640
        text.end_with?('#') ? 'o' : 'u'
641 641
    end
642 642

  
643 643
    def hard_break( text )
......
673 673

  
674 674
                    block_applied = 0
675 675
                    @rules.each do |rule_name|
676
                        block_applied += 1 if rule_name.to_s.match /^block_/ and method(rule_name).call(blk)
676
                        block_applied += 1 if rule_name.to_s.start_with?('block_') and method(rule_name).call(blk)
677 677
                    end
678 678
                    if block_applied.zero?
679 679
                        if deep_code
......
909 909

  
910 910
    def refs( text )
911 911
        @rules.each do |rule_name|
912
            method( rule_name ).call( text ) if rule_name.to_s.match? /^refs_/
912
            method( rule_name ).call( text ) if rule_name.to_s.start_with?('refs_')
913 913
        end
914 914
    end
915 915

  
lib/tasks/locales.rake
43 43

  
44 44
      missing_keys.each do |key|
45 45
        {key => en_strings[key]}.to_yaml.each_line do |line|
46
          next if line =~ /^---/ || line.empty?
46
          next if line.start_with?('---') || line.empty?
47 47
          puts "  #{line}"
48 48
          lang << "  #{line}"
49 49
        end
......
133 133
      File.open(path, 'a') do |file|
134 134
        adds.each do |kv|
135 135
          Hash[*kv].to_yaml.each_line do |line|
136
            file.puts "  #{line}" unless (line =~ /^---/ || line.empty?)
136
            file.puts "  #{line}" unless (line.start_with?('---') || line.empty?)
137 137
          end
138 138
        end
139 139
      end
    (1-1/1)