Sha256: cc97aee4662a60db27cf963c20c013994dec395392d507da91ded479e1610a0a

Contents?: true

Size: 1.13 KB

Versions: 30

Compression:

Stored size: 1.13 KB

Contents

class CoberturaReportHelper < ExtensionHelper
  def thresholds
    @thresholds ||= params[:metric_targets]
    return @thresholds if @thresholds
    @thresholds = {
      failing: [
        { type: 'type', value: 0 },
        { type: 'line', value: 0 },
        { type: 'conditional', value: 0 }
      ],
      unhealthy: [
        { type: 'type', value: 0 },
        { type: 'line', value: 0 },
        { type: 'conditional', value: 0 }
      ],
      healthy: [
        { type: 'type', value: 80 },
        { type: 'line', value: 80 },
        { type: 'conditional', value: 70 }
      ]
    }
  end

  def send_metric_targets(target)
    name = "#{target}Target"

    builder.instance_exec self do |helper|
      send name do
        targets 'class' => 'enum-map', 'enum-type' => 'hudson.plugins.cobertura.targets.CoverageMetric' do
          helper.thresholds[target].each do |threshold|
            entry do
              send('hudson.plugins.cobertura.targets.CoverageMetric') { text threshold[:type].upcase }
              send('int') { text(threshold[:value] * 100_000).to_i }
            end
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
jenkins_pipeline_builder-1.7.0 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.5.0 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.3.0 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.2.1 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.2.0 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.1.5 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.1.4 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.1.3 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.1.2 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.1.0 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-1.0.0 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-0.16.3 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-0.16.2 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-0.16.0 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-0.15.3 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-0.15.2 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-0.15.1 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-0.14.0 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-0.13.4 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb
jenkins_pipeline_builder-0.13.3 lib/jenkins_pipeline_builder/extensions/helpers/publishers/cobertura_report_helper.rb