当前位置: 首页>>代码示例>>Java>>正文


Java SourceClass类代码示例

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


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

示例1: saveClassComplexity

import org.sonar.squidbridge.api.SourceClass; //导入依赖的package包/类
private void saveClassComplexity(InputFile inputFile, SourceFile squidFile) {
	Collection<SourceCode> classes = scanner.getIndex().search(new QueryByParent(squidFile),
			new QueryByType(SourceClass.class));
	double complexityInClasses = 0;
	for (SourceCode squidClass : classes) {
		double classComplexity = squidClass.getDouble(FlowMetric.INVOKES);
		complexityInClasses += classComplexity;
	}
	context.saveMeasure(inputFile, CoreMetrics.COMPLEXITY_IN_CLASSES, complexityInClasses);
}
 
开发者ID:I8C,项目名称:sonar-flow-plugin,代码行数:11,代码来源:FlowSquidSensor.java

示例2: leaveNode

import org.sonar.squidbridge.api.SourceClass; //导入依赖的package包/类
@Override
public void leaveNode(AstNode node) {
  SourceClass sourceClass = (SourceClass) getContext().peekSourceCode();
  int complexity = ChecksHelper.getRecursiveMeasureInt(sourceClass, PuppetMetric.COMPLEXITY);

  if (complexity > max) {
    String nodeType = node.is(PuppetGrammar.CLASSDEF) ? "class" : "define";
    addIssue(node, this,
      "The complexity of this " + nodeType + " is " + complexity + " which is greater than " + max + " authorized. Split this " + nodeType + ".",
      (double) complexity - max);
  }
}
 
开发者ID:iwarapter,项目名称:sonar-puppet,代码行数:13,代码来源:TooComplexClassesAndDefinesCheck.java

示例3: createSourceCode

import org.sonar.squidbridge.api.SourceClass; //导入依赖的package包/类
@Override
public SourceCode createSourceCode(SourceCode parentSourceCode, AstNode astNode) {
  seq++;
  SourceClass cls = new SourceClass("class:" + seq);
  cls.setStartAtLine(astNode.getTokenLine());
  return cls;
}
 
开发者ID:iwarapter,项目名称:sonar-puppet,代码行数:8,代码来源:PuppetAstScanner.java

示例4: saveClassComplexity

import org.sonar.squidbridge.api.SourceClass; //导入依赖的package包/类
private void saveClassComplexity(SensorContext context, InputFile inputFile, SourceFile squidFile) {
  Collection<SourceCode> classes = scanner.getIndex().search(new QueryByParent(squidFile), new QueryByType(SourceClass.class));
  int complexityInClasses = 0;
  for (SourceCode squidClass : classes) {
    int classComplexity = squidClass.getInt(LuaMetric.COMPLEXITY);
    complexityInClasses += classComplexity;
  }
  context.<Integer>newMeasure()
    .on(inputFile)
    .forMetric(CoreMetrics.COMPLEXITY_IN_CLASSES)
    .withValue(complexityInClasses)
    .save();
}
 
开发者ID:SonarQubeCommunity,项目名称:sonar-lua,代码行数:14,代码来源:LuaSquidSensor.java

示例5: leaveNode

import org.sonar.squidbridge.api.SourceClass; //导入依赖的package包/类
@Override
public void leaveNode(AstNode node) {
 SourceClass table = (SourceClass) getContext().peekSourceCode();
 
  int tableComplexity = ChecksHelper.getRecursiveMeasureInt(table, LuaMetric.COMPLEXITY);
  if (tableComplexity > maximumTableComplexityThreshold) {
    String message = String.format("Table has a complexity of %s which is greater than %s authorized.", tableComplexity, maximumTableComplexityThreshold);
    createIssueWithCost(message, node, (double)tableComplexity - maximumTableComplexityThreshold);
  }
}
 
开发者ID:SonarQubeCommunity,项目名称:sonar-lua,代码行数:11,代码来源:TableComplexityCheck.java


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