-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from RealyUniqueName/require-no-spaces
Spacing checks: require no spaces
- Loading branch information
Showing
10 changed files
with
176 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,5 @@ target/ | |
check-style-report.json | ||
check-style-report.xml | ||
coverage.json | ||
|
||
display.hxml |
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
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
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,33 @@ | ||
package checkstyle.checks; | ||
|
||
import Type.ValueType; | ||
import checkstyle.errors.InvalidDirectiveError; | ||
|
||
enum Directive { | ||
SHOULD; | ||
SHOULD_NOT; | ||
ANY; | ||
} | ||
|
||
class DirectiveTools { | ||
static var MAPPING:Map<String, Directive> = [ | ||
"should" => SHOULD, | ||
"shouldNot" => SHOULD_NOT, | ||
"any" => ANY | ||
]; | ||
|
||
public static function fromDynamic(value:Dynamic):Directive { | ||
return switch (Type.typeof(value)) { | ||
case ValueType.TClass(String): getValidated(value); | ||
//support for legacy configs when such settings were boolean | ||
case ValueType.TBool: (value ? SHOULD : ANY); | ||
case _: ANY; | ||
} | ||
} | ||
|
||
static function getValidated(value:String):Directive { | ||
var directive = MAPPING.get(value); | ||
if (directive != null) return directive; | ||
throw new InvalidDirectiveError('Invalid directive: $value'); | ||
} | ||
} |
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,13 @@ | ||
package checkstyle.errors; | ||
|
||
class Error { | ||
public var message (default, null):String; | ||
|
||
public function new(message:String) { | ||
this.message = message; | ||
} | ||
|
||
public function toString():String { | ||
return message; | ||
} | ||
} |
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,3 @@ | ||
package checkstyle.errors; | ||
|
||
class InvalidDirectiveError extends Error {} |
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