无法解决SonarQube错误“使此行从第3列开始”

时间:2018-06-21 06:42:10

标签: android sonarqube

我在xml中有很多与此错误有关的行(布局,字符串,可绘制对象...)。我试图将每个列的空间更改为3,在出现此错误的行中放置3个制表符,但在SonarQube中仍然出现此错误。我该怎么解决?

我在这里举了一个出现此错误的示例:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="64.42dp"
    android:height="68.76dp"
    android:viewportWidth="64.42"
    android:viewportHeight="68.76">
    <path
        android:fillColor="#141412"
        android:fillType="evenOdd"
        android:pathData="M38.62,43.24c0.69,0.1,1.2,0.75,2.01,0.86c1.33,0.18,2.57-0.02,3.7-0.77 c1.98-1.33,3.56-3.23,3.66-5.65c0.01-0.34-0.04-1.42-0.04-1.69c0-1.01-0.57-1.32-0.75-2.3c-0.3-1.61,1.23-0.8,1.42,0.33 c-0.13-0.77,0.69-4.28,2.59-2.64c1.63,1.4,0.07,2.82-0.24,4.24c-0.14,0.63-0.45,1.84-0.54,2.48c0,0,0,0-0.01,0 c-0.35,2.33-1.41,4.8-2.95,6.34c-1.35,1.35-3.05,2.76-5.02,2.92c-1.15,0.1-3.25-0.08-4.27-0.66l0.21,0.42 C36.59,47.68,36.57,42.95,38.62,43.24z" />
    <path
        android:fillColor="#C31924"
        android:fillType="evenOdd"
        android:pathData="M61.69,43.35c0.82-2.66,2.14-11.44,2.28-12.49c0.13-1.05,0.42-2.32,0.45-3.83 c0.03-1.51-1.36-3.05-3.35-3.04c-0.36,0-16.15,0.06-16.92,0.07c-0.52,0-0.66-0.27-0.63-0.56c0.27-2.7,0.8-6.13,0.88-6.58 c0.08-0.41,0.16-0.8,0.17-1c0.02-0.2,0.06-0.49-0.42-0.62c-0.49-0.12-4.1-0.59-21.86-0.5C5.2,14.89,0.91,15.4,0.43,15.53 c-0.49,0.13-0.44,0.42-0.42,0.62c0.01,0.2,0.13,0.7,0.18,0.99c0.07,0.33,0.71,3.87,0.96,6.58c0.68,7.77,1.49,39.99,1.6,41.09 c0.08,0.77,0.31,2.1,1.91,3.03c1.6,0.94,16.85,0.92,17.9,0.91c1.05,0.01,16.3-0.13,17.89-1.09c1.59-0.96,1.81-2.28,1.88-3.05 c0.04-0.41,0.14-5.19,0.15-5.43c0.02-0.25,0.17-0.69,0.63-0.75c0.82-0.1,1.64-0.2,2.9-0.46c3.83-0.79,6.07-2.06,8.61-3.89 C59.28,50.69,60.88,46.02,61.69,43.35 M56.84,43.88c-1.03,2.45-3.81,7.25-8.9,9.07c-1.94,0.7-4.31,1.21-4.71,1.21 c-0.56,0.01-0.63-0.04-0.63-0.39c0-0.36,0.17-9.65,0.21-10.87c0.22-6.95,2.25-12.22,4.9-13.52c0.57-0.28,1.45-0.75,3.89-0.76 c2.95-0.02,6.98-0.03,7.36-0.04c0.38,0,0.66,0,0.66,0.31c0.01,0.44-0.61,4.63-0.67,5.04C58.87,34.35,57.85,41.49,56.84,43.88" />
    <path
        android:fillColor="#141412"
        android:pathData="M24.38,32.2c0,0.97,0.53,1.76,1.16,1.75c0.64,0,1.15-0.79,1.14-1.77c0-0.97-0.53-1.75-1.16-1.75 C24.89,30.44,24.37,31.23,24.38,32.2z" />
    <path
        android:fillColor="#141412"
        android:pathData="M17.59,32.23c0,0.97,0.53,1.76,1.16,1.75c0.64,0,1.15-0.79,1.15-1.77c0-0.97-0.53-1.75-1.16-1.75 C18.1,30.47,17.59,31.26,17.59,32.23z" />
    <path
        android:fillColor="#141412"
        android:pathData="M17.88,35.89c0.01,2.3,1.88,4.15,4.17,4.13c2.29-0.01,4.15-1.88,4.13-4.18" />
    <path
        android:fillColor="#D38690"
        android:fillType="evenOdd"
        android:pathData="M22.61,1.28c0.61-0.69,1.27-1.36,2.61-1.26c1.32,0.09,2.12,0.97,2.44,1.94 c0.41,1.25-0.12,2.55-0.74,3.34c-1.26,1.59-3.27,2.66-4.27,4.49c-0.54-0.68-1.07-1.39-1.74-2.01c-0.63-0.58-1.34-1.13-1.98-1.77 c-0.61-0.6-1.19-1.35-1.39-2.35c-0.23-1.17,0.11-2.21,0.74-2.84c0.4-0.4,0.98-0.75,1.72-0.81C21.33-0.1,22.05,0.55,22.61,1.28z" />
</vector>

1 个答案:

答案 0 :(得分:2)

要遵守“使此行从第3列开始”的规则,您必须缩进两个空格。

我建议您在项目的根目录使用.editorconfig文件(参见EditorConfig),并提供以下内容:

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space

[*.{java,xml}]
trim_trailing_whitespace = true

[*.java]
indent_size = 4

[*.xml]
indent_size = 2

然后重新格式化文件