use of org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor in project sonarlint-core by SonarSource.
the class SensorOptimizerTest method should_run_analyzer_with_no_metadata.
@Test
public void should_run_analyzer_with_no_metadata() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
use of org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor in project sonarlint-core by SonarSource.
the class SensorOptimizerTest method should_optimize_on_settings.
@Test
public void should_optimize_on_settings() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor().requireProperty("sonar.foo.reportPath");
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
settings.setProperty("sonar.foo.reportPath", "foo");
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
use of org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor in project sonarlint-core by SonarSource.
the class SensorOptimizerTest method should_optimize_on_repository.
@Test
public void should_optimize_on_repository() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor().createIssuesForRuleRepositories("squid");
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
ActiveRules activeRules = new ActiveRulesBuilder().create(RuleKey.of("repo1", "foo")).activate().build();
optimizer = new SensorOptimizer(fs, activeRules, settings.asConfig());
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
activeRules = new ActiveRulesBuilder().create(RuleKey.of("repo1", "foo")).activate().create(RuleKey.of("squid", "rule")).activate().build();
optimizer = new SensorOptimizer(fs, activeRules, settings.asConfig());
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
use of org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor in project sonarlint-core by SonarSource.
the class NewSensorsExecutor method execute.
@Override
public void execute() {
for (Sensor sensor : sort(asList(sensors))) {
progress.checkCancel();
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
sensor.describe(descriptor);
if (sensorOptimizer.shouldExecute(descriptor)) {
executeSensor(context, sensor, descriptor);
}
}
}
use of org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor in project sonar-web by SonarSource.
the class WebSensorTest method testDescriptor.
@Test
public void testDescriptor() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
sensor.describe(descriptor);
assertThat(descriptor.name()).isEqualTo("Web");
assertThat(descriptor.languages()).containsOnly("web");
}
Aggregations