checkstyle_filter-git 1.0.1 → 1.0.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/checkstyle_filter/git/filter.rb +9 -25
- data/lib/checkstyle_filter/git/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 48c2ee1c9b3596966f7f0ea3213e6f18aec1dbf4
         | 
| 4 | 
            +
              data.tar.gz: a4848b617efeed1117ca57791c78a69c1bb23468
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 51445acca2a43ef41b9cdf4ea65e0df762f2034f69519ee9e8bf5041a13b0148fdce53f16e17910d927ccfca4e957ddf3d2293908fbdb1290af806e70c24f443
         | 
| 7 | 
            +
              data.tar.gz: a3e6c37e3bda2c783cdfb81f8f1c4669b3f7d4d62b23e83dc9ea1fff86b9963d857a291f25046f447913aa042632181fad648f5589635f379cb5e257c052da7c
         | 
| @@ -10,10 +10,12 @@ module CheckstyleFilter | |
| 10 10 | 
             
                    document = REXML::Document.new data
         | 
| 11 11 | 
             
                    document.elements.each('/checkstyle/file') do |file_element|
         | 
| 12 12 | 
             
                      file_name = file_element.attribute('name') && file_element.attribute('name').value
         | 
| 13 | 
            -
                       | 
| 13 | 
            +
                      file = file_relative_path_string(file_name)
         | 
| 14 | 
            +
                      patch = patches.find_patch_by_file(file)
         | 
| 15 | 
            +
                      if patch
         | 
| 14 16 | 
             
                        file_element.elements.each('error') do |error_element|
         | 
| 15 17 | 
             
                          line = error_element.attribute('line') && error_element.attribute('line').value.to_i
         | 
| 16 | 
            -
                          unless  | 
| 18 | 
            +
                          unless patch.changed_line_numbers.include?(line)
         | 
| 17 19 | 
             
                            error_element.remove
         | 
| 18 20 | 
             
                          end
         | 
| 19 21 | 
             
                        end
         | 
| @@ -27,30 +29,12 @@ module CheckstyleFilter | |
| 27 29 | 
             
                    document.to_s
         | 
| 28 30 | 
             
                  end
         | 
| 29 31 |  | 
| 30 | 
            -
                  def self. | 
| 31 | 
            -
                     | 
| 32 | 
            -
                      . | 
| 33 | 
            -
             | 
| 34 | 
            -
                      . | 
| 35 | 
            -
                  end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                  def self.file_element_error_line_no_in_patches?(file_name, patches, line_no)
         | 
| 38 | 
            -
                    diff_patches = patches
         | 
| 39 | 
            -
                                   .select { |patch| same_file?(patch.file, file_name) }
         | 
| 40 | 
            -
                    return false if diff_patches.empty?
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                    modified_lines = Set.new
         | 
| 43 | 
            -
                    diff_patches.map do |patch|
         | 
| 44 | 
            -
                      patch.changed_lines.map do |line|
         | 
| 45 | 
            -
                        modified_lines << line.number
         | 
| 46 | 
            -
                      end
         | 
| 32 | 
            +
                  def self.file_relative_path_string(file_name)
         | 
| 33 | 
            +
                    if Pathname.new(file_name).absolute?
         | 
| 34 | 
            +
                      Pathname.new(file_name).relative_path_from(Pathname.new(Dir.pwd)).to_s
         | 
| 35 | 
            +
                    else
         | 
| 36 | 
            +
                      Pathname.new(file_name).relative_path_from(Pathname.new('.')).to_s
         | 
| 47 37 | 
             
                    end
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                    modified_lines.include?(line_no)
         | 
| 50 | 
            -
                  end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                  def self.same_file?(one, other)
         | 
| 53 | 
            -
                    Pathname.new(one).expand_path == Pathname.new(other).expand_path
         | 
| 54 38 | 
             
                  end
         | 
| 55 39 | 
             
                end
         | 
| 56 40 | 
             
              end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: checkstyle_filter-git
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - sanemat
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-02- | 
| 11 | 
            +
            date: 2015-02-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: thor
         |