@@ -37,7 +37,6 @@ public class ViolationsDecorator implements Decorator { | |||
// temporary data for current resource | |||
private Multiset<Rule> rules = HashMultiset.create(); | |||
private Multiset<Integer> categories = HashMultiset.create(); | |||
private Multiset<RulePriority> priorities = HashMultiset.create(); | |||
private Map<Rule, RulePriority> ruleToLevel = new HashMap<Rule, RulePriority>(); | |||
private int total = 0; | |||
@@ -49,8 +48,7 @@ public class ViolationsDecorator implements Decorator { | |||
@DependedUpon | |||
public List<Metric> generatesViolationsMetrics() { | |||
return Arrays.asList(CoreMetrics.VIOLATIONS, | |||
CoreMetrics.BLOCKER_VIOLATIONS, CoreMetrics.CRITICAL_VIOLATIONS, CoreMetrics.MAJOR_VIOLATIONS, CoreMetrics.MINOR_VIOLATIONS, CoreMetrics.INFO_VIOLATIONS, | |||
CoreMetrics.USABILITY, CoreMetrics.MAINTAINABILITY, CoreMetrics.EFFICIENCY, CoreMetrics.PORTABILITY, CoreMetrics.RELIABILITY); | |||
CoreMetrics.BLOCKER_VIOLATIONS, CoreMetrics.CRITICAL_VIOLATIONS, CoreMetrics.MAJOR_VIOLATIONS, CoreMetrics.MINOR_VIOLATIONS, CoreMetrics.INFO_VIOLATIONS); | |||
} | |||
public void decorate(Resource resource, DecoratorContext context) { | |||
@@ -65,7 +63,6 @@ public class ViolationsDecorator implements Decorator { | |||
private void resetCounters() { | |||
rules.clear(); | |||
categories.clear(); | |||
priorities.clear(); | |||
ruleToLevel.clear(); | |||
total = 0; | |||
@@ -76,7 +73,6 @@ public class ViolationsDecorator implements Decorator { | |||
countCurrentResourceViolations(context); | |||
saveTotalViolations(context); | |||
saveViolationsByPriority(context); | |||
saveViolationsByCategory(context); | |||
saveViolationsByRule(context); | |||
} | |||
@@ -105,18 +101,6 @@ public class ViolationsDecorator implements Decorator { | |||
return metric; | |||
} | |||
private void saveViolationsByCategory(DecoratorContext context) { | |||
Collection<Measure> children = context.getChildrenMeasures(MeasuresFilters.ruleCategories(CoreMetrics.VIOLATIONS)); | |||
for (Measure childMeasure : children) { | |||
RuleMeasure childCategMeasure = (RuleMeasure) childMeasure; | |||
categories.add(childCategMeasure.getRuleCategory(), childCategMeasure.getValue().intValue()); | |||
} | |||
for (Multiset.Entry<Integer> entry : categories.entrySet()) { | |||
context.saveMeasure(RuleMeasure.createForCategory(CoreMetrics.VIOLATIONS, entry.getElement(), (double) entry.getCount())); | |||
} | |||
} | |||
private void saveViolationsByRule(DecoratorContext context) { | |||
Collection<Measure> children = context.getChildrenMeasures(MeasuresFilters.rules(CoreMetrics.VIOLATIONS)); | |||
for (Measure childMeasure : children) { | |||
@@ -130,7 +114,6 @@ public class ViolationsDecorator implements Decorator { | |||
for (Multiset.Entry<Rule> entry : rules.entrySet()) { | |||
Rule rule = entry.getElement(); | |||
RuleMeasure measure = RuleMeasure.createForRule(CoreMetrics.VIOLATIONS, rule, (double) entry.getCount()); | |||
measure.setRuleCategory(rule.getCategoryId()); | |||
measure.setRulePriority(ruleToLevel.get(rule)); | |||
context.saveMeasure(measure); | |||
} | |||
@@ -146,7 +129,6 @@ public class ViolationsDecorator implements Decorator { | |||
List<Violation> violations = context.getViolations(); | |||
for (Violation violation : violations) { | |||
rules.add(violation.getRule()); | |||
categories.add(violation.getRule().getCategoryId()); | |||
priorities.add(violation.getPriority()); | |||
ruleToLevel.put(violation.getRule(), violation.getPriority()); | |||
} |
@@ -23,45 +23,18 @@ import org.sonar.api.batch.Decorator; | |||
import org.sonar.api.batch.DecoratorContext; | |||
import org.sonar.api.batch.DependedUpon; | |||
import org.sonar.api.batch.DependsUpon; | |||
import org.sonar.jpa.dao.RulesDao; | |||
import org.sonar.api.measures.*; | |||
import org.sonar.api.measures.CoreMetrics; | |||
import org.sonar.api.measures.Measure; | |||
import org.sonar.api.measures.MeasureUtils; | |||
import org.sonar.api.measures.Metric; | |||
import org.sonar.api.resources.Project; | |||
import org.sonar.api.resources.Resource; | |||
import org.sonar.api.resources.ResourceUtils; | |||
import org.sonar.api.rules.Iso9126RulesCategories; | |||
import org.sonar.api.rules.RulesCategory; | |||
import java.util.*; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
public class ViolationsDensityDecorator implements Decorator { | |||
private Map<Integer, Metric> metricByCategoryId; | |||
public ViolationsDensityDecorator(RulesDao rulesDao) { | |||
metricByCategoryId = new HashMap<Integer, Metric>(); | |||
for (RulesCategory category : rulesDao.getCategories()) { | |||
if (category.equals(Iso9126RulesCategories.EFFICIENCY)) { | |||
metricByCategoryId.put(category.getId(), CoreMetrics.EFFICIENCY); | |||
} else if (category.equals(Iso9126RulesCategories.MAINTAINABILITY)) { | |||
metricByCategoryId.put(category.getId(), CoreMetrics.MAINTAINABILITY); | |||
} else if (category.equals(Iso9126RulesCategories.PORTABILITY)) { | |||
metricByCategoryId.put(category.getId(), CoreMetrics.PORTABILITY); | |||
} else if (category.equals(Iso9126RulesCategories.RELIABILITY)) { | |||
metricByCategoryId.put(category.getId(), CoreMetrics.RELIABILITY); | |||
} else if (category.equals(Iso9126RulesCategories.USABILITY)) { | |||
metricByCategoryId.put(category.getId(), CoreMetrics.USABILITY); | |||
} | |||
} | |||
} | |||
protected ViolationsDensityDecorator(Map<Integer, Metric> metricByCategoryId) { | |||
this.metricByCategoryId = metricByCategoryId; | |||
} | |||
public boolean shouldExecuteOnProject(Project project) { | |||
return true; | |||
} | |||
@@ -78,7 +51,7 @@ public class ViolationsDensityDecorator implements Decorator { | |||
public void decorate(Resource resource, DecoratorContext context) { | |||
if (shouldDecorateResource(context)) { | |||
decorateDensity(resource, context); | |||
decorateDensity(context); | |||
} | |||
} | |||
@@ -86,13 +59,10 @@ public class ViolationsDensityDecorator implements Decorator { | |||
return context.getMeasure(CoreMetrics.VIOLATIONS_DENSITY) == null; | |||
} | |||
private void decorateDensity(Resource resource, DecoratorContext context) { | |||
private void decorateDensity(DecoratorContext context) { | |||
Measure ncloc = context.getMeasure(CoreMetrics.NCLOC); | |||
if (MeasureUtils.hasValue(ncloc) && ncloc.getValue() > 0.0) { | |||
saveDensity(context, ncloc.getValue().intValue()); | |||
if (ResourceUtils.isSpace(resource) || ResourceUtils.isSet(resource)) { | |||
saveDensityByCategory(context, ncloc.getValue().intValue()); | |||
} | |||
} | |||
} | |||
@@ -112,27 +82,6 @@ public class ViolationsDensityDecorator implements Decorator { | |||
return rci; | |||
} | |||
private void saveDensityByCategory(DecoratorContext context, int ncloc) { | |||
Collection<RuleMeasure> categDebts = context.getMeasures(MeasuresFilters.ruleCategories(CoreMetrics.WEIGHTED_VIOLATIONS)); | |||
Set<Integer> categIdsDone = new HashSet<Integer>(); | |||
if (categDebts != null) { | |||
for (RuleMeasure categDebt : categDebts) { | |||
if (MeasureUtils.hasValue(categDebt)) { | |||
double density = calculate(categDebt.getValue().intValue(), ncloc); | |||
context.saveMeasure(RuleMeasure.createForCategory( | |||
CoreMetrics.VIOLATIONS_DENSITY, categDebt.getRuleCategory(), density)); | |||
context.saveMeasure(metricByCategoryId.get(categDebt.getRuleCategory()), density); | |||
categIdsDone.add(categDebt.getRuleCategory()); | |||
} | |||
} | |||
} | |||
for (Map.Entry<Integer, Metric> entry : metricByCategoryId.entrySet()) { | |||
if (!categIdsDone.contains(entry.getKey())) { | |||
context.saveMeasure(entry.getValue(), 100.0); | |||
} | |||
} | |||
} | |||
@Override | |||
public String toString() { | |||
return getClass().getSimpleName(); |
@@ -21,7 +21,6 @@ package org.sonar.plugins.core.sensors; | |||
import com.google.common.collect.Multiset; | |||
import com.google.common.collect.TreeMultiset; | |||
import org.apache.commons.lang.ObjectUtils; | |||
import org.sonar.api.batch.Decorator; | |||
import org.sonar.api.batch.DecoratorContext; | |||
import org.sonar.api.batch.DependedUpon; | |||
@@ -33,7 +32,6 @@ import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.rules.RuleUtils; | |||
import org.sonar.api.utils.KeyValueFormat; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
public class WeightedViolationsDecorator implements Decorator { | |||
@@ -76,27 +74,17 @@ public class WeightedViolationsDecorator implements Decorator { | |||
double debt = 0.0; | |||
Multiset<RulePriority> violationsByPriority = TreeMultiset.create(); | |||
Map<Integer, Double> categoryDebt = new HashMap<Integer, Double>(); | |||
for (RuleMeasure violations : context.getMeasures(MeasuresFilters.rules(CoreMetrics.VIOLATIONS))) { | |||
if (MeasureUtils.hasValue(violations)) { | |||
violationsByPriority.add(violations.getRulePriority(), violations.getValue().intValue()); | |||
double add = (int) weights.get(violations.getRulePriority()) * violations.getValue(); | |||
debt += add; | |||
Double categoryVal = (Double) ObjectUtils.defaultIfNull(categoryDebt.get(violations.getRuleCategory()), 0.0); | |||
categoryDebt.put(violations.getRuleCategory(), categoryVal + add); | |||
} | |||
} | |||
Measure debtMeasure = new Measure(CoreMetrics.WEIGHTED_VIOLATIONS, debt, KeyValueFormat.format(violationsByPriority)); | |||
saveMeasure(context, debtMeasure); | |||
for (Map.Entry<Integer, Double> entry : categoryDebt.entrySet()) { | |||
RuleMeasure categDebt = RuleMeasure.createForCategory(CoreMetrics.WEIGHTED_VIOLATIONS, entry.getKey(), entry.getValue()); | |||
categDebt.setPersistenceMode(PersistenceMode.MEMORY); | |||
saveMeasure(context, categDebt); | |||
} | |||
} | |||
private void saveMeasure(DecoratorContext context, Measure debtMeasure) { | |||
@@ -105,7 +93,4 @@ public class WeightedViolationsDecorator implements Decorator { | |||
} | |||
} | |||
protected Map<RulePriority, Integer> getWeights() { | |||
return weights; | |||
} | |||
} |
@@ -141,7 +141,7 @@ public class VariationDecorator implements Decorator { | |||
// improvements : keep query in cache ? select only some columns ? | |||
// TODO support measure on rules and characteristics | |||
String hql = "select m from " + MeasureModel.class.getSimpleName() + " m, " + Snapshot.class.getSimpleName() + " s " + | |||
"where m.snapshotId=s.id and m.metricId in (:metricIds) and m.ruleId=null and m.rulePriority=null and m.rulesCategoryId=null and m.characteristic=null " | |||
"where m.snapshotId=s.id and m.metricId in (:metricIds) and m.ruleId=null and m.rulePriority=null and m.characteristic=null " | |||
+ "and (s.rootId=:rootSnapshotId or s.id=:rootSnapshotId) and s.resourceId=:resourceId and s.status=:status"; | |||
return session.createQuery(hql) | |||
.setParameter("metricIds", metricByIds.keySet()) | |||
@@ -159,14 +159,12 @@ public class VariationDecorator implements Decorator { | |||
static class MeasureKey { | |||
Integer metricId; | |||
Integer ruleId; | |||
Integer categoryId; | |||
RulePriority priority; | |||
Characteristic characteristic; | |||
MeasureKey(MeasureModel model) { | |||
metricId = model.getMetricId(); | |||
ruleId = model.getRuleId(); | |||
categoryId = model.getRulesCategoryId(); | |||
priority = model.getRulePriority(); | |||
characteristic = model.getCharacteristic(); | |||
} | |||
@@ -177,8 +175,7 @@ public class VariationDecorator implements Decorator { | |||
// TODO merge RuleMeasure into Measure | |||
if (measure instanceof RuleMeasure) { | |||
RuleMeasure rm = (RuleMeasure) measure; | |||
categoryId = rm.getRuleCategory(); | |||
ruleId = (rm.getRule()==null ? null : rm.getRule().getId()); | |||
ruleId = (rm.getRule() == null ? null : rm.getRule().getId()); | |||
priority = rm.getRulePriority(); | |||
} | |||
} | |||
@@ -190,7 +187,6 @@ public class VariationDecorator implements Decorator { | |||
MeasureKey that = (MeasureKey) o; | |||
if (categoryId != null ? !categoryId.equals(that.categoryId) : that.categoryId != null) return false; | |||
if (characteristic != null ? !characteristic.equals(that.characteristic) : that.characteristic != null) | |||
return false; | |||
if (!metricId.equals(that.metricId)) return false; | |||
@@ -204,7 +200,6 @@ public class VariationDecorator implements Decorator { | |||
public int hashCode() { | |||
int result = metricId.hashCode(); | |||
result = 31 * result + (ruleId != null ? ruleId.hashCode() : 0); | |||
result = 31 * result + (categoryId != null ? categoryId.hashCode() : 0); | |||
result = 31 * result + (priority != null ? priority.hashCode() : 0); | |||
result = 31 * result + (characteristic != null ? characteristic.hashCode() : 0); | |||
return result; |
@@ -1,55 +1,14 @@ | |||
<% if measure(Metric::LINES) %> | |||
<table width="100%"> | |||
<tr> | |||
<td valign="top" width="50%"> | |||
<div class="dashbox"> | |||
<h3>Rules compliance</h3> | |||
<div class="big"> | |||
<%= format_measure(Metric::VIOLATIONS_DENSITY, :url => url_for_drilldown(Metric::WEIGHTED_VIOLATIONS, {:highlight => Metric::WEIGHTED_VIOLATIONS})) -%> <%= trend_icon(Metric::VIOLATIONS_DENSITY) -%> | |||
</div> | |||
<% | |||
maintainability=@snapshot.measure(Metric::MAINTAINABILITY) | |||
efficiency=@snapshot.measure(Metric::EFFICIENCY) | |||
usability=@snapshot.measure(Metric::USABILITY) | |||
reliability=@snapshot.measure(Metric::RELIABILITY) | |||
portability=@snapshot.measure(Metric::PORTABILITY) | |||
%> | |||
<div class="mandatory"> | |||
<a class="tip" href="<%= url_for :controller => 'drilldown', :action => 'violations', :id => @project.id, :filter => 'category' -%>"> | |||
<img width="140" height="110" alt="" src="<%= ApplicationController.root_context -%>/chart?ck=xradar&w=140&h=110&c=777777|F8A036&m=100&g=0.25&l=Eff.,Mai.,Por.,Rel.,Usa.&v=<%= efficiency ? efficiency.value : 0 -%>,<%= maintainability ? maintainability.value : 0 -%>,<%= portability ? portability.value : 0 -%>,<%= reliability ? reliability.value : 0 -%>,<%= usability ? usability.value : 0 -%>"> | |||
<span> | |||
<table> | |||
<tr> | |||
<td align="left" nowrap>Efficiency </td> | |||
<td align="right" id="m_efficiency"><%= formatted_value(efficiency) %></td> | |||
<td nowrap> <%= trend_icon(efficiency) -%></td> | |||
</tr> | |||
<tr> | |||
<td align="left" nowrap>Maintainability </td> | |||
<td align="right" id="m_maintainability"><%= formatted_value(maintainability) %></td> | |||
<td nowrap> <%= trend_icon(maintainability) -%></td> | |||
</tr> | |||
<tr> | |||
<td align="left" nowrap>Portability </td> | |||
<td align="right" id="m_portability"><%= formatted_value(portability) %></td> | |||
<td nowrap> <%= trend_icon(portability) -%></td> | |||
</tr> | |||
<tr> | |||
<td align="left" nowrap>Reliability </td> | |||
<td align="right" id="m_reliability"><%= formatted_value(reliability) %></td> | |||
<td nowrap> <%= trend_icon(reliability) -%></td> | |||
</tr> | |||
<tr> | |||
<td align="left" nowrap>Usability </td> | |||
<td align="right" id="m_usability"><%= formatted_value(usability) %></td> | |||
<td nowrap> <%= trend_icon(usability) -%></td> | |||
</tr> | |||
</table> | |||
</span> | |||
</a> | |||
</div> | |||
</div> | |||
</td> | |||
<table width="100%"> | |||
<tr> | |||
<td valign="top" width="50%"> | |||
<div class="dashbox"> | |||
<h3>Rules compliance</h3> | |||
<div class="big"> | |||
<%= format_measure(Metric::VIOLATIONS_DENSITY, :url => url_for_drilldown(Metric::WEIGHTED_VIOLATIONS, {:highlight => Metric::WEIGHTED_VIOLATIONS})) -%> <%= trend_icon(Metric::VIOLATIONS_DENSITY) -%> | |||
</div> | |||
</div> | |||
</td> | |||
<td valign="top" width="50%" nowrap> | |||
<div class="dashbox"> | |||
<h3>Violations</h3> |
@@ -50,8 +50,11 @@ if measure('lines') || measure('ncloc') | |||
<p><%= format_measure('directories', :suffix => ' directories', :url => url_for_drilldown('directories')) -%> <%= trend_icon('directories') -%></p> | |||
<% end %> | |||
<p><%= format_measure('functions', :suffix => ' methods', :url => url_for_drilldown('functions')) -%> <%= trend_icon('functions') -%></p> | |||
<% if (measure('accessors')) %> | |||
<p><%= format_measure('accessors', :prefix => '+', :suffix => ' accessors', :url => url_for_drilldown('accessors')) -%> <%= trend_icon('accessors') -%></p> | |||
<% | |||
if (measure('accessors')) | |||
prefix=(dashboard_configuration.variation? ? '' : '+') | |||
%> | |||
<p><%= format_measure('accessors', :prefix => prefix, :suffix => ' accessors', :url => url_for_drilldown('accessors')) -%> <%= trend_icon('accessors') -%></p> | |||
<% end %> | |||
<% if measure('paragraphs') %> | |||
<p><%= format_measure('paragraphs', :suffix => ' paragraphs', :url => url_for_drilldown('paragraphs')) -%> <%= trend_icon('paragraphs') -%></p> |
@@ -19,19 +19,6 @@ | |||
*/ | |||
package org.sonar.plugins.core.sensors; | |||
import static org.mockito.Matchers.anyObject; | |||
import static org.mockito.Matchers.argThat; | |||
import static org.mockito.Mockito.atLeast; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.never; | |||
import static org.mockito.Mockito.times; | |||
import static org.mockito.Mockito.verify; | |||
import static org.mockito.Mockito.when; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import org.sonar.api.batch.DecoratorContext; | |||
@@ -41,14 +28,19 @@ import org.sonar.api.measures.MeasuresFilter; | |||
import org.sonar.api.resources.Resource; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.rules.RulesCategory; | |||
import org.sonar.api.rules.Violation; | |||
import org.sonar.api.test.IsMeasure; | |||
import org.sonar.api.test.IsRuleMeasure; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import static org.mockito.Matchers.anyObject; | |||
import static org.mockito.Matchers.argThat; | |||
import static org.mockito.Mockito.*; | |||
public class ViolationsDecoratorTest { | |||
private RulesCategory categA; | |||
private RulesCategory categB; | |||
private Rule ruleA1; | |||
private Rule ruleA2; | |||
private Rule ruleB1; | |||
@@ -58,15 +50,9 @@ public class ViolationsDecoratorTest { | |||
@Before | |||
public void before() { | |||
categA = new RulesCategory("Maintainability"); | |||
categA.setId(1); | |||
categB = new RulesCategory("Usability"); | |||
categB.setId(2); | |||
ruleA1 = Rule.create().setPluginName("ruleA1").setKey("ruleA1").setName("nameA1").setRulesCategory(categA); | |||
ruleA2 = Rule.create().setPluginName("ruleA2").setKey("ruleA2").setName("nameA2").setRulesCategory(categA); | |||
ruleB1 = Rule.create().setPluginName("ruleB1").setKey("ruleB1").setName("nameB1").setRulesCategory(categB); | |||
ruleA1 = Rule.create().setPluginName("ruleA1").setKey("ruleA1").setName("nameA1"); | |||
ruleA2 = Rule.create().setPluginName("ruleA2").setKey("ruleA2").setName("nameA2"); | |||
ruleB1 = Rule.create().setPluginName("ruleB1").setKey("ruleB1").setName("nameB1"); | |||
decorator = new ViolationsDecorator(); | |||
resource = mock(Resource.class); | |||
@@ -142,18 +128,6 @@ public class ViolationsDecoratorTest { | |||
verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.INFO_VIOLATIONS, 0.0))); | |||
} | |||
@Test | |||
public void categoryViolations() throws Exception { | |||
when(resource.getScope()).thenReturn(Resource.SCOPE_SET); | |||
when(context.getViolations()).thenReturn(createViolations()); | |||
when(context.getChildrenMeasures((MeasuresFilter) anyObject())).thenReturn(Collections.<Measure> emptyList()); | |||
decorator.decorate(resource, context); | |||
verify(context).saveMeasure(argThat(new IsRuleMeasure(CoreMetrics.VIOLATIONS, null, categA.getId(), null, 3.0))); | |||
verify(context).saveMeasure(argThat(new IsRuleMeasure(CoreMetrics.VIOLATIONS, null, categB.getId(), null, 1.0))); | |||
} | |||
private List<Violation> createViolations() { | |||
List<Violation> violations = new ArrayList<Violation>(); | |||
violations.add(Violation.create(ruleA1, resource).setPriority(RulePriority.CRITICAL)); |
@@ -19,19 +19,16 @@ | |||
*/ | |||
package org.sonar.plugins.core.sensors; | |||
import static org.hamcrest.CoreMatchers.is; | |||
import static org.junit.Assert.assertThat; | |||
import org.junit.Test; | |||
import static org.mockito.Matchers.eq; | |||
import static org.mockito.Mockito.*; | |||
import org.sonar.api.batch.DecoratorContext; | |||
import org.sonar.api.measures.*; | |||
import org.sonar.api.measures.CoreMetrics; | |||
import org.sonar.api.measures.Measure; | |||
import org.sonar.api.resources.Resource; | |||
import org.sonar.api.rules.Rule; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import static org.hamcrest.CoreMatchers.is; | |||
import static org.junit.Assert.assertThat; | |||
import static org.mockito.Matchers.eq; | |||
import static org.mockito.Mockito.*; | |||
public class ViolationsDensityDecoratorTest { | |||
@@ -53,7 +50,7 @@ public class ViolationsDensityDecoratorTest { | |||
when(context.getMeasure(CoreMetrics.NCLOC)).thenReturn(new Measure(CoreMetrics.NCLOC, 200.0)); | |||
when(context.getMeasure(CoreMetrics.WEIGHTED_VIOLATIONS)).thenReturn(new Measure(CoreMetrics.WEIGHTED_VIOLATIONS, 50.0)); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(new HashMap()); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(); | |||
decorator.decorate(resource, context); | |||
verify(context).saveMeasure(CoreMetrics.VIOLATIONS_DENSITY, 75.0); | |||
@@ -68,7 +65,7 @@ public class ViolationsDensityDecoratorTest { | |||
when(context.getMeasure(CoreMetrics.NCLOC)).thenReturn(new Measure(CoreMetrics.NCLOC, 0.0)); | |||
when(context.getMeasure(CoreMetrics.WEIGHTED_VIOLATIONS)).thenReturn(new Measure(CoreMetrics.WEIGHTED_VIOLATIONS, 50.0)); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(new HashMap()); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(); | |||
decorator.decorate(resource, context); | |||
verify(context, never()).saveMeasure(eq(CoreMetrics.VIOLATIONS_DENSITY), anyDouble()); | |||
@@ -83,7 +80,7 @@ public class ViolationsDensityDecoratorTest { | |||
when(context.getMeasure(CoreMetrics.NCLOC)).thenReturn(new Measure(CoreMetrics.NCLOC, 200.0)); | |||
when(context.getMeasure(CoreMetrics.WEIGHTED_VIOLATIONS)).thenReturn(new Measure(CoreMetrics.WEIGHTED_VIOLATIONS, 5000.0)); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(new HashMap()); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(); | |||
decorator.decorate(resource, context); | |||
verify(context).saveMeasure(CoreMetrics.VIOLATIONS_DENSITY, 0.0); | |||
@@ -97,7 +94,7 @@ public class ViolationsDensityDecoratorTest { | |||
DecoratorContext context = mock(DecoratorContext.class); | |||
when(context.getMeasure(CoreMetrics.NCLOC)).thenReturn(new Measure(CoreMetrics.NCLOC, 200.0)); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(new HashMap()); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(); | |||
decorator.decorate(resource, context); | |||
verify(context).saveMeasure(CoreMetrics.VIOLATIONS_DENSITY, 100.0); | |||
@@ -112,62 +109,9 @@ public class ViolationsDensityDecoratorTest { | |||
when(context.getMeasure(CoreMetrics.NCLOC)).thenReturn(new Measure(CoreMetrics.NCLOC, 200.0)); | |||
when(context.getMeasure(CoreMetrics.WEIGHTED_VIOLATIONS)).thenReturn(new Measure(CoreMetrics.WEIGHTED_VIOLATIONS, 0.0)); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(new HashMap()); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(); | |||
decorator.decorate(resource, context); | |||
verify(context).saveMeasure(CoreMetrics.VIOLATIONS_DENSITY, 100.0); | |||
} | |||
@Test | |||
public void densityByCategory() { | |||
Map<Integer, Metric> metricByCategoryId = new HashMap<Integer, Metric>(); | |||
metricByCategoryId.put(3, CoreMetrics.USABILITY); | |||
metricByCategoryId.put(5, CoreMetrics.EFFICIENCY); | |||
metricByCategoryId.put(6, CoreMetrics.RELIABILITY); | |||
Resource resource = mock(Resource.class); | |||
when(resource.getScope()).thenReturn(Resource.SCOPE_SET); | |||
DecoratorContext context = mock(DecoratorContext.class); | |||
when(context.getMeasure(CoreMetrics.NCLOC)).thenReturn(new Measure(CoreMetrics.NCLOC, 200.0)); | |||
when(context.getMeasures((MeasuresFilter) anyObject())) | |||
.thenReturn(Arrays.asList( | |||
new RuleMeasure(CoreMetrics.WEIGHTED_VIOLATIONS, new Rule(), null, 3).setValue(50.0), | |||
new RuleMeasure(CoreMetrics.WEIGHTED_VIOLATIONS, new Rule(), null, 5).setValue(0.0))); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(metricByCategoryId); | |||
decorator.decorate(resource, context); | |||
verify(context).saveMeasure(CoreMetrics.USABILITY, 75.0); | |||
verify(context).saveMeasure(CoreMetrics.EFFICIENCY, 100.0); | |||
verify(context).saveMeasure(CoreMetrics.RELIABILITY, 100.0); | |||
} | |||
@Test | |||
public void doNotCalculateDensityByCategoryOnEntities() { | |||
Map<Integer, Metric> metricByCategoryId = new HashMap<Integer, Metric>(); | |||
metricByCategoryId.put(3, CoreMetrics.USABILITY); | |||
metricByCategoryId.put(5, CoreMetrics.EFFICIENCY); | |||
metricByCategoryId.put(6, CoreMetrics.RELIABILITY); | |||
Resource resource = mock(Resource.class); | |||
when(resource.getScope()).thenReturn(Resource.SCOPE_ENTITY); | |||
DecoratorContext context = mock(DecoratorContext.class); | |||
when(context.getMeasure(CoreMetrics.NCLOC)).thenReturn(new Measure(CoreMetrics.NCLOC, 200.0)); | |||
when(context.getMeasure(CoreMetrics.WEIGHTED_VIOLATIONS)).thenReturn(new Measure(CoreMetrics.WEIGHTED_VIOLATIONS, 50.0)); | |||
when(context.getMeasures((MeasuresFilter) anyObject())) | |||
.thenReturn(Arrays.asList( | |||
new RuleMeasure(CoreMetrics.WEIGHTED_VIOLATIONS, new Rule(), null, 3).setValue(50.0), | |||
new RuleMeasure(CoreMetrics.WEIGHTED_VIOLATIONS, new Rule(), null, 5).setValue(0.0))); | |||
ViolationsDensityDecorator decorator = new ViolationsDensityDecorator(metricByCategoryId); | |||
decorator.decorate(resource, context); | |||
verify(context, never()).saveMeasure(eq(CoreMetrics.USABILITY), anyDouble()); | |||
verify(context, never()).saveMeasure(eq(CoreMetrics.EFFICIENCY), anyDouble()); | |||
verify(context, never()).saveMeasure(eq(CoreMetrics.RELIABILITY), anyDouble()); | |||
verify(context, never()).saveMeasure(eq(CoreMetrics.MAINTAINABILITY), anyDouble()); | |||
verify(context).saveMeasure(CoreMetrics.VIOLATIONS_DENSITY, 75.0); | |||
} | |||
} |
@@ -20,7 +20,6 @@ | |||
package org.sonar.plugins.core.sensors; | |||
import org.junit.Test; | |||
import static org.mockito.Mockito.*; | |||
import org.sonar.api.batch.DecoratorContext; | |||
import org.sonar.api.measures.CoreMetrics; | |||
import org.sonar.api.measures.Measure; | |||
@@ -30,13 +29,14 @@ import org.sonar.api.resources.Resource; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.test.IsMeasure; | |||
import org.sonar.api.test.IsRuleMeasure; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import static org.mockito.Mockito.*; | |||
public class WeightedViolationsDecoratorTest { | |||
@@ -92,25 +92,4 @@ public class WeightedViolationsDecoratorTest { | |||
verify(context, never()).saveMeasure((Measure) anyObject()); | |||
} | |||
@Test | |||
public void weightedViolationsOnCategories() { | |||
Map<RulePriority, Integer> weights = createWeights(); | |||
WeightedViolationsDecorator decorator = new WeightedViolationsDecorator(weights); | |||
DecoratorContext context = mock(DecoratorContext.class); | |||
when(context.getMeasures((MeasuresFilter) anyObject())).thenReturn(createViolationsMeasures()); | |||
decorator.decorate(mock(Resource.class), context); | |||
// categ 3 | |||
verify(context).saveMeasure(argThat(new IsRuleMeasure( | |||
CoreMetrics.WEIGHTED_VIOLATIONS, null, 3, null, 40.0 * 0 + 80.0 * 5 + 90.0 * 10))); | |||
// categ 4 | |||
verify(context).saveMeasure(argThat(new IsRuleMeasure( | |||
CoreMetrics.WEIGHTED_VIOLATIONS, null, 4, null, 10.0 * 0 + 10.0 * 10))); | |||
} | |||
} |
@@ -9,11 +9,11 @@ | |||
<rules_categories id="1" name="Efficiency" description="[null]"/> | |||
<rules_categories id="6" name="Usability" description="[null]"/> | |||
<rules id="30" name="Check Header" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
<rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" | |||
cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="31" name="Equals Avoid Null" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" | |||
<rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" | |||
plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" | |||
cardinality="SINGLE" parent_id="[null]"/> | |||
@@ -48,7 +48,7 @@ public final class PurgeRuleMeasures extends Purge { | |||
private void purge(Integer sid) { | |||
Query query = getSession().createQuery("SELECT m.id FROM " + MeasureModel.class.getSimpleName() + " m, " + Snapshot.class.getSimpleName() + " s WHERE s.id = m.snapshotId and " + | |||
"(s.rootId=:rootSid OR s.id=:rootSid) and (m.ruleId is not null or m.rulesCategoryId is not null or m.rulePriority is not null)"); | |||
"(s.rootId=:rootSid OR s.id=:rootSid) and (m.ruleId is not null or m.rulePriority is not null)"); | |||
query.setParameter("rootSid", sid); | |||
List<Integer> measureIds = query.getResultList(); | |||
PurgeUtils.deleteMeasuresById(getSession(), measureIds); |
@@ -1,6 +1,6 @@ | |||
<dataset> | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]" /> | |||
<metrics id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" | |||
@@ -64,28 +64,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> |
@@ -1,6 +1,6 @@ | |||
<dataset> | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> | |||
<metrics id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" | |||
@@ -64,28 +64,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -24,7 +24,7 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" | |||
diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -30,7 +30,7 @@ to ensure that unit tests pass on any locale. | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" | |||
diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -33,28 +33,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -33,28 +33,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -1,6 +1,6 @@ | |||
<dataset> | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> | |||
<metrics id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" |
@@ -36,28 +36,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -36,28 +36,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -1,6 +1,6 @@ | |||
<dataset> | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> | |||
<metrics id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" |
@@ -52,28 +52,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -81,7 +81,7 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -52,28 +52,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -81,7 +81,7 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -45,28 +45,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> |
@@ -48,28 +48,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -63,28 +63,28 @@ | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
@@ -92,14 +92,14 @@ | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -68,28 +68,28 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -97,14 +97,14 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -1,6 +1,6 @@ | |||
<dataset> | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> | |||
<metrics id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" |
@@ -69,28 +69,28 @@ | |||
<!-- old measures --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
@@ -99,28 +99,28 @@ | |||
<!-- last measures --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="7" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="7" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="7" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="7" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="8" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="8" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="8" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="8" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -69,28 +69,28 @@ | |||
<!-- old measures --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -99,28 +99,28 @@ | |||
<!-- last measures --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="7" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="7" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="7" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="7" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="8" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="8" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="8" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="8" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -1,6 +1,6 @@ | |||
<dataset> | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> | |||
<metrics id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" |
@@ -67,7 +67,7 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -67,7 +67,7 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -1,6 +1,6 @@ | |||
<dataset> | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> | |||
<metrics id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" |
@@ -69,28 +69,28 @@ | |||
<!-- valid measures --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -99,28 +99,28 @@ | |||
<!-- unprocessed measures --> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="7" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="7" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="7" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="7" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> | |||
<!--<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]"--> | |||
<!--rule_priority="[null]"--> | |||
<!--alert_text="[null]" ID="8" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="8" RULES_CATEGORY_ID="1"--> | |||
<!--alert_text="[null]" ID="8" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="8" rules_category_id="[null]"--> | |||
<!--RULE_ID="1"--> | |||
<!--text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]"--> | |||
<!--alert_status="[null]" description="[null]"/>--> |
@@ -69,28 +69,28 @@ | |||
<!-- valid measures --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="3" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -99,28 +99,28 @@ | |||
<!-- unprocessed measures --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="6" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="6" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="7" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="7" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="7" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="7" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="8" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="8" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="8" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="8" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -1,6 +1,6 @@ | |||
<dataset> | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> | |||
<metrics id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" |
@@ -92,7 +92,7 @@ public class DefaultTimeMachine implements TimeMachine { | |||
params.put("resourceId", resource.getId()); | |||
params.put("status", Snapshot.STATUS_PROCESSED); | |||
sb.append(" AND m.ruleId IS NULL AND m.rulePriority IS NULL AND m.rulesCategoryId IS NULL "); | |||
sb.append(" AND m.ruleId IS NULL AND m.rulePriority IS NULL "); | |||
if (!metricIds.isEmpty()) { | |||
sb.append(" AND m.metricId IN (:metricIds) "); | |||
params.put("metricIds", metricIds); |
@@ -147,7 +147,6 @@ public final class MeasurePersister { | |||
} | |||
if (measure instanceof RuleMeasure) { | |||
RuleMeasure ruleMeasure = (RuleMeasure) measure; | |||
merge.setRulesCategoryId(ruleMeasure.getRuleCategory()); | |||
merge.setRulePriority(ruleMeasure.getRulePriority()); | |||
if (ruleMeasure.getRule() != null) { | |||
Rule ruleWithId = ruleFinder.findByKey(ruleMeasure.getRule().getRepositoryKey(), ruleMeasure.getRule().getKey()); |
@@ -18,7 +18,7 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" id="2" VALUE="200" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="3" | |||
alert_text="[null]" id="2" VALUE="200" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="[null]" | |||
RULE_ID="[null]" text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -3,11 +3,11 @@ | |||
<rules_categories id="1" name="Efficiency" description="[null]"/> | |||
<rules_categories id="6" name="Usability" description="[null]"/> | |||
<rules id="30" name="Check Header" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
<rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" | |||
cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="31" name="Equals Avoid Null" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" | |||
<rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" | |||
plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" | |||
cardinality="SINGLE" parent_id="[null]"/> | |||
@@ -2,11 +2,11 @@ | |||
<rules_categories id="1" name="Efficiency" description="[null]"/> | |||
<rules_categories id="6" name="Usability" description="[null]"/> | |||
<rules id="30" name="Check Header" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
<rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" | |||
cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="31" name="Equals Avoid Null" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" | |||
<rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" | |||
plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" | |||
cardinality="SINGLE" parent_id="[null]"/> | |||
@@ -2,11 +2,11 @@ | |||
<rules_categories id="1" name="Efficiency" description="[null]"/> | |||
<rules_categories id="6" name="Usability" description="[null]"/> | |||
<rules id="30" name="Check Header" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
<rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" | |||
cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="31" name="Equals Avoid Null" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" | |||
<rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" | |||
plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" | |||
cardinality="SINGLE" parent_id="[null]"/> | |||
@@ -68,13 +68,13 @@ | |||
<!-- measures at project level --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="20.0" METRIC_ID="2" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="20.0" METRIC_ID="2" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -88,13 +88,13 @@ | |||
<!-- measures at module level --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="20.0" METRIC_ID="2" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="20.0" METRIC_ID="2" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -114,7 +114,7 @@ | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="8" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="8" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -134,13 +134,13 @@ | |||
<!-- measures at class level --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="11" VALUE="40.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="11" VALUE="40.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="12" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="12" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -153,13 +153,13 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="14" VALUE="40.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="14" VALUE="40.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="15" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="15" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -69,13 +69,13 @@ | |||
<!-- measures at project level --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="1" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="2" VALUE="20.0" METRIC_ID="2" SNAPSHOT_ID="1" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="2" VALUE="20.0" METRIC_ID="2" SNAPSHOT_ID="1" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -89,13 +89,13 @@ | |||
<!-- measures at module level --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="4" VALUE="10.0" METRIC_ID="1" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="5" VALUE="20.0" METRIC_ID="2" SNAPSHOT_ID="2" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="5" VALUE="20.0" METRIC_ID="2" SNAPSHOT_ID="2" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -115,7 +115,7 @@ | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="8" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="3" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="8" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="3" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -135,13 +135,13 @@ | |||
<!-- measures at class level --> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="11" VALUE="40.0" METRIC_ID="1" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="11" VALUE="40.0" METRIC_ID="1" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="12" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="4" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="12" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="4" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
@@ -154,13 +154,13 @@ | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="14" VALUE="40.0" METRIC_ID="1" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="14" VALUE="40.0" METRIC_ID="1" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="1" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> | |||
<project_measures characteristic_id="[null]" url="[null]" diff_value_1="[null]" diff_value_2="[null]" diff_value_3="[null]" | |||
rule_priority="[null]" | |||
alert_text="[null]" ID="15" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="5" RULES_CATEGORY_ID="1" | |||
alert_text="[null]" ID="15" VALUE="50.0" METRIC_ID="2" SNAPSHOT_ID="5" rules_category_id="[null]" | |||
RULE_ID="[null]" | |||
text_value="[null]" tendency="[null]" measure_date="[null]" project_id="[null]" | |||
alert_status="[null]" description="[null]"/> |
@@ -1,6 +1,6 @@ | |||
<dataset> | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
<rules id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" | |||
plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/> | |||
<metrics id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]" |
@@ -19,6 +19,10 @@ | |||
*/ | |||
package org.sonar.check; | |||
/** | |||
* @deprecated since 2.5. See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public enum IsoCategory { | |||
Reliability, Efficiency, Portability, Usability, Maintainability, NONE |
@@ -54,7 +54,7 @@ public @interface Rule { | |||
/** | |||
* Will probably be deprecated and replaced by tags | |||
*/ | |||
IsoCategory isoCategory(); | |||
IsoCategory isoCategory() default IsoCategory.NONE; | |||
Cardinality cardinality() default Cardinality.SINGLE; | |||
} |
@@ -32,7 +32,6 @@ public class CheckTest { | |||
Check check = FakeCheck.class.getAnnotation(Check.class); | |||
assertThat(check.title(), is("Detailed Check")); | |||
assertThat(check.description(), is("Detailed description")); | |||
assertThat(check.isoCategory(), is(IsoCategory.Reliability)); | |||
} | |||
@Test |
@@ -23,16 +23,16 @@ import org.sonar.api.database.DatabaseSession; | |||
import org.sonar.api.database.model.RuleFailureModel; | |||
import org.sonar.api.database.model.Snapshot; | |||
import org.sonar.api.profiles.RulesProfile; | |||
import org.sonar.api.rules.*; | |||
import org.sonar.api.rules.ActiveRule; | |||
import org.sonar.api.rules.ActiveRuleParam; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RuleParam; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
public class RulesDao extends BaseDao { | |||
private List<RulesCategory> rulesCategories; | |||
public RulesDao(DatabaseSession session) { | |||
super(session); | |||
} | |||
@@ -45,39 +45,18 @@ public class RulesDao extends BaseDao { | |||
return getSession().getResults(Rule.class, "pluginName", pluginKey, "enabled", true); | |||
} | |||
public List<Rule> getRulesByCategory(RulesCategory categ) { | |||
List<Rule> result = new ArrayList<Rule>(); | |||
for (Rule rule : getRules()) { | |||
if (rule.getRulesCategory().equals(categ)) { | |||
result.add(rule); | |||
} | |||
} | |||
return result; | |||
} | |||
public Rule getRuleByKey(String pluginKey, String ruleKey) { | |||
return getSession().getSingleResult(Rule.class, "key", ruleKey, "pluginName", pluginKey, "enabled", true); | |||
} | |||
public Long countRules(List<String> plugins, String categoryName) { | |||
public Long countRules(List<String> plugins) { | |||
return (Long) getSession().createQuery( | |||
"SELECT COUNT(r) FROM Rule r WHERE r.pluginName IN (:pluginNames) AND r.rulesCategory=:rulesCategory AND r.enabled=true"). | |||
"SELECT COUNT(r) FROM Rule r WHERE r.pluginName IN (:pluginNames) AND r.enabled=true"). | |||
setParameter("pluginNames", plugins). | |||
setParameter("rulesCategory", getCategory(categoryName)). | |||
getSingleResult(); | |||
} | |||
public List<RulesCategory> getCategories() { | |||
if (rulesCategories == null) { | |||
rulesCategories = getSession().getResults(RulesCategory.class); | |||
} | |||
return rulesCategories; | |||
} | |||
public RulesCategory getCategory(String key) { | |||
return getSession().getSingleResult(RulesCategory.class, "name", key); | |||
} | |||
public List<RuleParam> getRuleParams() { | |||
return getSession().getResults(RuleParam.class); | |||
@@ -96,13 +75,6 @@ public class RulesDao extends BaseDao { | |||
} | |||
} | |||
public void deleteActiveRuleParameters(RuleParam ruleParam) { | |||
getSession().createQuery( | |||
"DELETE FROM ActiveRuleParam arp WHERE ruleParam=:param") | |||
.setParameter("param", ruleParam) | |||
.executeUpdate(); | |||
} | |||
public List<RuleFailureModel> getViolations(Snapshot snapshot) { | |||
return getSession().getResults(RuleFailureModel.class, "snapshotId", snapshot.getId()); | |||
} |
@@ -30,7 +30,7 @@ import java.sql.Statement; | |||
public class SchemaMigration { | |||
public final static int VERSION_UNKNOWN = -1; | |||
public static final int LAST_VERSION = 161; | |||
public static final int LAST_VERSION = 162; | |||
public final static String TABLE_NAME = "schema_migrations"; | |||
@@ -70,7 +70,7 @@ | |||
overflowToDisk="false"/> | |||
<cache | |||
name="org.sonar.api.rules.RulesCategory" | |||
maxElementsInMemory="32" | |||
maxElementsInMemory="6" | |||
eternal="true" | |||
overflowToDisk="false"/> | |||
</ehcache> |
@@ -51,7 +51,6 @@ public class RulesDaoTest extends AbstractDbUnitTestCase { | |||
assertEquals("rule_one", rules.get(0).getKey()); | |||
assertEquals(1, rules.get(0).getParams().size()); | |||
assertEquals("category one", rules.get(0).getRulesCategory().getName()); | |||
} | |||
@Test | |||
@@ -66,17 +65,6 @@ public class RulesDaoTest extends AbstractDbUnitTestCase { | |||
assertThat(rule2, nullValue()); | |||
} | |||
@Test | |||
public void shouldCountNumberOfRulesOfACategoryForGivenPlugins() { | |||
setupData("shouldCountNumberOfRulesOfACategoryForGivenPlugins"); | |||
Long result = rulesDao.countRules(Arrays.asList("plugin1", "plugin2"), "category one"); | |||
assertThat(result, is(3L)); | |||
result = rulesDao.countRules(Arrays.asList("plugin1", "plugin2"), "category two"); | |||
assertThat(result, is(1L)); | |||
} | |||
@Test | |||
public void shouldGetRuleParams() { | |||
setupData("shouldGetRuleParams"); | |||
@@ -116,7 +104,7 @@ public class RulesDaoTest extends AbstractDbUnitTestCase { | |||
public void shouldAddActiveRulesToProfile() { | |||
setupData("shouldAddActiveRulesToProfile"); | |||
Rule rule = new Rule("rule1", "key1", "config1", new RulesCategory("test"), null); | |||
Rule rule = new Rule("rule1", "key1", "config1", null, null); | |||
RuleParam ruleParam = new RuleParam(null, "param1", null, null); | |||
rule.setParams(Arrays.asList(ruleParam)); | |||
@@ -3,18 +3,18 @@ | |||
<!-- CHECKSTYLE --> | |||
<rules id="1" name="Check Header" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
<rules id="1" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<!-- disabled rule --> | |||
<rules id="2" name="Disabled checked" rules_category_id="6" plugin_rule_key="DisabledCheck" | |||
<rules id="2" name="Disabled checked" plugin_rule_key="DisabledCheck" | |||
plugin_config_key="Checker/Treewalker/DisabledCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="false" cardinality="SINGLE" parent_id="[null]" /> | |||
<rules id="3" name="Check Annotation" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck" | |||
<rules id="3" name="Check Annotation" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck" | |||
plugin_config_key="Checker/Treewalker/AnnotationUseStyleCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" cardinality="SINGLE" parent_id="[null]" /> | |||
<!-- PMD --> | |||
<rules id="4" name="Call Super First" rules_category_id="6" plugin_rule_key="CallSuperFirst" | |||
<rules id="4" name="Call Super First" plugin_rule_key="CallSuperFirst" | |||
plugin_config_key="rulesets/android.xml/CallSuperFirst" plugin_name="pmd" description="[null]" priority="2" enabled="true" cardinality="SINGLE" parent_id="[null]" /> | |||
</dataset> |
@@ -3,18 +3,18 @@ | |||
<!-- CHECKSTYLE --> | |||
<rules id="1" name="Check Header" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
<rules id="1" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" | |||
plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<!-- disabled rule --> | |||
<rules id="2" name="Disabled checked" rules_category_id="6" plugin_rule_key="DisabledCheck" | |||
<rules id="2" name="Disabled checked" plugin_rule_key="DisabledCheck" | |||
plugin_config_key="Checker/Treewalker/DisabledCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="false" cardinality="SINGLE" parent_id="[null]" /> | |||
<rules id="3" name="Check Annotation" rules_category_id="6" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck" | |||
<rules id="3" name="Check Annotation" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck" | |||
plugin_config_key="Checker/Treewalker/AnnotationUseStyleCheck" plugin_name="checkstyle" description="[null]" priority="4" enabled="true" cardinality="SINGLE" parent_id="[null]" /> | |||
<!-- PMD --> | |||
<rules id="4" name="Call Super First" rules_category_id="6" plugin_rule_key="CallSuperFirst" | |||
<rules id="4" name="Call Super First" plugin_rule_key="CallSuperFirst" | |||
plugin_config_key="rulesets/android.xml/CallSuperFirst" plugin_name="pmd" description="[null]" priority="2" enabled="true" cardinality="SINGLE" parent_id="[null]" /> | |||
</dataset> |
@@ -4,7 +4,7 @@ | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="rule1" rules_category_id="1" description="desc" plugin_config_key="config1" | |||
<rules id="1" name="rule1" description="desc" plugin_config_key="config1" | |||
plugin_rule_key="key1" plugin_name="plugin" priority="1" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules_parameters id="1" rule_id="1" name="param1" description="foo" param_type="r"/> |
@@ -4,7 +4,7 @@ | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="rule1" rules_category_id="1" description="desc" plugin_config_key="config1" | |||
<rules id="1" name="rule1" description="desc" plugin_config_key="config1" | |||
plugin_rule_key="key1" plugin_name="plugin" priority="1" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules_parameters id="1" rule_id="1" name="param1" description="foo" param_type="r"/> |
@@ -3,15 +3,15 @@ | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules_categories id="2" name="category two" description="[null]"/> | |||
<rules id="1" name="rule one" rules_category_id="1" description="desc" plugin_config_key="config" | |||
<rules id="1" name="rule one" description="desc" plugin_config_key="config" | |||
plugin_rule_key="rule_one" plugin_name="plugin1" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="2" name="rule two" rules_category_id="1" description="desc" plugin_config_key="config" | |||
<rules id="2" name="rule two" description="desc" plugin_config_key="config" | |||
plugin_rule_key="rule_two" plugin_name="plugin2" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="3" name="rule three" rules_category_id="1" description="desc" plugin_config_key="config" | |||
<rules id="3" name="rule three" description="desc" plugin_config_key="config" | |||
plugin_rule_key="rule_three" plugin_name="plugin2" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="4" name="rule 4" rules_category_id="2" description="desc" plugin_config_key="config" | |||
<rules id="4" name="rule 4" description="desc" plugin_config_key="config" | |||
plugin_rule_key="rule_4" plugin_name="plugin2" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
</dataset> |
@@ -2,7 +2,7 @@ | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="rule1" rules_category_id="1" description="desc" plugin_config_key="config" | |||
<rules id="1" name="rule1" description="desc" plugin_config_key="config" | |||
plugin_rule_key="key1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules_parameters id="1" rule_id="1" name="param1" description="[null]" param_type="r"/> |
@@ -2,7 +2,7 @@ | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="rule1" rules_category_id="1" description="desc" plugin_config_key="config" | |||
<rules id="1" name="rule1" description="desc" plugin_config_key="config" | |||
plugin_rule_key="key1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules_parameters id="1" rule_id="1" name="param1" description="foo" param_type="r"/> |
@@ -5,11 +5,11 @@ | |||
<rules_profiles id="1" provided="true" name="profile one" default_profile="1" language="java"/> | |||
<rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java"/> | |||
<rules id="1" name="foo" rules_category_id="1" description="test" plugin_config_key="checker/foo" | |||
<rules id="1" name="foo" description="test" plugin_config_key="checker/foo" | |||
plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="2" name="bar" rules_category_id="1" description="test" plugin_config_key="checker/bar" | |||
<rules id="2" name="bar" description="test" plugin_config_key="checker/bar" | |||
plugin_rule_key="checkstyle.rule2" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="3" name="baz" rules_category_id="1" description="test" plugin_config_key="checker/baz" | |||
<rules id="3" name="baz" description="test" plugin_config_key="checker/baz" | |||
plugin_rule_key="checkstyle.rule3" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2"/> |
@@ -5,11 +5,11 @@ | |||
<rules_profiles id="1" provided="true" name="profile one" default_profile="1" language="java"/> | |||
<rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java"/> | |||
<rules id="1" name="foo" rules_category_id="1" description="test" plugin_config_key="checker/foo" | |||
<rules id="1" name="foo" description="test" plugin_config_key="checker/foo" | |||
plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="2" name="bar" rules_category_id="1" description="test" plugin_config_key="checker/bar" | |||
<rules id="2" name="bar" description="test" plugin_config_key="checker/bar" | |||
plugin_rule_key="checkstyle.rule2" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="3" name="baz" rules_category_id="1" description="test" plugin_config_key="checker/baz" | |||
<rules id="3" name="baz" description="test" plugin_config_key="checker/baz" | |||
plugin_rule_key="checkstyle.rule3" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2"/> |
@@ -5,11 +5,11 @@ | |||
<rules_profiles id="1" provided="true" name="profile one" default_profile="1" language="java"/> | |||
<rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java"/> | |||
<rules id="1" name="foo" rules_category_id="1" description="test" plugin_config_key="checker/foo" | |||
<rules id="1" name="foo" description="test" plugin_config_key="checker/foo" | |||
plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="2" name="bar" rules_category_id="1" description="test" plugin_config_key="checker/bar" | |||
<rules id="2" name="bar" description="test" plugin_config_key="checker/bar" | |||
plugin_rule_key="checkstyle.rule2" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="3" name="baz" rules_category_id="1" description="test" plugin_config_key="checker/baz" | |||
<rules id="3" name="baz" description="test" plugin_config_key="checker/baz" | |||
plugin_rule_key="checkstyle.rule3" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2"/> |
@@ -3,9 +3,9 @@ | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<!-- Rules --> | |||
<rules id="1" name="new1" rules_category_id="1" description="test1" plugin_config_key="checker/new1" | |||
<rules id="1" name="new1" description="test1" plugin_config_key="checker/new1" | |||
plugin_rule_key="checkstyle.new1" plugin_name="PLUGIN_KEY" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="2" name="new2" rules_category_id="1" description="test2" plugin_config_key="checker/new2" | |||
<rules id="2" name="new2" description="test2" plugin_config_key="checker/new2" | |||
plugin_rule_key="checkstyle.new2" plugin_name="PLUGIN_KEY" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<!-- Rules parameters --> |
@@ -2,7 +2,7 @@ | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="foo" rules_category_id="1" description="test" plugin_config_key="checker/foo" | |||
<rules id="1" name="foo" description="test" plugin_config_key="checker/foo" | |||
plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
</dataset> |
@@ -2,9 +2,9 @@ | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="rule one" rules_category_id="1" description="desc" plugin_config_key="other config" | |||
<rules id="1" name="rule one" description="desc" plugin_config_key="other config" | |||
plugin_rule_key="rule_one" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="2" name="rule two" rules_category_id="1" description="desc" plugin_config_key="config" | |||
<rules id="2" name="rule two" description="desc" plugin_config_key="config" | |||
plugin_rule_key="rule_two" plugin_name="other plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules_parameters id="1" rule_id="1" name="rule1_param1" description="rule1_desc1" param_type="r" |
@@ -2,9 +2,9 @@ | |||
<rules_categories id="1" name="category one" description="[null]"/> | |||
<rules id="1" name="other rule" rules_category_id="1" description="desc" plugin_config_key="other config" | |||
<rules id="1" name="other rule" description="desc" plugin_config_key="other config" | |||
plugin_rule_key="other key" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules id="2" name="rule" rules_category_id="1" description="desc" plugin_config_key="config" | |||
<rules id="2" name="rule" description="desc" plugin_config_key="config" | |||
plugin_rule_key="key" plugin_name="other plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> | |||
<rules_parameters id="1" rule_id="1" name="rule1_param1" description="rule1_desc1" param_type="r" /> |
@@ -22,8 +22,10 @@ package org.sonar.api.checks.templates; | |||
import org.apache.commons.io.IOUtils; | |||
import org.sonar.api.profiles.RulesProfile; | |||
import org.sonar.api.resources.Language; | |||
import org.sonar.api.rules.*; | |||
import org.sonar.check.IsoCategory; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RuleParam; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.rules.RulesRepository; | |||
import java.io.InputStream; | |||
import java.util.*; | |||
@@ -134,20 +136,12 @@ public class CheckTemplateRepository implements RulesRepository { | |||
} | |||
/* | |||
CODE FOR BACKWARD COMPATIBLITY | |||
This class should not extend RulesRepository in next versions | |||
CODE FOR BACKWARD COMPATIBLITY | |||
This class should not extend RulesRepository in next versions | |||
*/ | |||
*/ | |||
public List<Rule> getInitialReferential() { | |||
@@ -163,7 +157,6 @@ public class CheckTemplateRepository implements RulesRepository { | |||
rule.setDescription(checkTemplate.getDescription(Locale.ENGLISH)); | |||
rule.setName(checkTemplate.getTitle(Locale.ENGLISH)); | |||
rule.setPriority(RulePriority.fromCheckPriority(checkTemplate.getPriority())); | |||
rule.setRulesCategory(toRuleCategory(checkTemplate.getIsoCategory())); | |||
for (CheckTemplateProperty checkTemplateProperty : checkTemplate.getProperties()) { | |||
RuleParam param = rule.createParameter(checkTemplateProperty.getKey()); | |||
param.setDescription(checkTemplateProperty.getDescription(Locale.ENGLISH)); | |||
@@ -173,26 +166,6 @@ public class CheckTemplateRepository implements RulesRepository { | |||
return rule; | |||
} | |||
private RulesCategory toRuleCategory(IsoCategory isoCategory) { | |||
if (isoCategory == IsoCategory.Reliability) { | |||
return Iso9126RulesCategories.RELIABILITY; | |||
} | |||
if (isoCategory == IsoCategory.Efficiency) { | |||
return Iso9126RulesCategories.EFFICIENCY; | |||
} | |||
if (isoCategory == IsoCategory.Maintainability) { | |||
return Iso9126RulesCategories.MAINTAINABILITY; | |||
} | |||
if (isoCategory == IsoCategory.Portability) { | |||
return Iso9126RulesCategories.PORTABILITY; | |||
} | |||
if (isoCategory == IsoCategory.Usability) { | |||
return Iso9126RulesCategories.USABILITY; | |||
} | |||
return null; | |||
} | |||
public List<Rule> parseReferential(String fileContent) { | |||
return Collections.emptyList(); | |||
} |
@@ -75,7 +75,6 @@ public class XmlCheckTemplateFactory { | |||
template.setConfigKey(rule.getConfigKey()); | |||
template.setDescription(rule.getDescription()); | |||
template.setIsoCategory(rule.getRulesCategory().toIsoCategory()); | |||
template.setPriority(rule.getPriority().toCheckPriority()); | |||
template.setTitle(rule.getName()); | |||
@@ -27,6 +27,7 @@ import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RuleParam; | |||
import org.sonar.api.rules.RulesCategory; | |||
import java.util.Collections; | |||
import java.util.List; | |||
@Deprecated | |||
@@ -47,7 +48,7 @@ public class RulesDao { | |||
} | |||
public List<Rule> getRulesByCategory(RulesCategory categ) { | |||
return target.getRulesByCategory(categ); | |||
return Collections.emptyList(); | |||
} | |||
public Rule getRuleByKey(String pluginKey, String ruleKey) { | |||
@@ -55,15 +56,15 @@ public class RulesDao { | |||
} | |||
public Long countRules(List<String> plugins, String categoryName) { | |||
return target.countRules(plugins, categoryName); | |||
return target.countRules(plugins); | |||
} | |||
public List<RulesCategory> getCategories() { | |||
return target.getCategories(); | |||
return Collections.emptyList(); | |||
} | |||
public RulesCategory getCategory(String key) { | |||
return target.getCategory(key); | |||
return null; | |||
} | |||
@@ -105,9 +105,7 @@ public class StandardRulesXmlParser { | |||
xstream.registerConverter(new TrimStringConverter()); | |||
xstream.alias("rules", ArrayList.class); | |||
xstream.alias("categ", RulesCategory.class); | |||
xstream.useAttributeFor(RulesCategory.class, "name"); | |||
xstream.aliasField("category", Rule.class, "rulesCategory"); | |||
xstream.omitField(Rule.class, "category"); | |||
xstream.alias("rule", Rule.class); | |||
xstream.useAttributeFor(Rule.class, "key"); |
@@ -20,15 +20,15 @@ | |||
package org.sonar.api.rules; | |||
import org.apache.commons.io.IOUtils; | |||
import static org.hamcrest.MatcherAssert.assertThat; | |||
import static org.hamcrest.Matchers.is; | |||
import static org.junit.Assert.*; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import java.util.List; | |||
import static org.hamcrest.MatcherAssert.assertThat; | |||
import static org.hamcrest.Matchers.is; | |||
import static org.junit.Assert.*; | |||
public class StandardRulesXmlParserTest { | |||
@Test | |||
public void checkAllFields() { | |||
@@ -48,26 +48,12 @@ public class StandardRulesXmlParserTest { | |||
Assert.assertEquals("param description", rule.getParams().get(0).getDescription()); | |||
} | |||
@Test | |||
public void ruleShouldHaveACategory() { | |||
StandardRulesXmlParser parser = new StandardRulesXmlParser(); | |||
String xml = "<rules><rule><category name='cat1' /></rule></rules>"; | |||
List<Rule> rules = parser.parse(xml); | |||
assertNotNull(rules.get(0).getRulesCategory()); | |||
Assert.assertEquals("cat1", rules.get(0).getRulesCategory().getName()); | |||
assertNull(rules.get(0).getRulesCategory().getId()); | |||
assertNull(rules.get(0).getRulesCategory().getDescription()); | |||
} | |||
@Test | |||
public void ruleCanHaveALevel() { | |||
StandardRulesXmlParser parser = new StandardRulesXmlParser(); | |||
String xml = "<rules><rule key='1' priority='CRITICAL'><category name='cat1'/></rule></rules>"; | |||
List<Rule> rules = parser.parse(xml); | |||
assertNotNull(rules.get(0).getRulesCategory()); | |||
Assert.assertEquals(RulePriority.CRITICAL, rules.get(0).getPriority()); | |||
assertNull(rules.get(0).getRulesCategory().getId()); | |||
assertNull(rules.get(0).getRulesCategory().getDescription()); | |||
} | |||
@Test | |||
@@ -101,10 +87,10 @@ public class StandardRulesXmlParserTest { | |||
@Test | |||
public void shouldContainCDataDescription() { | |||
StandardRulesXmlParser parser = new StandardRulesXmlParser(); | |||
String xml = "<rules><rule key='key1' category='cat1'><description> <![CDATA[<xml> </nodes> and accents Žˆ˜ ]]> </description></rule></rules>"; | |||
String xml = "<rules><rule key='key1' category='cat1'><description> <![CDATA[<xml> </nodes> and accents ��� ]]> </description></rule></rules>"; | |||
List<Rule> rules = parser.parse(xml); | |||
assertEquals(1, rules.size()); | |||
Assert.assertEquals("<xml> </nodes> and accents Žˆ˜", rules.get(0).getDescription()); | |||
Assert.assertEquals("<xml> </nodes> and accents ���", rules.get(0).getDescription()); | |||
} | |||
@Test |
@@ -72,7 +72,11 @@ public class MeasureModel implements Cloneable { | |||
@Column(name = "rule_id", updatable = true, nullable = true) | |||
private Integer ruleId; | |||
@Column(name = "rules_category_id") | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
@Column(name = "rules_category_id", nullable = true) | |||
private Integer rulesCategoryId; | |||
@Column(name = "rule_priority", updatable = false, nullable = true) | |||
@@ -216,7 +220,7 @@ public class MeasureModel implements Cloneable { | |||
* @return whether the measure is about rule | |||
*/ | |||
public boolean isRuleMeasure() { | |||
return ruleId != null || rulePriority != null || rulesCategoryId != null; | |||
return ruleId != null || rulePriority != null; | |||
} | |||
/** | |||
@@ -269,19 +273,18 @@ public class MeasureModel implements Cloneable { | |||
} | |||
/** | |||
* @return the rule category id | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public Integer getRulesCategoryId() { | |||
return rulesCategoryId; | |||
return null; | |||
} | |||
/** | |||
* Sets the rule category id | |||
* | |||
* @return the current object | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public MeasureModel setRulesCategoryId(Integer id) { | |||
this.rulesCategoryId = id; | |||
return this; | |||
} | |||
@@ -526,7 +529,6 @@ public class MeasureModel implements Cloneable { | |||
clone.setDiffValue2(getDiffValue2()); | |||
clone.setDiffValue3(getDiffValue3()); | |||
clone.setValue(getValue()); | |||
clone.setRulesCategoryId(getRulesCategoryId()); | |||
clone.setRulePriority(getRulePriority()); | |||
clone.setRuleId(getRuleId()); | |||
clone.setSnapshotId(getSnapshotId()); |
@@ -19,6 +19,7 @@ | |||
*/ | |||
package org.sonar.api.measures; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.sonar.api.utils.SonarException; | |||
import java.lang.reflect.Field; | |||
@@ -41,7 +42,13 @@ public final class CoreMetrics { | |||
public static final String DOMAIN_COMPLEXITY = "Complexity"; | |||
public static final String DOMAIN_DOCUMENTATION = "Documentation"; | |||
public static final String DOMAIN_RULES = "Rules"; | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final String DOMAIN_RULE_CATEGORIES = "Rule categories"; | |||
public static final String DOMAIN_GENERAL = "General"; | |||
public static final String DOMAIN_DUPLICATION = "Duplication"; | |||
public static final String DOMAIN_DESIGN = "Design"; | |||
@@ -269,19 +276,68 @@ public final class CoreMetrics { | |||
Metric.ValueType.DATA, Metric.DIRECTION_NONE, false, DOMAIN_DUPLICATION); | |||
/* coding rules */ | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final String USABILITY_KEY = "usability"; | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final Metric USABILITY = new Metric(USABILITY_KEY, "Usability", "Usability", Metric.ValueType.PERCENT, | |||
Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true); | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final String RELIABILITY_KEY = "reliability"; | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final Metric RELIABILITY = new Metric(RELIABILITY_KEY, "Reliability", "Reliability", Metric.ValueType.PERCENT, | |||
Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true); | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final String EFFICIENCY_KEY = "efficiency"; | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final Metric EFFICIENCY = new Metric(EFFICIENCY_KEY, "Efficiency", "Efficiency", Metric.ValueType.PERCENT, | |||
Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true); | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final String PORTABILITY_KEY = "portability"; | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final Metric PORTABILITY = new Metric(PORTABILITY_KEY, "Portability", "Portability", Metric.ValueType.PERCENT, | |||
Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true); | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final String MAINTAINABILITY_KEY = "maintainability"; | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static final Metric MAINTAINABILITY = new Metric(MAINTAINABILITY_KEY, "Maintainability", "Maintainability", | |||
Metric.ValueType.PERCENT, Metric.DIRECTION_BETTER, true, DOMAIN_RULE_CATEGORIES).setBestValue(100.0).setOptimizedBestValue(true); | |||
@@ -437,7 +493,10 @@ public final class CoreMetrics { | |||
for (Field field : CoreMetrics.class.getFields()) { | |||
if (Metric.class.isAssignableFrom(field.getType())) { | |||
try { | |||
metrics.add((Metric) field.get(null)); | |||
Metric metric = (Metric) field.get(null); | |||
if (!StringUtils.equals(metric.getDomain(), DOMAIN_RULE_CATEGORIES)) { | |||
metrics.add(metric); | |||
} | |||
} catch (IllegalAccessException e) { | |||
throw new SonarException("can not load metrics from " + CoreMetrics.class.getSimpleName(), e); | |||
} |
@@ -25,6 +25,7 @@ import org.sonar.api.rules.RulePriority; | |||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
import java.util.Collections; | |||
import java.util.List; | |||
/** | |||
@@ -105,6 +106,10 @@ public final class MeasuresFilters { | |||
return new RulePriorityFilter(metric, priority); | |||
} | |||
/** | |||
* @deprecated since 2.5. See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static MeasuresFilter<RuleMeasure> ruleCategory(final Metric metric, final Integer category) { | |||
return new RuleCategoryFilter(metric, category); | |||
} | |||
@@ -113,26 +118,15 @@ public final class MeasuresFilters { | |||
return new RuleFilter(metric, rule); | |||
} | |||
/** | |||
* @deprecated since 2.5. See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static MeasuresFilter<Collection<RuleMeasure>> ruleCategories(final Metric metric) { | |||
return new MetricFilter<Collection<RuleMeasure>>(metric) { | |||
private boolean apply(Measure measure) { | |||
return measure instanceof RuleMeasure | |||
&& metric.equals(measure.getMetric()) | |||
&& ((RuleMeasure) measure).getRule() == null | |||
&& ((RuleMeasure) measure).getRuleCategory() != null; | |||
} | |||
public Collection<RuleMeasure> filter(Collection<Measure> measures) { | |||
List<RuleMeasure> result = new ArrayList<RuleMeasure>(); | |||
if (measures != null) { | |||
for (Measure measure : measures) { | |||
if (apply(measure)) { | |||
result.add((RuleMeasure) measure); | |||
} | |||
} | |||
} | |||
return result; | |||
return Collections.emptyList(); | |||
} | |||
}; | |||
} | |||
@@ -213,24 +207,23 @@ public final class MeasuresFilters { | |||
@Override | |||
boolean doApply(RuleMeasure measure) { | |||
return measure.getRule() == null | |||
&& measure.getRuleCategory() == null | |||
&& priority.equals(measure.getRulePriority()); | |||
} | |||
} | |||
/** | |||
* @deprecated since 2.5. See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
private static class RuleCategoryFilter extends AbstractRuleMeasureFilter<RuleMeasure> { | |||
private Integer categ; | |||
protected RuleCategoryFilter(Metric metric, Integer categ) { | |||
super(metric); | |||
this.categ = categ; | |||
} | |||
@Override | |||
boolean doApply(RuleMeasure measure) { | |||
return measure.getRule() == null | |||
&& categ.equals(measure.getRuleCategory()) | |||
&& measure.getRulePriority() == null; | |||
return false; | |||
} | |||
} | |||
@@ -32,7 +32,6 @@ public class RuleMeasure extends Measure { | |||
private Rule rule; | |||
private RulePriority rulePriority; | |||
private Integer ruleCategory; | |||
/** | |||
* This constructor is for internal use only. Please use static methods createForXXX(). | |||
@@ -41,7 +40,6 @@ public class RuleMeasure extends Measure { | |||
super(metric); | |||
this.rule = rule; | |||
this.rulePriority = rulePriority; | |||
this.ruleCategory = ruleCategory; | |||
} | |||
public Rule getRule() { | |||
@@ -60,12 +58,20 @@ public class RuleMeasure extends Measure { | |||
this.rulePriority = rulePriority; | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public Integer getRuleCategory() { | |||
return ruleCategory; | |||
return null; | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public void setRuleCategory(Integer ruleCategory) { | |||
this.ruleCategory = ruleCategory; | |||
} | |||
@Override | |||
@@ -81,7 +87,6 @@ public class RuleMeasure extends Measure { | |||
.append(getMetric(), other.getMetric()) | |||
.append(rule, other.rule) | |||
.append(rulePriority, other.rulePriority) | |||
.append(ruleCategory, other.ruleCategory) | |||
.isEquals(); | |||
} | |||
@@ -96,9 +101,7 @@ public class RuleMeasure extends Measure { | |||
append(getMetric()). | |||
append(rule). | |||
append(rulePriority). | |||
append(ruleCategory). | |||
toHashCode(); | |||
} | |||
@Override | |||
@@ -113,7 +116,6 @@ public class RuleMeasure extends Measure { | |||
append("alertText", alertText). | |||
append("tendency", tendency). | |||
append("rule", rule). | |||
append("category", ruleCategory). | |||
append("priority", rulePriority). | |||
toString(); | |||
} | |||
@@ -126,6 +128,10 @@ public class RuleMeasure extends Measure { | |||
return (RuleMeasure) new RuleMeasure(metric, null, priority, null).setValue(value); | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public static RuleMeasure createForCategory(Metric metric, Integer category, Double value) { | |||
return (RuleMeasure) new RuleMeasure(metric, null, null, category).setValue(value); | |||
} |
@@ -64,7 +64,6 @@ public final class AnnotationRuleParser implements ServerComponent { | |||
String ruleName = StringUtils.defaultIfEmpty(ruleAnnotation.name(), ruleKey); | |||
Rule rule = Rule.create(repositoryKey, ruleKey, ruleName); | |||
rule.setDescription(ruleAnnotation.description()); | |||
rule.setRulesCategory(RulesCategory.fromIsoCategory(ruleAnnotation.isoCategory())); | |||
rule.setPriority(RulePriority.fromCheckPriority(ruleAnnotation.priority())); | |||
rule.setCardinality(ruleAnnotation.cardinality()); | |||
@@ -83,7 +82,6 @@ public final class AnnotationRuleParser implements ServerComponent { | |||
String ruleName = StringUtils.defaultIfEmpty(checkAnnotation.title(), ruleKey); | |||
Rule rule = Rule.create(repositoryKey, ruleKey, ruleName); | |||
rule.setDescription(checkAnnotation.description()); | |||
rule.setRulesCategory(RulesCategory.fromIsoCategory(checkAnnotation.isoCategory())); | |||
rule.setPriority(RulePriority.fromCheckPriority(checkAnnotation.priority())); | |||
Field[] fields = clazz.getDeclaredFields(); |
@@ -23,6 +23,10 @@ import java.util.Arrays; | |||
import java.util.Collections; | |||
import java.util.List; | |||
/** | |||
* @deprecated since 2.5. See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public final class Iso9126RulesCategories { | |||
private Iso9126RulesCategories() { | |||
} |
@@ -56,10 +56,6 @@ public final class Rule { | |||
@Column(name = "plugin_config_key", updatable = true, nullable = true) | |||
private String configKey; | |||
@ManyToOne(fetch = FetchType.EAGER) | |||
@JoinColumn(name = "rules_category_id", updatable = true, nullable = true) | |||
private RulesCategory rulesCategory; | |||
@Column(name = "priority", updatable = true, nullable = true) | |||
@Enumerated(EnumType.ORDINAL) | |||
private RulePriority priority = DEFAULT_PRIORITY; | |||
@@ -123,7 +119,6 @@ public final class Rule { | |||
setName(name); | |||
this.key = key; | |||
this.configKey = key; | |||
this.rulesCategory = rulesCategory; | |||
this.priority = priority; | |||
this.pluginName = pluginKey; | |||
} | |||
@@ -137,7 +132,6 @@ public final class Rule { | |||
setName(name); | |||
this.key = key; | |||
this.configKey = key; | |||
this.rulesCategory = rulesCategory; | |||
this.pluginName = pluginName; | |||
this.description = description; | |||
} | |||
@@ -151,7 +145,6 @@ public final class Rule { | |||
setName(name); | |||
this.key = key; | |||
this.configKey = configKey; | |||
this.rulesCategory = rulesCategory; | |||
this.pluginName = pluginName; | |||
this.description = description; | |||
} | |||
@@ -193,17 +186,18 @@ public final class Rule { | |||
} | |||
/** | |||
* @return the rule category | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public RulesCategory getRulesCategory() { | |||
return rulesCategory; | |||
return null; | |||
} | |||
/** | |||
* Sets the rule category | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public Rule setRulesCategory(RulesCategory rulesCategory) { | |||
this.rulesCategory = rulesCategory; | |||
return this; | |||
} | |||
@@ -295,10 +289,11 @@ public final class Rule { | |||
return parameter; | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public Integer getCategoryId() { | |||
if (rulesCategory != null) { | |||
return rulesCategory.getId(); | |||
} | |||
return null; | |||
} | |||
@@ -380,7 +375,6 @@ public final class Rule { | |||
.append("name", name) | |||
.append("key", key) | |||
.append("configKey", configKey) | |||
.append("categ", rulesCategory) | |||
.append("plugin", pluginName) | |||
.toString(); | |||
} |
@@ -33,8 +33,9 @@ import javax.persistence.Entity; | |||
import javax.persistence.Table; | |||
/** | |||
* A class to hold rules category | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
@Immutable | |||
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY) | |||
@Entity | |||
@@ -59,7 +60,7 @@ public class RulesCategory extends BaseIdentifiable { | |||
/** | |||
* Creates a category based on the category name and description | |||
* | |||
* @param name the category name | |||
* @param name the category name | |||
* @param description the category description | |||
*/ | |||
public RulesCategory(String name, String description) { | |||
@@ -98,6 +99,7 @@ public class RulesCategory extends BaseIdentifiable { | |||
/** | |||
* Sets the cay description | |||
* | |||
* @param description the description | |||
*/ | |||
public void setDescription(String description) { | |||
@@ -153,19 +155,19 @@ public class RulesCategory extends BaseIdentifiable { | |||
} | |||
public static RulesCategory fromIsoCategory(IsoCategory iso) { | |||
if (iso==IsoCategory.Efficiency) { | |||
if (iso == IsoCategory.Efficiency) { | |||
return Iso9126RulesCategories.EFFICIENCY; | |||
} | |||
if (iso==IsoCategory.Maintainability) { | |||
if (iso == IsoCategory.Maintainability) { | |||
return Iso9126RulesCategories.MAINTAINABILITY; | |||
} | |||
if (iso==IsoCategory.Portability) { | |||
if (iso == IsoCategory.Portability) { | |||
return Iso9126RulesCategories.PORTABILITY; | |||
} | |||
if (iso==IsoCategory.Reliability) { | |||
if (iso == IsoCategory.Reliability) { | |||
return Iso9126RulesCategories.RELIABILITY; | |||
} | |||
if (iso==IsoCategory.Usability) { | |||
if (iso == IsoCategory.Usability) { | |||
return Iso9126RulesCategories.USABILITY; | |||
} | |||
return null; |
@@ -134,11 +134,6 @@ public final class XMLRuleParser implements ServerComponent { | |||
} else if (StringUtils.equalsIgnoreCase("priority", nodeName)) { | |||
rule.setPriority(RulePriority.valueOf(StringUtils.trim(cursor.collectDescendantText(false)))); | |||
} else if (StringUtils.equalsIgnoreCase("category", nodeName)) { | |||
/* BACKWARD COMPATIBILITY WITH DEPRECATED FORMAT : attribute "name" */ | |||
String category = StringUtils.trim(StringUtils.defaultString(cursor.getAttrValue("name"), cursor.collectDescendantText(false))); | |||
rule.setRulesCategory(new RulesCategory(category)); | |||
} else if (StringUtils.equalsIgnoreCase("cardinality", nodeName)) { | |||
rule.setCardinality(Cardinality.valueOf(StringUtils.trim(cursor.collectDescendantText(false)))); | |||
@@ -32,7 +32,6 @@ public class Measure { | |||
private String ruleKey; | |||
private String ruleName; | |||
private String ruleCategory; | |||
private String rulePriority; | |||
private Date date; | |||
@@ -115,12 +114,12 @@ public class Measure { | |||
this.ruleName = ruleName; | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public String getRuleCategory() { | |||
return ruleCategory; | |||
} | |||
public void setRuleCategory(String s) { | |||
this.ruleCategory = s; | |||
return null; | |||
} | |||
public String getRulePriority() { |
@@ -39,7 +39,6 @@ public final class ResourcesQuery extends AbstractResourceQuery<Resources> { | |||
private String qualifiers; | |||
private String metrics; | |||
private String rules; | |||
private String ruleCategories; | |||
private String rulePriorities; | |||
private boolean verbose = false; | |||
@@ -80,8 +79,12 @@ public final class ResourcesQuery extends AbstractResourceQuery<Resources> { | |||
return setRulePriorities(b ? "true" : "false"); | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public ResourcesQuery filterOnRuleCategories(boolean b) { | |||
return setRuleCategories(b ? "true" : "false"); | |||
return this; | |||
} | |||
public ResourcesQuery setRulePriorities(String s) { | |||
@@ -89,8 +92,11 @@ public final class ResourcesQuery extends AbstractResourceQuery<Resources> { | |||
return this; | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public ResourcesQuery setRuleCategories(String s) { | |||
this.ruleCategories = s; | |||
return this; | |||
} | |||
@@ -161,9 +167,6 @@ public final class ResourcesQuery extends AbstractResourceQuery<Resources> { | |||
if (rules != null) { | |||
url += "rules=" + rules + "&"; | |||
} | |||
if (ruleCategories != null) { | |||
url += "rule_categories=" + ruleCategories + "&"; | |||
} | |||
if (rulePriorities != null) { | |||
url += "rule_priorities=" + rulePriorities + "&"; | |||
} | |||
@@ -247,7 +250,6 @@ public final class ResourcesQuery extends AbstractResourceQuery<Resources> { | |||
m.setRuleKey(JsonUtils.getString(measure, "rule_key")); | |||
m.setRuleName(JsonUtils.getString(measure, "rule_name")); | |||
m.setRuleCategory(JsonUtils.getString(measure, "rule_category")); | |||
m.setRulePriority(JsonUtils.getString(measure, "rule_priority")); | |||
m.setDate(date); | |||
return m; |
@@ -22,12 +22,10 @@ package org.sonar.api.web.gwt.client.webservices; | |||
public class Rule extends ResponsePOJO { | |||
private String key; | |||
private String name; | |||
private String category; | |||
public Rule(String key, String name, String category) { | |||
public Rule(String key, String name) { | |||
this.key = key; | |||
this.name = name; | |||
this.category = category; | |||
} | |||
@@ -47,11 +45,11 @@ public class Rule extends ResponsePOJO { | |||
this.name = name; | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public String getCategory() { | |||
return category; | |||
} | |||
public void setCategory(String category) { | |||
this.category = category; | |||
return null; | |||
} | |||
} |
@@ -31,7 +31,6 @@ public final class ViolationsQuery extends AbstractResourceQuery<Violations> { | |||
private String scopes; | |||
private String qualifiers; | |||
private String rules; | |||
private String categories; | |||
private String priorities; | |||
private Integer depth; | |||
@@ -70,12 +69,19 @@ public final class ViolationsQuery extends AbstractResourceQuery<Violations> { | |||
return this; | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public String getCategories() { | |||
return categories; | |||
return null; | |||
} | |||
/** | |||
* @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 | |||
*/ | |||
@Deprecated | |||
public ViolationsQuery setCategories(String s) { | |||
this.categories = s; | |||
return this; | |||
} | |||
@@ -112,9 +118,6 @@ public final class ViolationsQuery extends AbstractResourceQuery<Violations> { | |||
if (rules != null) { | |||
url += "rules=" + rules + "&"; | |||
} | |||
if (categories != null) { | |||
url += "categories=" + categories + "&"; | |||
} | |||
if (priorities != null) { | |||
url += "priorities=" + priorities + "&"; | |||
} | |||
@@ -150,9 +153,7 @@ public final class ViolationsQuery extends AbstractResourceQuery<Violations> { | |||
JSONObject ruleObj = jsViolation.get("rule").isObject(); | |||
Rule rule = new Rule( | |||
JsonUtils.getString(ruleObj, "key"), | |||
JsonUtils.getString(ruleObj, "name"), | |||
JsonUtils.getString(ruleObj, "category") | |||
); | |||
JsonUtils.getString(ruleObj, "name")); | |||
result.add(new Violation(message.stringValue(), priority.stringValue(), lineIndex, rule, null)); | |||
} |
@@ -21,7 +21,7 @@ package org.sonar.api.checks; | |||
import org.sonar.check.*; | |||
@Rule(isoCategory = IsoCategory.Efficiency, priority = Priority.CRITICAL) | |||
@Rule(priority = Priority.CRITICAL) | |||
class CheckWithIntegerProperty { | |||
@RuleProperty |
@@ -1,10 +1,9 @@ | |||
package org.sonar.api.checks; | |||
import org.sonar.check.IsoCategory; | |||
import org.sonar.check.Priority; | |||
import org.sonar.check.Rule; | |||
@Rule(key = "CheckWithKey", isoCategory = IsoCategory.Efficiency, priority = Priority.CRITICAL) | |||
@Rule(key = "CheckWithKey", priority = Priority.CRITICAL) | |||
public class CheckWithKey { | |||
} |
@@ -19,12 +19,11 @@ | |||
*/ | |||
package org.sonar.api.checks; | |||
import org.sonar.check.IsoCategory; | |||
import org.sonar.check.Priority; | |||
import org.sonar.check.Rule; | |||
import org.sonar.check.RuleProperty; | |||
@Rule(isoCategory = IsoCategory.Efficiency, priority = Priority.CRITICAL) | |||
@Rule(priority = Priority.CRITICAL) | |||
class CheckWithOverriddenPropertyKey{ | |||
@RuleProperty(key = "maximum") |
@@ -19,9 +19,11 @@ | |||
*/ | |||
package org.sonar.api.checks; | |||
import org.sonar.check.*; | |||
import org.sonar.check.Priority; | |||
import org.sonar.check.Rule; | |||
import org.sonar.check.RuleProperty; | |||
@Rule(isoCategory = IsoCategory.Efficiency, priority = Priority.CRITICAL) | |||
@Rule(priority = Priority.CRITICAL) | |||
class CheckWithPrimitiveProperties { | |||
@RuleProperty(description = "Maximum threshold") |
@@ -19,9 +19,11 @@ | |||
*/ | |||
package org.sonar.api.checks; | |||
import org.sonar.check.*; | |||
import org.sonar.check.Priority; | |||
import org.sonar.check.Rule; | |||
import org.sonar.check.RuleProperty; | |||
@Rule(isoCategory = IsoCategory.Efficiency, priority = Priority.CRITICAL) | |||
@Rule(priority = Priority.CRITICAL) | |||
class CheckWithStringProperty { | |||
@RuleProperty |
@@ -19,9 +19,11 @@ | |||
*/ | |||
package org.sonar.api.checks; | |||
import org.sonar.check.*; | |||
import org.sonar.check.Priority; | |||
import org.sonar.check.Rule; | |||
import org.sonar.check.RuleProperty; | |||
@Rule(isoCategory = IsoCategory.Efficiency, priority = Priority.CRITICAL) | |||
@Rule(priority = Priority.CRITICAL) | |||
class CheckWithUnsupportedPropertyType { | |||
@RuleProperty |
@@ -19,11 +19,10 @@ | |||
*/ | |||
package org.sonar.api.checks; | |||
import org.sonar.check.IsoCategory; | |||
import org.sonar.check.Priority; | |||
import org.sonar.check.Rule; | |||
@Rule(isoCategory = IsoCategory.Efficiency, priority = Priority.CRITICAL) | |||
@Rule(priority = Priority.CRITICAL) | |||
class CheckWithoutProperties { | |||
} |
@@ -20,16 +20,14 @@ | |||
package org.sonar.api.measures; | |||
import org.apache.commons.lang.StringUtils; | |||
import static org.hamcrest.CoreMatchers.is; | |||
import static org.hamcrest.CoreMatchers.nullValue; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertThat; | |||
import org.junit.Test; | |||
import org.sonar.api.rules.Iso9126RulesCategories; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RulePriority; | |||
import static org.hamcrest.CoreMatchers.is; | |||
import static org.hamcrest.CoreMatchers.nullValue; | |||
import static org.junit.Assert.*; | |||
public class MeasureTest { | |||
@Test |
@@ -19,8 +19,6 @@ | |||
*/ | |||
package org.sonar.api.measures; | |||
import static org.hamcrest.core.Is.is; | |||
import static org.junit.Assert.assertThat; | |||
import org.junit.Test; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RulePriority; | |||
@@ -29,6 +27,9 @@ import java.util.Arrays; | |||
import java.util.Collection; | |||
import java.util.List; | |||
import static org.hamcrest.core.Is.is; | |||
import static org.junit.Assert.assertThat; | |||
public class MeasuresFiltersTest { | |||
@Test | |||
@@ -97,18 +98,6 @@ public class MeasuresFiltersTest { | |||
assertThat(filter.filter(measures).size(), is(2)); | |||
} | |||
@Test | |||
public void ruleCategory() { | |||
MeasuresFilter<RuleMeasure> filter = MeasuresFilters.ruleCategory(CoreMetrics.VIOLATIONS, 2); | |||
List<Measure> measures = Arrays.asList( | |||
RuleMeasure.createForPriority(CoreMetrics.VIOLATIONS, RulePriority.CRITICAL, 50.0), | |||
RuleMeasure.createForCategory(CoreMetrics.VIOLATIONS, 2, 10.0), | |||
RuleMeasure.createForCategory(CoreMetrics.VIOLATIONS, 3, 15.0), | |||
new Measure(CoreMetrics.VIOLATIONS, 500.0)); | |||
assertThat(filter.filter(measures).getValue(), is(10.0)); | |||
} | |||
@Test | |||
public void measure() { | |||
MeasuresFilter<Measure> filter = MeasuresFilters.measure(new Measure(CoreMetrics.VIOLATIONS)); |
@@ -19,12 +19,13 @@ | |||
*/ | |||
package org.sonar.api.measures; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import org.junit.Test; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RulePriority; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
public class RuleMeasureTest { | |||
@Test | |||
@@ -33,10 +34,6 @@ public class RuleMeasureTest { | |||
RuleMeasure.createForPriority(CoreMetrics.CLASSES, RulePriority.CRITICAL, 4.5), | |||
RuleMeasure.createForPriority(CoreMetrics.CLASSES, RulePriority.CRITICAL, 3.4)); | |||
assertEquals( | |||
RuleMeasure.createForCategory(CoreMetrics.CLASSES, 3, 4.5), | |||
RuleMeasure.createForCategory(CoreMetrics.CLASSES, 3, 3.4)); | |||
assertEquals( | |||
RuleMeasure.createForRule(CoreMetrics.CLASSES, new Rule("pmd", "abc1"), 4.5), | |||
RuleMeasure.createForRule(CoreMetrics.CLASSES, new Rule("pmd", "abc1"), 3.4)); | |||
@@ -49,10 +46,6 @@ public class RuleMeasureTest { | |||
RuleMeasure.createForPriority(CoreMetrics.CLASSES, RulePriority.CRITICAL, 4.5), | |||
RuleMeasure.createForPriority(CoreMetrics.CLASSES, RulePriority.BLOCKER, 3.4)); | |||
assertNotEquals( | |||
RuleMeasure.createForCategory(CoreMetrics.CLASSES, 3, 4.5), | |||
RuleMeasure.createForCategory(CoreMetrics.CLASSES, 331, 3.4)); | |||
assertNotEquals( | |||
RuleMeasure.createForRule(CoreMetrics.CLASSES, new Rule("pmd", "abc1"), 4.5), | |||
RuleMeasure.createForRule(CoreMetrics.CLASSES, new Rule("pmd", "def2"), 3.4)); |
@@ -28,7 +28,6 @@ import org.sonar.api.rules.RuleFinder; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.utils.ValidationMessages; | |||
import org.sonar.check.BelongsToProfile; | |||
import org.sonar.check.IsoCategory; | |||
import org.sonar.check.Priority; | |||
import static org.hamcrest.Matchers.is; | |||
@@ -75,11 +74,11 @@ public class AnnotationProfileParserTest { | |||
} | |||
@BelongsToProfile(title = "Other profile", priority = Priority.BLOCKER) | |||
@org.sonar.check.Rule(key = "other", isoCategory = IsoCategory.Efficiency, priority = Priority.CRITICAL) | |||
@org.sonar.check.Rule(key = "other", priority = Priority.CRITICAL) | |||
class RuleOnOtherProfile { | |||
} | |||
@BelongsToProfile(title = "Foo way", priority = Priority.BLOCKER) | |||
@org.sonar.check.Rule(key = "fake", isoCategory = IsoCategory.Efficiency, priority = Priority.CRITICAL) | |||
@org.sonar.check.Rule(key = "fake", priority = Priority.CRITICAL) | |||
class FakeRule { | |||
} |
@@ -25,6 +25,7 @@ import org.sonar.api.measures.Metric; | |||
import java.util.List; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
public class CoreMetricsTest { | |||
@@ -35,4 +36,14 @@ public class CoreMetricsTest { | |||
assertTrue(metrics.contains(CoreMetrics.NCLOC)); | |||
assertTrue(metrics.contains(CoreMetrics.DIRECTORIES)); | |||
} | |||
@Test | |||
public void shouldExcludeDeprecatedIsoMetrics() { | |||
List<Metric> metrics = CoreMetrics.getMetrics(); | |||
assertFalse(metrics.contains(CoreMetrics.USABILITY)); | |||
assertFalse(metrics.contains(CoreMetrics.EFFICIENCY)); | |||
assertFalse(metrics.contains(CoreMetrics.RELIABILITY)); | |||
assertFalse(metrics.contains(CoreMetrics.PORTABILITY)); | |||
assertFalse(metrics.contains(CoreMetrics.MAINTAINABILITY)); | |||
} | |||
} |
@@ -19,8 +19,6 @@ | |||
*/ | |||
package org.sonar.api.rules; | |||
import org.sonar.check.IsoCategory; | |||
@org.sonar.check.Rule(name ="Annotated Check", description = "Description", isoCategory = IsoCategory.Reliability) | |||
@org.sonar.check.Rule(name ="Annotated Check", description = "Description") | |||
public class AnnotatedCheck { | |||
} |
@@ -19,10 +19,9 @@ | |||
*/ | |||
package org.sonar.api.rules; | |||
import org.sonar.check.IsoCategory; | |||
import org.sonar.check.RuleProperty; | |||
@org.sonar.check.Rule(key = "overridden_key", name = "Check with parameters", description = "Has parameters", isoCategory = IsoCategory.Efficiency) | |||
@org.sonar.check.Rule(key = "overridden_key", name = "Check with parameters", description = "Has parameters") | |||
public class AnnotatedCheckWithParameters { | |||
@RuleProperty(description = "Maximum value") |