scalastyle.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~ Licensed to the Apache Software Foundation (ASF) under one or more
  4. ~ contributor license agreements. See the NOTICE file distributed with
  5. ~ this work for additional information regarding copyright ownership.
  6. ~ The ASF licenses this file to You under the Apache License, Version 2.0
  7. ~ (the "License"); you may not use this file except in compliance with
  8. ~ the License. You may obtain a copy of the License at
  9. ~
  10. ~ http://www.apache.org/licenses/LICENSE-2.0
  11. ~
  12. ~ Unless required by applicable law or agreed to in writing, software
  13. ~ distributed under the License is distributed on an "AS IS" BASIS,
  14. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. ~ See the License for the specific language governing permissions and
  16. ~ limitations under the License.
  17. -->
  18. <scalastyle>
  19. <check level="error" class="org.scalastyle.file.HeaderMatchesChecker" enabled="true">
  20. <parameters>
  21. <parameter name="header"><![CDATA[{{COPYRIGHT_HEADER}}]]></parameter>
  22. </parameters>
  23. </check>
  24. <check level="error" class="org.scalastyle.file.FileTabChecker" enabled="true"></check>
  25. <check level="error" class="org.scalastyle.scalariform.SpacesAfterPlusChecker" enabled="true"></check>
  26. <check level="error" class="org.scalastyle.scalariform.SpacesBeforePlusChecker" enabled="true"></check>
  27. <check level="error" class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="true"></check>
  28. <check level="error" class="org.scalastyle.file.FileLineLengthChecker" enabled="true">
  29. <parameters>
  30. <parameter name="maxLineLength">100</parameter>
  31. <parameter name="tabSize">2</parameter>
  32. <parameter name="ignoreImports">true</parameter>
  33. </parameters>
  34. </check>
  35. <!--
  36. We should enable these but there are some current violations that might not be
  37. trivially fixed.
  38. <check level="error" class="org.scalastyle.scalariform.ClassNamesChecker" enabled="true">
  39. <parameters><parameter name="regex"><![CDATA[[A-Z][A-Za-z]*]]></parameter></parameters>
  40. </check>
  41. <check level="error" class="org.scalastyle.scalariform.ObjectNamesChecker" enabled="true">
  42. <parameters><parameter name="regex"><![CDATA[[A-Z][A-Za-z]*]]></parameter></parameters>
  43. </check>
  44. <check level="error" class="org.scalastyle.scalariform.PackageObjectNamesChecker" enabled="true">
  45. <parameters><parameter name="regex"><![CDATA[^[a-z][A-Za-z]*$]]></parameter></parameters>
  46. </check>
  47. -->
  48. <check level="error" class="org.scalastyle.scalariform.ParameterNumberChecker" enabled="true">
  49. <parameters>
  50. <parameter name="maxParameters"><![CDATA[10]]></parameter>
  51. </parameters>
  52. </check>
  53. <check level="error" class="org.scalastyle.scalariform.NoFinalizeChecker" enabled="true"></check>
  54. <check level="error" class="org.scalastyle.scalariform.CovariantEqualsChecker" enabled="true"></check>
  55. <check level="error" class="org.scalastyle.scalariform.StructuralTypeChecker" enabled="true"></check>
  56. <check level="error" class="org.scalastyle.scalariform.UppercaseLChecker" enabled="true"></check>
  57. <check level="error" class="org.scalastyle.scalariform.IfBraceChecker" enabled="true">
  58. <parameters>
  59. <parameter name="singleLineAllowed"><![CDATA[true]]></parameter>
  60. <parameter name="doubleLineAllowed"><![CDATA[true]]></parameter>
  61. </parameters>
  62. </check>
  63. <check level="error" class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" enabled="true"></check>
  64. <check level="error" class="org.scalastyle.file.NewLineAtEofChecker" enabled="true"></check>
  65. <check level="error" class="org.scalastyle.scalariform.NonASCIICharacterChecker" enabled="true"></check>
  66. <check level="error" class="org.scalastyle.scalariform.SpaceAfterCommentStartChecker" enabled="true"></check>
  67. <check level="error" class="org.scalastyle.scalariform.EnsureSingleSpaceBeforeTokenChecker" enabled="true">
  68. <parameters>
  69. <parameter name="tokens">ARROW, EQUALS, ELSE, TRY, CATCH, FINALLY, LARROW, RARROW</parameter>
  70. </parameters>
  71. </check>
  72. <check level="error" class="org.scalastyle.scalariform.EnsureSingleSpaceAfterTokenChecker" enabled="true">
  73. <parameters>
  74. <parameter name="tokens">ARROW, EQUALS, COMMA, COLON, IF, ELSE, DO, WHILE, FOR, MATCH, TRY, CATCH, FINALLY, LARROW, RARROW</parameter>
  75. </parameters>
  76. </check>
  77. <!-- ??? usually shouldn't be checked into the code base. -->
  78. <check level="error" class="org.scalastyle.scalariform.NotImplementedErrorUsage" enabled="true"></check>
  79. <check customId="println" level="error" class="org.scalastyle.scalariform.TokenChecker" enabled="true">
  80. <parameters>
  81. <parameter name="regex">^println$</parameter>
  82. </parameters>
  83. <customMessage><![CDATA[Are you sure you want to println? If yes, wrap the code block with
  84. // scalastyle:off println
  85. println(...)
  86. // scalastyle:on println]]></customMessage>
  87. </check>
  88. <check customId="javaconversions" level="error" class="org.scalastyle.scalariform.TokenChecker" enabled="true">
  89. <parameters>
  90. <parameter name="regex">JavaConversions</parameter>
  91. </parameters>
  92. <customMessage>Instead of importing implicits in scala.collection.JavaConversions._, import
  93. scala.collection.JavaConverters._ and use .asScala / .asJava methods</customMessage>
  94. </check>
  95. <check level="error" class="org.scalastyle.scalariform.ImportOrderChecker" enabled="true">
  96. <parameters>
  97. <parameter name="groups">java,scala,3rdParty,livy</parameter>
  98. <parameter name="group.java">javax?\..*</parameter>
  99. <parameter name="group.scala">scala\..*</parameter>
  100. <parameter name="group.3rdParty">(?!org\.apache.livy\.).*</parameter>
  101. <parameter name="group.livy">org\.apache\.livy\..*</parameter>
  102. </parameters>
  103. </check>
  104. <check level="error" class="org.scalastyle.scalariform.DisallowSpaceBeforeTokenChecker" enabled="true">
  105. <parameters>
  106. <parameter name="tokens">COMMA</parameter>
  107. </parameters>
  108. </check>
  109. <check level="error" class="org.scalastyle.scalariform.EqualsHashCodeChecker" enabled="true"></check>
  110. <check level="error" class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker" enabled="true"></check>
  111. <check level="error" class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker" enabled="true"></check>
  112. </scalastyle>