Version: | 0.2.0 |
Release Date: | 21st December, 2020 |
Licence: | GPLv3 |
Source: | github.com/sodaware/maxcop |
Available Rules
All rules are enabled by default unless otherwise stated.
Lint
lint/empty_case
Raised if there is an empty Case
statement in code.
' Bad
Select value
Case True
End Select
' Good
Select value
Case True
doThis()
End Select
lint/empty_else
Raised if there is an empty Else
statement in code.
' Bad
If true Then
doThis()
Else
EndIf
' Good
If true Then
doThis()
EndIf
lint/empty_select
Raised if there is an empty Select
statement in code.
' Bad
Select something
End Select
' Good
Select something
Default
doThis()
End Select
lint/handle_exceptions
Raised if there is a Catch block without a variable.
' Bad
Try
doThis()
Catch
End Try
' Good
Try
doThis()
Catch e:Exception
Print "Something broke"
End Try
Metrics
metrics/function_parameter_count
options:
max_parameter_count
: Maximum number of parameters allowed.
Check that a function has under a certain number of parameters. Defaults to 5.
metrics/line_length
options:
max_line_length
: Maximum line length
Checks a line is under a certain number of characters long. Defaults to 120.
metrics/method_length
options:
max_line_count
: Maximum number of lines allowed.
Checks a method has under a certain number of code lines inside. Defaults to 35.
metrics/method_parameter_count
options:
max_parameter_count
: Maximum number of parameters allowed.
Check that a method has under a certain number of parameters. Defaults to 5.
metrics/trailing_whitespace
Checks there is no empty whitespace at the end of lines.
metrics/type_field_count
options:
max_field_count
: Maximum number of fields allowed in a type.
Checks a type has under a certain number of fields. Defaults to 15.
metrics/type_function_count
options:
max_function_count
: Maximum number of functions allowed in a type.
Checks a type has under a certain number of functions. Defaults to 15.
metrics/type_method_count
options:
max_method_count
: Maximum number of methods allowed in a type.
Checks a type has under a certain number of methods. Defaults to 15.
Style
style/field_name_prefix
Checks that pseudo-private field names do not start with m_
. Should use _
prefix instead.
style/privatefieldname_case
Check the first letter of a pseudo-private field name starts with a lower-case letter.
' Bad
Field _SomeField:String
' Good
Field _someField:String
style/space_after_comma
Check there is a space after comma characters.
' Bad
doThis(1,2,3)
' Good
doThis(1, 2, 3)
style/space_around_operator
Check numeric operators (=
, +
, -
, /
and *
) are surrounded by spaces.
' Bad
x=1+2
' Good
x = 1 + 2
style/string_exceptions
Check that thrown exceptions are a Type, not a plain string.
' Bad
throw "Something went wrong"
' Good
throw new SomethingWentWrongException
style/type_method_name_case
Check type methods begin with a lower case letter.
style/type_name_prefix
Check type names begin with T
.
' Bad
Type MyType
' Good
Type TMyType
style/type_name_suffix
options:
suffix
: The suffix to check for.
Check type names end with the configured suffix. This rule is disabled by
default and requires a suffix
value to be set.
' With `suffix` set to "Object"
' Bad
Type Something
' Good
Type SomethingObject
style/uppercase_constants
Check constants are entirely uppercase.
' Bad
Const Something_Here:String = "a"
' Good
Const SOMETHING_HERE:String = "a"