-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Scalastyle support to the entire project in a way to be informa…
…tive, but not fail the build.
- Loading branch information
wdschei
authored and
wdschei
committed
Jan 10, 2017
1 parent
fdbfdb7
commit 3036a12
Showing
2 changed files
with
281 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
<scalastyle> | ||
<name> | ||
Scalastyle standard configuration v0.8.0 | ||
with some additions for IntelliJ IDEA default source formatter, | ||
some disabled, and some slightly modified for this codebase. | ||
</name> | ||
<check level="warning" class="org.scalastyle.file.FileTabChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.file.FileLengthChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="maxFileLength"><![CDATA[800]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.file.HeaderMatchesChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="header"><![CDATA[/** | ||
* Copyright 2016 Rackspace US, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.SpacesAfterPlusChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="ignoreWhitespaceLines"><![CDATA[false]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.SpacesBeforePlusChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.file.FileLineLengthChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="maxLineLength"><![CDATA[160]]></parameter> | ||
<parameter name="tabSize"><![CDATA[4]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.ClassNamesChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="regex"><![CDATA[[A-Z][A-Za-z]*]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.ObjectNamesChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="regex"><![CDATA[[A-Z][A-Za-z]*]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.PackageNamesChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="regex"><![CDATA[^[a-z][A-Za-z]*$]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.PackageObjectNamesChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="regex"><![CDATA[^[a-z][A-Za-z]*$]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.EqualsHashCodeChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.IllegalImportsChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="illegalImports"><![CDATA[sun._,java.awt._]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.ParameterNumberChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="maxParameters"><![CDATA[8]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.MagicNumberChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="ignore"><![CDATA[-1,0,1,2,3]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.ReturnChecker" enabled="true"/> | ||
<!-- Disabled to allow easier interaction with Java API's. --> | ||
<check level="warning" class="org.scalastyle.scalariform.NullChecker" enabled="false"/> | ||
<check level="warning" class="org.scalastyle.scalariform.NoCloneChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.NoFinalizeChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.CovariantEqualsChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.StructuralTypeChecker" enabled="true"/> | ||
<!-- Disabled to allow easier end user notifications. --> | ||
<check level="warning" class="org.scalastyle.file.RegexChecker" enabled="false"> | ||
<parameters> | ||
<parameter name="regex"><![CDATA[println]]></parameter> | ||
<parameter name="line"><![CDATA[false]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.NumberOfTypesChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="maxTypes"><![CDATA[30]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.CyclomaticComplexityChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="maximum"><![CDATA[10]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.UppercaseLChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.SimplifyBooleanExpressionChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.IfBraceChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="singleLineAllowed"><![CDATA[true]]></parameter> | ||
<parameter name="doubleLineAllowed"><![CDATA[false]]></parameter> | ||
</parameters> | ||
</check> | ||
<!-- Increased to account for internally defined methods. --> | ||
<check level="warning" class="org.scalastyle.scalariform.MethodLengthChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="maxLength"><![CDATA[100]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.MethodNamesChecker" enabled="false"> | ||
<parameters> | ||
<!--parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9]*(_=)?$]]></parameter--> | ||
<parameter name="regex"><![CDATA[^([a-z][A-Za-z0-9]*)|([A-Z][A-Z0-9_]*)(_=)?$]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="maxMethods"><![CDATA[30]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.file.NewLineAtEofChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.NotImplementedErrorUsage" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.BlockImportChecker" enabled="false"/> | ||
<check level="warning" class="org.scalastyle.scalariform.ProcedureDefinitionChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.ForBraceChecker" enabled="true"/> | ||
<check level="warning" class="org.scalastyle.scalariform.SpaceAfterCommentStartChecker" enabled="true"/> | ||
<!-- Updated to allow numbers in field names. --> | ||
<check level="warning" class="org.scalastyle.scalariform.FieldNamesChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="regex"><![CDATA[^([a-z][A-Za-z0-9]*)|([A-Z][A-Z0-9_]*)$]]></parameter> | ||
</parameters> | ||
</check> | ||
<check level="warning" class="org.scalastyle.scalariform.TodoCommentChecker" enabled="true"> | ||
<parameters> | ||
<parameter name="words"><![CDATA[TODO|FIXME]]></parameter> | ||
</parameters> | ||
</check> | ||
|
||
<!-- These are the additions based on the default IntelliJ Code Formatter. --> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">for\(|if\(|while\(</parameter> | ||
</parameters> | ||
<customMessage>No space before paren after for, if, or while</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">for\s\s+\(|if\s\s+\(|while\s\s+\(</parameter> | ||
</parameters> | ||
<customMessage>Too many spaces before paren after for, if, or while</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">if.*\(.*\)\{|while.*\(.*\)\{</parameter> | ||
</parameters> | ||
<customMessage>No space before if or while left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">if.*\(.*\)\s\s+\{|while.*\(.*\)\s\s+\{</parameter> | ||
</parameters> | ||
<customMessage>Too many spaces before if or while left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">else\{|else.*\)\{</parameter> | ||
</parameters> | ||
<customMessage>No space before else left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">else\s\s+\{|else.*\)\s\s+\{</parameter> | ||
</parameters> | ||
<customMessage>Too many spaces before else left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">for.*\(.*\)\{|do\{</parameter> | ||
</parameters> | ||
<customMessage>No space before for or do left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">for.*\(.*\)\s\s+\{|do\s\s+\{</parameter> | ||
</parameters> | ||
<customMessage>Too many spaces before for or do left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">class .*[^\s-]\{|def.*[^\s-]\{</parameter> | ||
</parameters> | ||
<customMessage>No space before class or method left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">class .*\s\s+\{|def.*\s\s+\{</parameter> | ||
</parameters> | ||
<customMessage>Too many spaces before class or method left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">try\{|catch\{|finally\{</parameter> | ||
</parameters> | ||
<customMessage>No space before try, catch, or finally left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">try\s\s+\{|catch\s\s+\{|finally\s\s+\{</parameter> | ||
</parameters> | ||
<customMessage>Too many spaces before try, catch, or finally left brace</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">^[^"]*:[^\s-]|^[^"]*;[^\s-]|^[^"]*,[^\s-]</parameter> | ||
</parameters> | ||
<customMessage>Require space after comma, semicolon, and colon not in string</customMessage> | ||
</check> | ||
<!-- this causes too many false positives --> | ||
<check enabled="false" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">\n\s*\{</parameter> | ||
</parameters> | ||
<customMessage>Brace on a newline</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">package.*\n[^\s-]</parameter> | ||
</parameters> | ||
<customMessage>Blank line after package please!</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">^import .*\n(?!import )[^\n]*[^\s-]</parameter> | ||
</parameters> | ||
<customMessage>missing blank line after import</customMessage> | ||
</check> | ||
<check enabled="true" class="org.scalastyle.file.RegexChecker" level="warning"> | ||
<parameters> | ||
<parameter name="regex">\n\n\n\n</parameter> | ||
</parameters> | ||
<customMessage>max 2 blank lines in the code</customMessage> | ||
</check> | ||
</scalastyle> |