rubocop 1.54.1 → 1.54.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/rubocop/cop/layout/trailing_empty_lines.rb +5 -0
 - data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +5 -5
 - data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
 - data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +3 -1
 - data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -1
 - data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +2 -2
 - data/lib/rubocop/cop/style/semicolon.rb +0 -3
 - data/lib/rubocop/server/client_command/exec.rb +1 -1
 - data/lib/rubocop/string_interpreter.rb +3 -3
 - data/lib/rubocop/target_finder.rb +1 -1
 - data/lib/rubocop/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b5aa0f1796446e72fc2559c5e0ba132c8b8e0e2f244c649e37c475f309911cab
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ab9d4c1160f25912df7db584e67e4c2ce13f8372823a8f5f732ca6664ea63863
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b314533429676735ccfbda5f7e891087c7c277fc84789aa4c82c6961ab966f8d7c6ce1c491f0b6033a7893c48348eebff092dc50f462dd5b3a3cbe77954adf99
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 91e2894b3931bed08640afc882785b5e18371d79fee3a1f4a9eddcb44faa9c4b2232fe798185fcb2b57c3b4561efab25ac019ae543fa4c9b0bdaf0f8a361522b
         
     | 
| 
         @@ -51,6 +51,7 @@ module RuboCop 
     | 
|
| 
       51 
51 
     | 
    
         
             
                      # there could be good reasons why it needs to end with a certain
         
     | 
| 
       52 
52 
     | 
    
         
             
                      # number of newlines.
         
     | 
| 
       53 
53 
     | 
    
         
             
                      return if ends_in_end?(processed_source)
         
     | 
| 
      
 54 
     | 
    
         
            +
                      return if end_with_percent_blank_string?(processed_source)
         
     | 
| 
       54 
55 
     | 
    
         | 
| 
       55 
56 
     | 
    
         
             
                      whitespace_at_end = buffer.source[/\s*\Z/]
         
     | 
| 
       56 
57 
     | 
    
         
             
                      blank_lines = whitespace_at_end.count("\n") - 1
         
     | 
| 
         @@ -86,6 +87,10 @@ module RuboCop 
     | 
|
| 
       86 
87 
     | 
    
         
             
                      extra&.strip&.start_with?('__END__')
         
     | 
| 
       87 
88 
     | 
    
         
             
                    end
         
     | 
| 
       88 
89 
     | 
    
         | 
| 
      
 90 
     | 
    
         
            +
                    def end_with_percent_blank_string?(processed_source)
         
     | 
| 
      
 91 
     | 
    
         
            +
                      processed_source.buffer.source.end_with?("%\n\n")
         
     | 
| 
      
 92 
     | 
    
         
            +
                    end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
       89 
94 
     | 
    
         
             
                    def message(wanted_blank_lines, blank_lines)
         
     | 
| 
       90 
95 
     | 
    
         
             
                      case blank_lines
         
     | 
| 
       91 
96 
     | 
    
         
             
                      when -1
         
     | 
| 
         @@ -75,9 +75,7 @@ module RuboCop 
     | 
|
| 
       75 
75 
     | 
    
         
             
                  end
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
       77 
77 
     | 
    
         
             
                  def aligned_token?(range, line)
         
     | 
| 
       78 
     | 
    
         
            -
                    aligned_words?(range, line) ||
         
     | 
| 
       79 
     | 
    
         
            -
                      aligned_char?(range, line) ||
         
     | 
| 
       80 
     | 
    
         
            -
                      aligned_assignment?(range, line)
         
     | 
| 
      
 78 
     | 
    
         
            +
                    aligned_words?(range, line) || aligned_dot?(range, line) || aligned_assignment?(range, line)
         
     | 
| 
       81 
79 
     | 
    
         
             
                  end
         
     | 
| 
       82 
80 
     | 
    
         | 
| 
       83 
81 
     | 
    
         
             
                  def aligned_operator?(range, line)
         
     | 
| 
         @@ -88,8 +86,10 @@ module RuboCop 
     | 
|
| 
       88 
86 
     | 
    
         
             
                    /\s\S/.match?(line[range.column - 1, 2])
         
     | 
| 
       89 
87 
     | 
    
         
             
                  end
         
     | 
| 
       90 
88 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
                  def  
     | 
| 
       92 
     | 
    
         
            -
                    line[range.column] 
     | 
| 
      
 89 
     | 
    
         
            +
                  def aligned_dot?(range, line)
         
     | 
| 
      
 90 
     | 
    
         
            +
                    char = line[range.column]
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                    char == '.' && char == range.source[0]
         
     | 
| 
       93 
93 
     | 
    
         
             
                  end
         
     | 
| 
       94 
94 
     | 
    
         | 
| 
       95 
95 
     | 
    
         
             
                  def aligned_assignment?(range, line)
         
     | 
| 
         @@ -106,7 +106,7 @@ module RuboCop 
     | 
|
| 
       106 
106 
     | 
    
         
             
                  end
         
     | 
| 
       107 
107 
     | 
    
         | 
| 
       108 
108 
     | 
    
         
             
                  def elements(node)
         
     | 
| 
       109 
     | 
    
         
            -
                    return node.children unless  
     | 
| 
      
 109 
     | 
    
         
            +
                    return node.children unless node.call_type?
         
     | 
| 
       110 
110 
     | 
    
         | 
| 
       111 
111 
     | 
    
         
             
                    node.arguments.flat_map do |argument|
         
     | 
| 
       112 
112 
     | 
    
         
             
                      # For each argument, if it is a multi-line hash without braces,
         
     | 
| 
         @@ -142,7 +142,9 @@ module RuboCop 
     | 
|
| 
       142 
142 
     | 
    
         
             
                      end
         
     | 
| 
       143 
