All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sonar-plugins.sonar-widget-lab-plugin.1.7.source-code.alt_rules_compliance_widget.html.erb Maven / Gradle / Ivy

The newest version!
<%
  [email protected]('violations_density')
  [email protected]('weighted_violations')

  [email protected]('violations')
  [email protected]('new_violations')

  blocker_violations = @snapshot.measure('blocker_violations')
  new_blocker_violations = @snapshot.measure('new_blocker_violations')

  critical_violations = @snapshot.measure('critical_violations')
  new_critical_violations = @snapshot.measure('new_critical_violations')

  major_violations = @snapshot.measure('major_violations')
  new_major_violations = @snapshot.measure('new_major_violations')

  minor_violations = @snapshot.measure('minor_violations')
  new_minor_violations = @snapshot.measure('new_minor_violations')

  info_violations = @snapshot.measure('info_violations')
  new_info_violations = @snapshot.measure('new_info_violations')

  technical_debt = @snapshot.measure('sqale_index')
  new_technical_debt = @snapshot.measure('new_technical_debt')

  measures=[blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations]
  values=measures.map{|m| m ? (m.value||0) : 0}
  new_values=[new_blocker_violations,new_critical_violations,new_major_violations,new_minor_violations,new_info_violations,new_violations]
  priorities=['BLOCKER','CRITICAL','MAJOR','MINOR','INFO','']

  if dashboard_configuration.selected_period?
    tmp_values=measures.map{|m| m ? (m.variation(dashboard_configuration.period_index)||0) : 0}
    new_values=new_values.map{|m| m ? (m.variation(dashboard_configuration.period_index)||0) : 0}
    cleared_values=tmp_values.each_with_index.map{|n,i| (n - new_values[i]).abs}
  max=new_values.zip(cleared_values).map{|val| val.inject(:+).abs}.max
  else
  max=values.map{|val| val.abs}.max
  end
%>

<%= message('widget.rules-alt.title') -%>

<%= format_measure(weighted_violations, :url => url_for_drilldown('weighted_violations', {:highlight => 'weighted_violations'})) -%> <%= dashboard_configuration.selected_period? ? format_variation(weighted_violations) : trend_icon(weighted_violations) -%>
<% if technical_debt && widget_properties['showTechDebt']%>

<%= message('widget.rules.technical_debt') -%>

<%= format_measure(technical_debt) -%> <%= dashboard_configuration.selected_period? ? format_variation(technical_debt) : trend_icon(technical_debt) -%> <% if @dashboard_configuration.selected_period? technical_debt_variation = variation_value(technical_debt) new_technical_debt_variation = variation_value(new_technical_debt) estimated_cleared_technical_debt = (new_technical_debt_variation - technical_debt_variation).to_f if technical_debt_variation && new_technical_debt_variation %> <% if new_technical_debt_variation && new_technical_debt_variation > 0 %>
<%= message('widget.rules.added') -%>  <%= format_variation(new_technical_debt, :style => 'none', :default => '-') -%> <% end %> <% if estimated_cleared_technical_debt && estimated_cleared_technical_debt > 0 %>
<%= message('widget.rules.removed') -%>  <%= Internal.i18n.formatLongDuration(estimated_cleared_technical_debt.to_i, 'SHORT') -%> <% end %> <% end %>
<% end %> <% if technical_debt && widget_properties['showCompliance']%>

<%= message('widget.rules.rules_compliance') -%>

<%= format_measure(density, :url => url_for_drilldown('weighted_violations', {:highlight => 'weighted_violations'})) -%> <%= dashboard_configuration.selected_period? ? format_variation(density) : trend_icon(density) -%>
<% end %>
<%for idx in 0..5%> <% if priorities[idx].empty? %> <% else %> <% end %> <%end%>
   <%= message('widget.rules-alt.total.suffix') -%><%= image_tag 'priority/'.concat(priorities[idx]).concat('.png')%>  <%= link_to message(priorities[idx].downcase), {:controller => 'drilldown', :action => 'issues', :id => @project.key, :severity => priorities[idx], :period => dashboard_configuration.period_index} %> <%= format_measure(measures[idx]) -%> <% if dashboard_configuration.selected_period? %> (-<%= cleared_values[idx].to_i -%>/+<%= new_values[idx].to_i -%>) <% else %> <%= trend_icon(measures[idx], :empty => true) -%> <% end %> <% if max > 0 %> <% if dashboard_configuration.selected_period? %> <% clearedSize=(35 * (cleared_values[idx] / max)).to_i%>
<%= barchart(:width => clearedSize, :color => '#078C00') %> <%= barchart(:width => 35, :percent => ((100 * new_values[idx] / max).to_i), :color => '#cc0000') %> <% else %> <%= barchart(:width => 70, :percent => (100 * values[idx] / max).to_i) %> <% end %> <% end %>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy