• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DefaultSensorDescriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor的典型用法代码示例。如果您正苦于以下问题:Java DefaultSensorDescriptor类的具体用法?Java DefaultSensorDescriptor怎么用?Java DefaultSensorDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultSensorDescriptor类属于org.sonar.api.batch.sensor.internal包,在下文中一共展示了DefaultSensorDescriptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: shouldExecute

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
/**
 * Decide if the given Sensor should be executed.
 */
public boolean shouldExecute(DefaultSensorDescriptor descriptor) {
  if (!fsCondition(descriptor)) {
    LOG.debug("'{}' skipped because there is no related file in current project", descriptor.name());
    return false;
  }
  if (!activeRulesCondition(descriptor)) {
    LOG.debug("'{}' skipped because there is no related rule activated in the quality profile", descriptor.name());
    return false;
  }
  if (!settingsCondition(descriptor)) {
    LOG.debug("'{}' skipped because one of the required properties is missing", descriptor.name());
    return false;
  }
  return true;
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:19,代码来源:SensorOptimizer.java


示例2: should_optimize_on_repository

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@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);

  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);
  assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:24,代码来源:SensorOptimizerTest.java


示例3: sensor_descriptor

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void sensor_descriptor() {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    createSensor().describe(descriptor);

    assertThat(descriptor.name()).isEqualTo("1C 7.7 sensor");
    assertThat(descriptor.languages()).containsOnly("1c 7.7");
    assertThat(descriptor.type()).isEqualTo(Type.MAIN);
}
 
开发者ID:antowski,项目名称:sonar-onec,代码行数:10,代码来源:OneCSensorTest.java


示例4: describe

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void describe() {
	DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
	sensor.describe(descriptor);
	Assert.assertEquals("Package Analyzer Sensor (TEST)", descriptor.name());
	Assert.assertEquals(Arrays.asList("TEST"), descriptor.languages());
}
 
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:8,代码来源:AbstractSensorTest.java


