• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SquidCheck类的典型用法和代码示例

java 1次浏览

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

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

示例1: FlowSquidSensor

点赞 3

import org.sonar.squidbridge.checks.SquidCheck; //导入依赖的package包/类
public FlowSquidSensor(Settings settings, CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory,
                        FileSystem fileSystem, ResourcePerspectives resourcePerspectives, PathResolver pathResolver) {
logger.debug("** FlowSquidSenser constructor");
this.settings = settings;
this.pathResolver = pathResolver;
   this.checks = checkFactory
     .<SquidCheck<Grammar>>create(CheckList.REPOSITORY_KEY)
     .addAnnotatedChecks((Iterable)CheckList.getChecks(settings.getBoolean(FlowPlugin.IGNORE_TOPLEVEL_KEY),false));
   this.nodeChecks = checkFactory
	      .<SquidCheck<Grammar>>create(CheckList.REPOSITORY_KEY)
	      .addAnnotatedChecks((Iterable)CheckList.getChecks(settings.getBoolean(FlowPlugin.IGNORE_TOPLEVEL_KEY), true));
   this.fileLinesContextFactory = fileLinesContextFactory;
   this.fileSystem = fileSystem;
   this.resourcePerspectives = resourcePerspectives;
   this.mainFilePredicates = fileSystem.predicates().and(
     fileSystem.predicates().hasLanguage(FlowLanguage.KEY),
     fileSystem.predicates().hasType(InputFile.Type.MAIN));
 }
 

开发者ID:I8C,
项目名称:sonar-flow-plugin,
代码行数:19,
代码来源:FlowSquidSensor.java

示例2: saveViolations

点赞 3

import org.sonar.squidbridge.checks.SquidCheck; //导入依赖的package包/类
private void saveViolations(SensorContext context, InputFile inputFile, SourceFile squidFile) {
  Collection<CheckMessage> messages = squidFile.getCheckMessages();
  if (messages != null) {

    for (CheckMessage message : messages) {
      RuleKey ruleKey = checks.ruleKey((SquidCheck<LexerlessGrammar>) message.getCheck());
      NewIssue newIssue = context.newIssue()
        .forRule(ruleKey)
        .gap(message.getCost());
      Integer line = message.getLine();
      NewIssueLocation location = newIssue.newLocation()
        .on(inputFile)
        .message(message.getText(Locale.ENGLISH));
      if (line != null) {
        location.at(inputFile.selectLine(line));
      }
      newIssue.at(location);
      newIssue.save();
    }
  }
}
 

开发者ID:SonarQubeCommunity,
项目名称:sonar-lua,
代码行数:22,
代码来源:LuaSquidSensor.java

示例3: saveViolations

点赞 2

import org.sonar.squidbridge.checks.SquidCheck; //导入依赖的package包/类
private void saveViolations(InputFile inputFile, SourceFile squidFile) {
	Collection<CheckMessage> messages = squidFile.getCheckMessages();
	if (messages != null) {
		for (CheckMessage message : messages) {
			SquidCheck<Grammar> c = (SquidCheck<Grammar>) message.getCheck();
			logger.debug("+++File: " + squidFile.getKey() + " - Checking message ToplevelService: " + squidFile.getInt(FlowMetric.IS_TOP_LEVEL) + " TopLevelCheck: " +  String.valueOf(c instanceof TopLevelCheck));
			if(squidFile.getInt(FlowMetric.IS_TOP_LEVEL)!=1 && c instanceof TopLevelCheck){
				logger.debug("+++Ignoring toplevelCheck: " + c.getKey() + " for file: " + squidFile.getKey());
			}else{
				logger.debug("+++ Message " + message.getDefaultMessage());
				logger.debug("+++ Message " + message.toString());
				RuleKey ruleKey;
				if(message.getCheck() instanceof NodeCheck){
					ruleKey = nodeChecks.ruleKey((SquidCheck<Grammar>) message.getCheck());
				}else
					ruleKey = checks.ruleKey((SquidCheck<Grammar>) message.getCheck());
				Issuable issuable = resourcePerspectives.as(Issuable.class, inputFile);
				if (issuable != null) {
					IssueBuilder issueBuilder = issuable.newIssueBuilder().ruleKey(ruleKey).line(message.getLine())
							.message(message.getText(Locale.ENGLISH));

					if (message.getCost() != null) {
						issueBuilder.effortToFix(message.getCost());
					}

					issuable.addIssue(issueBuilder.build());
				}
			}
		}
	}
}
 

开发者ID:I8C,
项目名称:sonar-flow-plugin,
代码行数:32,
代码来源:FlowSquidSensor.java

示例4: LuaSquidSensor

点赞 2

import org.sonar.squidbridge.checks.SquidCheck; //导入依赖的package包/类
public LuaSquidSensor(CheckFactory checkFactory, FileLinesContextFactory fileLinesContextFactory) {
  this.checks = checkFactory
    .<SquidCheck<LexerlessGrammar>>create(CheckList.REPOSITORY_KEY)
    .addAnnotatedChecks((Iterable) CheckList.getChecks());
  this.fileLinesContextFactory = fileLinesContextFactory;
}
 

开发者ID:SonarQubeCommunity,
项目名称:sonar-lua,
代码行数:7,
代码来源:LuaSquidSensor.java

示例5: scanFilesWithCheck

点赞 1

import org.sonar.squidbridge.checks.SquidCheck; //导入依赖的package包/类
/**
 * Scan files given a file path and the respective check to scan file
 * @param filePath the path of the file to be scanned.
 * @param check visitor.
 */
private void scanFilesWithCheck(String filePath, SquidCheck<Grammar> check) {
    File file = new File(filePath);
    sourceFile = ApexAstScanner.scanFile(file, check);
}
 

开发者ID:fundacionjala,
项目名称:enforce-sonarqube-plugin,
代码行数:10,
代码来源:HardcodingIdsCheckTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)