quality_report 1.1.0 → 1.2.1
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/exe/ruby-author-warnings +6 -4
 - data/exe/ruby-line-authors +2 -2
 - data/exe/ruby-quality-report +21 -3
 - data/lib/quality_report/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 785b3f8f1849bde2c8560649adb885378ed518fe2e1649563b9676c0b3092505
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8066dde819e3898070466dab995afdfac899593618dd75cafb21af769c8b3f6f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f78bf436f4c3d9761999086216e8a488e16a300198c78548c4d0650f3e9b1f6e584393c72b7a14ee5efd21d7b8495ab3433325bb483ce6f7bc48e9a748e250c6
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1c4d81492b461f9592bfc9d24995f3378687aafca674fc4f6102ff2cd37cfac69964557ff1a3d4f1b301a60fee79e33d6b16716207083824092953827cd3f04f
         
     | 
    
        data/exe/ruby-author-warnings
    CHANGED
    
    | 
         @@ -21,10 +21,12 @@ RUBOCOP_WARNINGS = `rubocop --format json --force-default-config --only Metrics/ 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
            LOCATIONS =
         
     | 
| 
       23 
23 
     | 
    
         
             
              JSON
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
              .parse(RUBOCOP_WARNINGS)['files']
         
     | 
| 
      
 25 
     | 
    
         
            +
              .reject { |f| f['offenses'].empty? }
         
     | 
| 
      
 26 
     | 
    
         
            +
              .map do |f|
         
     | 
| 
      
 27 
     | 
    
         
            +
                f['offenses']
         
     | 
| 
      
 28 
     | 
    
         
            +
                  .map { |o| { path: f['path'], begin: o['location']['start_line'], end: o['location']['last_line'] } }
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
       28 
30 
     | 
    
         
             
                .flatten
         
     | 
| 
       29 
31 
     | 
    
         | 
| 
       30 
32 
     | 
    
         
             
            LOCATIONS.each do |location|
         
     | 
    
        data/exe/ruby-line-authors
    CHANGED
    
    
    
        data/exe/ruby-quality-report
    CHANGED
    
    | 
         @@ -31,7 +31,7 @@ def make_data_set(two_column_data) 
     | 
|
| 
       31 
31 
     | 
    
         
             
              hash = {}
         
     | 
| 
       32 
32 
     | 
    
         
             
              two_column_data.each_line do |line|
         
     | 
| 
       33 
33 
     | 
    
         
             
                count, label = line.split(' ')
         
     | 
| 
       34 
     | 
    
         
            -
                hash[label] 
     | 
| 
      
 34 
     | 
    
         
            +
                hash[label]  = count.to_i
         
     | 
| 
       35 
35 
     | 
    
         
             
              end
         
     | 
| 
       36 
36 
     | 
    
         
             
              hash
         
     | 
| 
       37 
37 
     | 
    
         
             
            end
         
     | 
| 
         @@ -62,9 +62,27 @@ def generate_data(combined_stats) 
     | 
|
| 
       62 
62 
     | 
    
         
             
            end
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
            def should_skip?(stats)
         
     | 
| 
      
 65 
     | 
    
         
            +
              less_than_200_lines_total?(stats) || no_commits_in_last_60_days?(stats)
         
     | 
| 
      
 66 
     | 
    
         
            +
            end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            def less_than_200_lines_total?(stats)
         
     | 
| 
       65 
69 
     | 
    
         
             
              stats[:whole_count] < 200
         
     | 
| 
       66 
70 
     | 
    
         
             
            end
         
     | 
| 
       67 
71 
     | 
    
         | 
| 
      
 72 
     | 
    
         
            +
            def no_commits_in_last_60_days?(stats)
         
     | 
| 
      
 73 
     | 
    
         
            +
              author = stats[:label]
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
              # Get the last commit timestamp in Unix epoch format
         
     | 
| 
      
 76 
     | 
    
         
            +
              last_commit = `git log -1 --format="%at" --author="#{author}"`.chomp
         
     | 
| 
      
 77 
     | 
    
         
            +
              return true if last_commit.empty? # Handle case where author has no commits
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
              # Convert Unix timestamp to Time object
         
     | 
| 
      
 80 
     | 
    
         
            +
              last_commit_time = Time.at(last_commit.to_i)
         
     | 
| 
      
 81 
     | 
    
         
            +
              sixty_days_ago   = Time.now - (60 * 24 * 60 * 60) # 60 days in seconds
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
              last_commit_time < sixty_days_ago
         
     | 
| 
      
 84 
     | 
    
         
            +
            end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
       68 
86 
     | 
    
         
             
            def float_to_percent(a_float)
         
     | 
| 
       69 
87 
     | 
    
         
             
              (Float(a_float) * 100).round(1)
         
     | 
| 
       70 
88 
     | 
    
         
             
            end
         
     | 
| 
         @@ -72,8 +90,8 @@ end 
     | 
|
| 
       72 
90 
     | 
    
         
             
            #
         
     | 
| 
       73 
91 
     | 
    
         
             
            # Execution begins here
         
     | 
| 
       74 
92 
     | 
    
         
             
            #
         
     | 
| 
       75 
     | 
    
         
            -
            PART_STATS     = `ruby-author-warnings | frequency-list 
     | 
| 
       76 
     | 
    
         
            -
            WHOLE_STATS    = `ruby-line-authors | frequency-list 
     | 
| 
      
 93 
     | 
    
         
            +
            PART_STATS     = `ruby-author-warnings | frequency-list`.freeze
         
     | 
| 
      
 94 
     | 
    
         
            +
            WHOLE_STATS    = `ruby-line-authors | frequency-list`.freeze
         
     | 
| 
       77 
95 
     | 
    
         
             
            COMBINED_STATS = create_combined_stats(PART_STATS, WHOLE_STATS)
         
     | 
| 
       78 
96 
     | 
    
         | 
| 
       79 
97 
     | 
    
         
             
            puts generate_table(COMBINED_STATS)
         
     |