danger-compose_compiler_metrics 0.0.1 → 0.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
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 5174bc2092a2c48fa3a84c6cb7006b0836fc9ccdc55f647efad88cc3fbd52e65
         | 
| 4 | 
            +
              data.tar.gz: de4c9958f624409b65e36aa49d5b001de6f474e79c43afe51a42011f1150ac91
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4543a2ecc312efe6d7357acaf70e19bf84d4f2938cc525b9c33db740f04aee929acc7c2cdd17a98c5cb112bb3d3595654ac92498d3bf5de665e246608ea7e3b3
         | 
| 7 | 
            +
              data.tar.gz: 77d0f263a40a8286b3b36cc6a3dc2bf6b3dff3370e91717d5bdefd4ed824ddecb067c8f14a9c70c1e8d000a35867817e66895f16701d9f653cef050f86fb251b
         | 
| @@ -10,89 +10,64 @@ module Danger | |
| 10 10 | 
             
                include Helper
         | 
| 11 11 |  | 
| 12 12 | 
             
                def report_difference(metrics_dir, base_metrics_dir)
         | 
| 13 | 
            -
                   | 
| 13 | 
            +
                  unless installed?("diff")
         | 
| 14 | 
            +
                    error "diff command not found. Please install diff command."
         | 
| 15 | 
            +
                    return
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  markdown("# Compose Compiler Metrics Difference Report")
         | 
| 14 19 | 
             
                  build_variants(metrics_dir).each do |module_name, build_variant|
         | 
| 15 20 | 
             
                    markdown("## #{module_name} - #{build_variant}")
         | 
| 16 21 |  | 
| 17 22 | 
             
                    # Metrics Report
         | 
| 18 23 | 
             
                    metrics_path = File.join(metrics_dir, metrics_filename(module_name, build_variant))
         | 
| 19 24 | 
             
                    base_metrics_path = File.join(base_metrics_dir, metrics_filename(module_name, build_variant))
         | 
| 20 | 
            -
                     | 
| 21 | 
            -
             | 
| 22 | 
            -
                    markdown(
         | 
| 23 | 
            -
                      folding(
         | 
| 24 | 
            -
                        '### Metrics',
         | 
| 25 | 
            -
                        if report.empty?
         | 
| 26 | 
            -
                          'No difference found.'
         | 
| 27 | 
            -
                        else
         | 
| 28 | 
            -
                          <<~MARKDOWN
         | 
| 29 | 
            -
                          ```diff
         | 
| 30 | 
            -
                          #{report}
         | 
| 31 | 
            -
                          ```
         | 
| 32 | 
            -
                          MARKDOWN
         | 
| 33 | 
            -
                        end
         | 
| 34 | 
            -
                      )
         | 
| 35 | 
            -
                    )
         | 
| 25 | 
            +
                    report_file_difference("Metrics", metrics_path, base_metrics_path)
         | 
| 36 26 |  | 
| 37 27 | 
             
                    # Composable Stats Report
         | 
| 38 28 | 
             
                    composable_stats_report_path = File.join(metrics_dir, composable_stats_report_path(module_name, build_variant))
         | 
| 39 29 | 
             
                    base_composable_stats_report_path = File.join(base_metrics_dir, composable_stats_report_path(module_name, build_variant))
         | 
| 40 | 
            -
                     | 
| 41 | 
            -
             | 
| 42 | 
            -
                    markdown(
         | 
| 43 | 
            -
                      folding(
         | 
| 44 | 
            -
                        '### Composable Stats Report',
         | 
| 45 | 
            -
                        if report.empty?
         | 
| 46 | 
            -
                          'No difference found.'
         | 
| 47 | 
            -
                        else
         | 
| 48 | 
            -
                          <<~MARKDOWN
         | 
| 49 | 
            -
                          ```diff
         | 
| 50 | 
            -
                          #{report}
         | 
| 51 | 
            -
                          ```
         | 
| 52 | 
            -
                          MARKDOWN
         | 
| 53 | 
            -
                        end
         | 
| 54 | 
            -
                      )
         | 
| 55 | 
            -
                    )
         | 