示例5: execute

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Override
public void execute() {
  for (Sensor sensor : sort(asList(sensors))) {
    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    sensor.describe(descriptor);
    if (sensorOptimizer.shouldExecute(descriptor)) {
      executeSensor(context, sensor, descriptor);
    }
  }
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:11,代码来源:NewSensorsExecutor.java


示例6: settingsCondition

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
private boolean settingsCondition(DefaultSensorDescriptor descriptor) {
  if (!descriptor.properties().isEmpty()) {
    for (String propertyKey : descriptor.properties()) {
      if (!settings.hasKey(propertyKey)) {
        return false;
      }
    }
  }
  return true;
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:11,代码来源:SensorOptimizer.java


示例7: activeRulesCondition

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
private boolean activeRulesCondition(DefaultSensorDescriptor descriptor) {
  if (!descriptor.ruleRepositories().isEmpty()) {
    for (String repoKey : descriptor.ruleRepositories()) {
      if (!activeRules.findByRepository(repoKey).isEmpty()) {
        return true;
      }
    }
    return false;
  }
  return true;
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:12,代码来源:SensorOptimizer.java


示例8: fsCondition

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
private boolean fsCondition(DefaultSensorDescriptor descriptor) {
  if (!descriptor.languages().isEmpty() || descriptor.type() != null) {
    FilePredicate langPredicate = descriptor.languages().isEmpty() ? fs.predicates().all() : fs.predicates().hasLanguages(descriptor.languages());

    FilePredicate typePredicate = descriptor.type() == null ? fs.predicates().all() : fs.predicates().hasType(descriptor.type());
    return fs.hasFiles(fs.predicates().and(langPredicate, typePredicate));
  }
  return true;
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:10,代码来源:SensorOptimizer.java


示例9: SensorWrapper

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
public SensorWrapper(Sensor newSensor, SensorContext adaptor, SensorOptimizer optimizer) {
  this.wrappedSensor = newSensor;
  this.optimizer = optimizer;
  descriptor = new DefaultSensorDescriptor();
  newSensor.describe(descriptor);
  this.adaptor = adaptor;
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:8,代码来源:SensorWrapper.java


示例10: should_optimize_on_language

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void should_optimize_on_language() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor()
    .onlyOnLanguages("java", "php");
  assertThat(optimizer.shouldExecute(descriptor)).isFalse();

  fs.add(new TestInputFileBuilder("foo", "src/Foo.java").setLanguage("java").build());
  assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:10,代码来源:SensorOptimizerTest.java


示例11: should_optimize_on_type

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void should_optimize_on_type() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor()
    .onlyOnFileType(InputFile.Type.MAIN);
  assertThat(optimizer.shouldExecute(descriptor)).isFalse();

  fs.add(new TestInputFileBuilder("foo", "tests/FooTest.java").setType(InputFile.Type.TEST).build());
  assertThat(optimizer.shouldExecute(descriptor)).isFalse();

  fs.add(new TestInputFileBuilder("foo", "src/Foo.java").setType(InputFile.Type.MAIN).build());
  assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:13,代码来源:SensorOptimizerTest.java


示例12: should_optimize_on_both_type_and_language

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void should_optimize_on_both_type_and_language() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor()
    .onlyOnLanguages("java", "php")
    .onlyOnFileType(InputFile.Type.MAIN);
  assertThat(optimizer.shouldExecute(descriptor)).isFalse();

  fs.add(new TestInputFileBuilder("foo", "tests/FooTest.java").setLanguage("java").setType(InputFile.Type.TEST).build());
  fs.add(new TestInputFileBuilder("foo", "src/Foo.cbl").setLanguage("cobol").setType(InputFile.Type.MAIN).build());
  assertThat(optimizer.shouldExecute(descriptor)).isFalse();

  fs.add(new TestInputFileBuilder("foo", "src/Foo.java").setLanguage("java").setType(InputFile.Type.MAIN).build());
  assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:15,代码来源:SensorOptimizerTest.java


示例13: should_optimize_on_settings

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@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();
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:10,代码来源:SensorOptimizerTest.java


示例14: should_create_a_valid_sensor_descriptor

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void should_create_a_valid_sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  createCssSquidSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("CSS Analyzer Sensor");
  assertThat(descriptor.languages()).containsOnly("css");
  assertThat(descriptor.type()).isEqualTo(InputFile.Type.MAIN);
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:9,代码来源:CssAnalyzerSensorTest.java


示例15: should_create_a_valid_sensor_descriptor

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void should_create_a_valid_sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  createEmbeddedCssSquidSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("Embedded CSS Analyzer Sensor");
  assertThat(descriptor.languages()).isEmpty();
  assertThat(descriptor.type()).isNull();
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:9,代码来源:EmbeddedCssAnalyzerSensorTest.java


示例16: should_create_a_valid_sensor_descriptor

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void should_create_a_valid_sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  createLessSquidSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("Less Analyzer Sensor");
  assertThat(descriptor.languages()).containsOnly("less");
  assertThat(descriptor.type()).isEqualTo(InputFile.Type.MAIN);
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:9,代码来源:LessAnalyzerSensorTest.java


示例17: should_create_a_valid_sensor_descriptor

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void should_create_a_valid_sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
  createScssSquidSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("SCSS Analyzer Sensor");
  assertThat(descriptor.languages()).containsOnly("scss");
  assertThat(descriptor.type()).isEqualTo(InputFile.Type.MAIN);
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:9,代码来源:ScssAnalyzerSensorTest.java


示例18: testDescriptor

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void testDescriptor() {
	final JdependSensor subject = new JdependSensor();
	final DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
	subject.describe(descriptor);

	Assert.assertEquals("jDepend sensor", descriptor.name());
	Assert.assertEquals(1, descriptor.languages().size());
	Assert.assertEquals("java", descriptor.languages().iterator().next());
	Assert.assertEquals(0, descriptor.ruleRepositories().size());
}
 
开发者ID:willemsrb,项目名称:sonar-jdepend-plugin,代码行数:12,代码来源:JdependSensorTest.java


示例19: testDescriptor

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void testDescriptor() {
	final PackagesSensor subject = new PackagesSensor();
	final DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
	subject.describe(descriptor);

	Assert.assertEquals("Packages sensor", descriptor.name());
	Assert.assertEquals(1, descriptor.languages().size());
	Assert.assertEquals("java", descriptor.languages().iterator().next());
	Assert.assertEquals(0, descriptor.ruleRepositories().size());
}
 
开发者ID:willemsrb,项目名称:sonar-jdepend-plugin,代码行数:12,代码来源:PackagesSensorTest.java


示例20: sensor_descriptor

import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; //导入依赖的package包/类
@Test
public void sensor_descriptor() {
  DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();

  createSensor().describe(descriptor);
  assertThat(descriptor.name()).isEqualTo("Perl Sensor");
  assertThat(descriptor.languages()).containsOnly("perl");
  assertThat(descriptor.type()).isEqualTo(Type.MAIN);
}
 
开发者ID:sonar-perl,项目名称:sonar-perl,代码行数:10,代码来源:GlobalSensorTest.java



注:本文中的org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JdbmPartition类代码示例发布时间:2022-05-21
下一篇:
Java UnicodeScript类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap