github_repo_statistics 2.2.27 → 2.2.29
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
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8841de37fee015b614072106fd7a7753f081744a54b86de099188127ecf509ab
         | 
| 4 | 
            +
              data.tar.gz: 4193b4ba131d09344cc59918e3972883084ddd5ee3cb04caa01cdc35de966449
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 43143569d88a3d8b666531ef76311c73d3801da1a830ed6c125398ef02c73ddfd54e6d8b90dfedc324eb21d77c6ceed646f20fda59f283be2c6c4e00f087cbc4
         | 
| 7 | 
            +
              data.tar.gz: e57bff89312909805541d04d6c83ce657d06006f16bc7e199cdf51c2dec90183ee1eed5bffe7939d77c4bae24d4a26e797209256b8f594e69dc1660b27c4f966
         | 
| @@ -192,6 +192,13 @@ class GithubRepoStatistics | |
| 192 192 | 
             
                  filename = File.basename(file)
         | 
| 193 193 | 
             
                  commit_count = git_commit_count(file:, start_date:, end_date:).to_i
         | 
| 194 194 | 
             
                  git_log = git_commit_info(file:, start_date:, end_date:).split("\n")
         | 
| 195 | 
            +
                  prs = git_log.map do |pr|
         | 
| 196 | 
            +
                    match = pr.match(/#(\d+)/)
         | 
| 197 | 
            +
                    if match
         | 
| 198 | 
            +
                      match[0]
         | 
| 199 | 
            +
                    end
         | 
| 200 | 
            +
                  end.uniq
         | 
| 201 | 
            +
             | 
| 195 202 | 
             
                  teams = git_log.map do |team|
         | 
| 196 203 | 
             
                    team.match(/#{TEAM_REGEX}/)[0].upcase
         | 
| 197 204 | 
             
                  end.reject { |e| EXCLUSIONS&.include?(e) }
         | 
| @@ -202,7 +209,7 @@ class GithubRepoStatistics | |
| 202 209 |  | 
| 203 210 | 
             
                  if teams.count > 1
         | 
| 204 211 | 
             
                    files_changed_by_many_teams += 1
         | 
| 205 | 
            -
                    file_team_map.merge!(file.to_s => [teams, commit_count])
         | 
| 212 | 
            +
                    file_team_map.merge!(file.to_s => [teams, prs, commit_count])
         | 
| 206 213 | 
             
                    cross_teams_count += teams.count
         | 
| 207 214 | 
             
                  else
         | 
| 208 215 | 
             
                    single_ownership_teams_count += 1
         | 
| @@ -225,8 +232,8 @@ class GithubRepoStatistics | |
| 225 232 |  | 
| 226 233 | 
             
              def contribution_message
         | 
| 227 234 | 
             
                duration_in_days = @duration_in_days.to_i
         | 
| 228 | 
            -
                start_date = @begin_time.to_time.to_i - duration_in_days * 86_400 | 
| 229 | 
            -
                end_date = @begin_time.to_time.to_i | 
| 235 | 
            +
                start_date = @begin_time.to_time.to_i - duration_in_days * 86_400
         | 
| 236 | 
            +
                end_date = @begin_time.to_time.to_i
         | 
| 230 237 | 
             
                git_ls = git_files(directory_path: @directory_path)
         | 
| 231 238 | 
             
                file_count = filter_existing_code_files(git_ls.split).count
         | 
| 232 239 | 
             
                all_files_with_changes = files_with_changes(directory_path: @directory_path, start_date:, end_date:).split.sort
         | 
| @@ -238,7 +245,7 @@ class GithubRepoStatistics | |
| 238 245 | 
             
                occurrences = all_teams.flatten.compact.tally
         | 
| 239 246 | 
             
                sorted_occurrences = occurrences.sort_by { |element, count| [-count, element] }
         | 
| 240 247 | 
             
                contributors = Hash[sorted_occurrences]
         | 
| 241 | 
            -
                churn_count = file_team_map.values.map { |value| value | 
| 248 | 
            +
                churn_count = file_team_map.values.map { |value| value.last }.sum
         | 
| 242 249 | 
             
                hotspot_changes_percentage = ((churn_count.to_f / total_changes) * 100).round(2)
         | 
| 243 250 | 
             
                # Filter files based on extension, existence and size
         | 
| 244 251 | 
             
                filtered_files = filter_files(file_team_map:)
         | 
| @@ -322,15 +329,16 @@ class GithubRepoStatistics | |
| 322 329 | 
             
                    lines_of_code = count_lines_of_code(file)
         | 
| 323 330 | 
             
                    commits = line.last.last
         | 
| 324 331 | 
             
                    owner = find_owner(file:)
         | 
| 332 | 
            +
                    prs = line.last[1]
         | 
| 325 333 |  | 
| 326 | 
            -
                    hotspot_output << [file.gsub(@directory_path, ''), contributors, lines_of_code, commits, owner]
         | 
| 334 | 
            +
                    hotspot_output << [file.gsub(@directory_path, ''), contributors, lines_of_code, commits, owner, prs]
         | 
| 327 335 | 
             
                  end
         | 
| 328 336 |  | 
| 329 337 | 
             
                  hotspot_output.sort_by! { |row| -row[2] }
         | 
| 330 338 |  | 
| 331 339 | 
             
                  if FILE_OUTPUT
         | 
| 332 340 | 
             
                    CSV.open('hotspot.csv', 'w') do |csv|
         | 
| 333 | 
            -
                      csv << ['File', 'Contributors', 'Lines', 'Commits', 'Owner']
         | 
| 341 | 
            +
                      csv << ['File', 'Contributors', 'Lines', 'Commits', 'Owner', 'PRs']
         | 
| 334 342 | 
             
                      hotspot_output.each do |row|
         | 
| 335 343 | 
             
                        csv << row
         | 
| 336 344 | 
             
                      end
         | 
| @@ -338,7 +346,7 @@ class GithubRepoStatistics | |
| 338 346 | 
             
                  else
         | 
| 339 347 | 
             
                    puts "\n   *Hotspot files(#{filtered_top_touched_files.count}):*\n"
         | 
| 340 348 | 
             
                    hotspot_output.each do |row|
         | 
| 341 | 
            -
                      puts "     #{row[0]} Contributors: #{row[1]} Lines: #{row[2]} Commits: #{row[3]} Owner: #{row[4]}"
         | 
| 349 | 
            +
                      puts "     #{row[0]} Contributors: #{row[1]} Lines: #{row[2]} Commits: #{row[3]} Owner: #{row[4]} PRs: #{row[5]}"
         | 
| 342 350 | 
             
                    end
         | 
| 343 351 | 
             
                  end
         | 
| 344 352 | 
             
                end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: github_repo_statistics
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.2. | 
| 4 | 
            +
              version: 2.2.29
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Serghei Moret
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024-05- | 
| 11 | 
            +
            date: 2024-05-07 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: date
         |