| 30 | 
            +
                    report_file_difference("Composable Stats Report", composable_stats_report_path, base_composable_stats_report_path)
         | 
| 56 31 |  | 
| 57 32 | 
             
                    # Composable Report
         | 
| 58 33 | 
             
                    composable_report_path = File.join(metrics_dir, composable_report_path(module_name, build_variant))
         | 
| 59 34 | 
             
                    base_composable_report_path = File.join(base_metrics_dir, composable_report_path(module_name, build_variant))
         | 
| 60 | 
            -
                     | 
| 61 | 
            -
             | 
| 62 | 
            -
                    markdown(
         | 
| 63 | 
            -
                      folding(
         | 
| 64 | 
            -
                        '### Composable Report',
         | 
| 65 | 
            -
                        if report.empty?
         | 
| 66 | 
            -
                          'No difference found.'
         | 
| 67 | 
            -
                        else
         | 
| 68 | 
            -
                          <<~MARKDOWN
         | 
| 69 | 
            -
                          ```diff
         | 
| 70 | 
            -
                          #{report}
         | 
| 71 | 
            -
                          ```
         | 
| 72 | 
            -
                          MARKDOWN
         | 
| 73 | 
            -
                        end
         | 
| 74 | 
            -
                      )
         | 
| 75 | 
            -
                    )
         | 
| 35 | 
            +
                    report_file_difference("Composable Report", composable_report_path, base_composable_report_path)
         | 
| 76 36 |  | 
| 77 37 | 
             
                    # Class Report
         | 
| 78 38 | 
             
                    class_report_path = File.join(metrics_dir, class_report_path(module_name, build_variant))
         | 
| 79 39 | 
             
                    base_class_report_path = File.join(base_metrics_dir, class_report_path(module_name, build_variant))
         | 
| 80 | 
            -
                     | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
                      )
         | 
| 94 | 
            -
                    )
         | 
| 40 | 
            +
                    report_file_difference("Composable Report", class_report_path, base_class_report_path)
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                def report_file_difference(title, metrics_path, base_metrics_path)
         | 
| 45 | 
            +
                  unless File.exist?(metrics_path)
         | 
| 46 | 
            +
                    warn "DangerComposeCompilerMetrics: new file not found at #{metrics_path}. Skipping file difference report."
         | 
| 47 | 
            +
                    return
         | 
| 48 | 
            +
                  end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                  unless File.exist?(base_metrics_path)
         | 
| 51 | 
            +
                    warn "DangerComposeCompilerMetrics: reference file not found at #{base_metrics_path}. Skipping file difference report."
         | 
| 52 | 
            +
                    return
         | 
| 95 53 | 
             
                  end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                  report = `diff -u #{base_metrics_path} #{metrics_path}`
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                  markdown(
         | 
| 58 | 
            +
                    folding(
         | 
| 59 | 
            +
                      "### #{title}",
         | 
| 60 | 
            +
                      if report.empty?
         | 
| 61 | 
            +
                        "No difference found."
         | 
| 62 | 
            +
                      else
         | 
| 63 | 
            +
                        <<~MARKDOWN
         | 
| 64 | 
            +
                        ```diff
         | 
| 65 | 
            +
                        #{report}
         | 
| 66 | 
            +
                        ```
         | 
| 67 | 
            +
                        MARKDOWN
         | 
| 68 | 
            +
                      end
         | 
| 69 | 
            +
                    )
         | 
| 70 | 
            +
                  )
         | 
| 96 71 | 
             
                end
         | 
| 97 72 |  | 
| 98 73 | 
             
                def report(metrics_dir)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: danger-compose_compiler_metrics
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Tomoki Yamashita
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024-02- | 
| 11 | 
            +
            date: 2024-02-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: danger-plugin-api
         |