Add style checking
A lot of tests are disabled. They should be enabled successively.
This commit is contained in:
parent
657f4a60d5
commit
e6b91f70cb
@ -29,6 +29,9 @@ before_script:
|
||||
|
||||
script:
|
||||
- dub test -b ${UNITTEST:-unittest} --arch=$ARCH --compiler=$DC
|
||||
- if [ "$UNITTEST" = "unittest-cov" -a "$ARCH" = "x86_64" -a "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||
dub fetch dscanner && dub run dscanner -- -Isource --styleCheck;
|
||||
fi
|
||||
|
||||
after_success:
|
||||
- test "$UNITTEST" = "unittest-cov" && bash <(curl -s https://codecov.io/bash)
|
||||
|
81
dscanner.ini
Normal file
81
dscanner.ini
Normal file
@ -0,0 +1,81 @@
|
||||
; Configure which static analysis checks are skip-unittest
|
||||
[analysis.config.StaticAnalysisConfig]
|
||||
; Check variable, class, struct, interface, union, and function names against t
|
||||
; he Phobos style guide
|
||||
style_check="disabled"
|
||||
; Check for array literals that cause unnecessary allocation
|
||||
enum_array_literal_check="skip-unittest"
|
||||
; Check for poor exception handling practices
|
||||
exception_check="skip-unittest"
|
||||
; Check for use of the deprecated 'delete' keyword
|
||||
delete_check="skip-unittest"
|
||||
; Check for use of the deprecated floating point operators
|
||||
float_operator_check="skip-unittest"
|
||||
; Check number literals for readability
|
||||
number_style_check="disabled"
|
||||
; Checks that opEquals, opCmp, toHash, and toString are either const, immutable
|
||||
; , or inout.
|
||||
object_const_check="disabled"
|
||||
; Checks for .. expressions where the left side is larger than the right.
|
||||
backwards_range_check="skip-unittest"
|
||||
; Checks for if statements whose 'then' block is the same as the 'else' block
|
||||
if_else_same_check="skip-unittest"
|
||||
; Checks for some problems with constructors
|
||||
constructor_check="skip-unittest"
|
||||
; Checks for unused variables and function parameters
|
||||
unused_variable_check="disabled"
|
||||
; Checks for unused labels
|
||||
unused_label_check="skip-unittest"
|
||||
; Checks for duplicate attributes
|
||||
duplicate_attribute="skip-unittest"
|
||||
; Checks that opEquals and toHash are both defined or neither are defined
|
||||
opequals_tohash_check="disabled"
|
||||
; Checks for subtraction from .length properties
|
||||
length_subtraction_check="disabled"
|
||||
; Checks for methods or properties whose names conflict with built-in propertie
|
||||
; s
|
||||
builtin_property_names_check="skip-unittest"
|
||||
; Checks for confusing code in inline asm statements
|
||||
asm_style_check="skip-unittest"
|
||||
; Checks for confusing logical operator precedence
|
||||
logical_precedence_check="skip-unittest"
|
||||
; Checks for undocumented public declarations
|
||||
undocumented_declaration_check="disabled"
|
||||
; Checks for poor placement of function attributes
|
||||
function_attribute_check="skip-unittest"
|
||||
; Checks for use of the comma operator
|
||||
comma_expression_check="skip-unittest"
|
||||
; Checks for local imports that are too broad
|
||||
local_import_check="disabled"
|
||||
; Checks for variables that could be declared immutable
|
||||
could_be_immutable_check="disabled"
|
||||
; Checks for redundant expressions in if statements
|
||||
redundant_if_check="skip-unittest"
|
||||
; Checks for redundant parenthesis
|
||||
redundant_parens_check="skip-unittest"
|
||||
; Checks for mismatched argument and parameter names
|
||||
mismatched_args_check="skip-unittest"
|
||||
; Checks for labels with the same name as variables
|
||||
label_var_same_name_check="disabled"
|
||||
; Checks for lines longer than 120 characters
|
||||
long_line_check="skip-unittest"
|
||||
; Checks for assignment to auto-ref function parameters
|
||||
auto_ref_assignment_check="disabled"
|
||||
; Checks for incorrect infinite range definitions
|
||||
incorrect_infinite_range_check="skip-unittest"
|
||||
; Checks for asserts that are always true
|
||||
useless_assert_check="skip-unittest"
|
||||
; Check for uses of the old-style alias syntax
|
||||
alias_syntax_check="disabled"
|
||||
; Checks for else if that should be else static if
|
||||
static_if_else_check="skip-unittest"
|
||||
; Check for unclear lambda syntax
|
||||
lambda_return_check="skip-unittest"
|
||||
; Check for auto function without return statement
|
||||
auto_function_check="skip-unittest"
|
||||
; Check for sortedness of imports
|
||||
imports_sortedness="disabled"
|
||||
; Check for explicitly annotated unittests
|
||||
explicitly_annotated_unittests="disabled"
|
||||
; Check for useless usage of the final attribute
|
||||
final_attribute_check="skip-unittest"
|
@ -231,8 +231,8 @@ final class IOCPLoop : Loop
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!(oldEvents & Event.read) && (events & Event.read)
|
||||
|| !(oldEvents & Event.write) && (events & Event.write))
|
||||
if ((!(oldEvents & Event.read) && (events & Event.read))
|
||||
|| (!(oldEvents & Event.write) && (events & Event.write)))
|
||||
{
|
||||
auto transport = cast(StreamTransport) watcher;
|
||||
assert(transport !is null);
|
||||
|
@ -1312,8 +1312,8 @@ struct DList(T)
|
||||
private size_t makeList(R)(ref R el, out Entry* head, out Entry* tail) @trusted
|
||||
out (retLength)
|
||||
{
|
||||
assert(retLength == 0 && head is null && tail is null
|
||||
|| retLength > 0 && head !is null && tail !is null);
|
||||
assert((retLength == 0 && head is null && tail is null)
|
||||
|| (retLength > 0 && head !is null && tail !is null));
|
||||
}
|
||||
body
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ template to(To)
|
||||
|
||||
/// Ditto.
|
||||
To to(From)(From from)
|
||||
if (is(Unqual!To == Unqual!From) || isNumeric!From && isFloatingPoint!To)
|
||||
if (is(Unqual!To == Unqual!From) || (isNumeric!From && isFloatingPoint!To))
|
||||
{
|
||||
return from;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user