我试图排除文件上的声纳扫描

时间:2016-01-06 18:20:53

标签: sonarqube sonar-runner sonatype

我在Pom.xml文件中设置了它以排除声纳扫描,但它不起作用。有没有语法问题?

任何人都可以帮忙解决这个问题吗?

import java.util.Scanner;

public class QiftPositivCount {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        final int SENTINEL = -9999;
        int temp;
        int x = 0;
        int count = 0;
        do {
            System.out.print("Type numbers (-9999 to end) : ");
            if((temp = scan.nextInt()) == SENTINEL){
                break;
            }else {
                x = temp;
                count++;
            }  

        } while (temp != SENTINEL); // not really needed as you have the break statement

        if (count == 0) {
            System.out.println("You didnt type any number");

        } else {
            System.out.println("There are " + count + " numbers typed , and the numbers that fulfill the conditon are "
                    + CountQiftPositiv(x)); // This was sending -9999 which will always evaluate to false in the function
            //poz will stay at 0 the entire time
        }

    }

    private static int CountQiftPositiv(int nr) {
        int poz = 0;
        //if(nr % 6 && nr > 0){
        if (nr % 2 == 0 && nr % 3 == 0 && nr > 0) {
            poz++;
        }
        return poz;
    }
}

2 个答案:

答案 0 :(得分:0)

  • 您的例子中exclusions和结束>之间有一个空格。删除它。
  • 你应该在分隔逗号
  • 的参数后面加一个空格
  • 您的第二个参数提到了{Maver环境中最有可能**S**rc的{​​{1}}

答案 1 :(得分:0)

这就是我的方式。

        <sonar.exclusions>
            src/main/java/com/bean/**,
            src/main/java/com/response/**,
            src/main/java/com/filter/**,
            src/main/java/com/constants/**
        </sonar.exclusions>