143 
     | 
    
         | 
| 
       144 
144 
     | 
    
         
             
                      next_token = processed_source.tokens[token_number]
         
     | 
| 
       145 
     | 
    
         
            -
                       
     | 
| 
      
 145 
     | 
    
         
            +
                      if next_token&.text&.valid_encoding? && Encoding::ENCODING_PATTERN.match?(next_token.text)
         
     | 
| 
      
 146 
     | 
    
         
            +
                        token = next_token
         
     | 
| 
      
 147 
     | 
    
         
            +
                      end
         
     | 
| 
       146 
148 
     | 
    
         | 
| 
       147 
149 
     | 
    
         
             
                      token
         
     | 
| 
       148 
150 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -31,7 +31,7 @@ module RuboCop 
     | 
|
| 
       31 
31 
     | 
    
         
             
                  #     do_something?
         
     | 
| 
       32 
32 
     | 
    
         
             
                  #   end
         
     | 
| 
       33 
33 
     | 
    
         
             
                  #
         
     | 
| 
       34 
     | 
    
         
            -
                  # @example  
     | 
| 
      
 34 
     | 
    
         
            +
                  # @example AllowedMethods: ['foo?']
         
     | 
| 
       35 
35 
     | 
    
         
             
                  #   # good
         
     | 
| 
       36 
36 
     | 
    
         
             
                  #   def foo?
         
     | 
| 
       37 
37 
     | 
    
         
             
                  #     return if condition
         
     | 
| 
         @@ -39,7 +39,7 @@ module RuboCop 
     | 
|
| 
       39 
39 
     | 
    
         
             
                  #     do_something?
         
     | 
| 
       40 
40 
     | 
    
         
             
                  #   end
         
     | 
| 
       41 
41 
     | 
    
         
             
                  #
         
     | 
| 
       42 
     | 
    
         
            -
                  # @example  
     | 
| 
      
 42 
     | 
    
         
            +
                  # @example AllowedPatterns: [/foo/]
         
     | 
| 
       43 
43 
     | 
    
         
             
                  #   # good
         
     | 
| 
       44 
44 
     | 
    
         
             
                  #   def foo?
         
     | 
| 
       45 
45 
     | 
    
         
             
                  #     return if condition
         
     | 
| 
         @@ -62,9 +62,6 @@ module RuboCop 
     | 
|
| 
       62 
62 
     | 
    
         
             
                    private
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
                    def check_for_line_terminator_or_opener
         
     | 
| 
       65 
     | 
    
         
            -
                      # Make the obvious check first
         
     | 
| 
       66 
     | 
    
         
            -
                      return unless processed_source.raw_source.include?(';')
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
65 
     | 
    
         
             
                      each_semicolon do |line, column, token_before_semicolon|
         
     | 
| 
       69 
66 
     | 
    
         
             
                        register_semicolon(line, column, false, token_before_semicolon)
         
     | 
| 
       70 
67 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -32,7 +32,7 @@ module RuboCop 
     | 
|
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                    def ensure_server!
         
     | 
| 
       34 
34 
     | 
    
         
             
                      if incompatible_version?
         
     | 
| 
       35 
     | 
    
         
            -
                         
     | 
| 
      
 35 
     | 
    
         
            +
                        warn 'RuboCop version incompatibility found, RuboCop server restarting...'
         
     | 
| 
       36 
36 
     | 
    
         
             
                        ClientCommand::Stop.new.run
         
     | 
| 
       37 
37 
     | 
    
         
             
                      elsif check_running_server
         
     | 
| 
       38 
38 
     | 
    
         
             
                        return
         
     | 
| 
         @@ -32,9 +32,9 @@ module RuboCop 
     | 
|
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                  def interpret_string_escape(escape)
         
     | 
| 
       34 
34 
     | 
    
         
             
                    case escape[1]
         
     | 
| 
       35 
     | 
    
         
            -
                    when 'u' 
     | 
| 
       36 
     | 
    
         
            -
                    when 'x' 
     | 
| 
       37 
     | 
    
         
            -
                    when /\d/ 
     | 
| 
      
 35 
     | 
    
         
            +
                    when 'u'  then interpret_unicode(escape)
         
     | 
| 
      
 36 
     | 
    
         
            +
                    when 'x'  then interpret_hex(escape)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    when /\d/ then interpret_octal(escape)
         
     | 
| 
       38 
38 
     | 
    
         
             
                    else
         
     | 
| 
       39 
39 
     | 
    
         
             
                      escape[1] # literal escaped char, like \\
         
     | 
| 
       40 
40 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -114,7 +114,7 @@ module RuboCop 
     | 
|
| 
       114 
114 
     | 
    
         
             
                end
         
     | 
| 
       115 
115 
     | 
    
         | 
| 
       116 
116 
     | 
    
         
             
                def combined_exclude_glob_patterns(base_dir)
         
     | 
| 
       117 
     | 
    
         
            -
                  exclude = @config_store.for(base_dir).for_all_cops['Exclude']
         
     | 
| 
      
 117 
     | 
    
         
            +
                  exclude = @config_store.for(base_dir).for_all_cops['Exclude'] || []
         
     | 
| 
       118 
118 
     | 
    
         
             
                  patterns = exclude.select { |pattern| pattern.is_a?(String) && pattern.end_with?('/**/*') }
         
     | 
| 
       119 
119 
     | 
    
         
             
                                    .map { |pattern| pattern.sub("#{base_dir}/", '') }
         
     | 
| 
       120 
120 
     | 
    
         
             
                  "#{base_dir}/{#{patterns.join(',')}}"
         
     | 
    
        data/lib/rubocop/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rubocop
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.54. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.54.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Bozhidar Batsov
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2023-07- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2023-07-13 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: json
         
     |