diff --git a/.travis.yml b/.travis.yml index ab587d5..d5c5d58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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) diff --git a/dscanner.ini b/dscanner.ini new file mode 100644 index 0000000..947e482 --- /dev/null +++ b/dscanner.ini @@ -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" diff --git a/source/tanya/async/event/iocp.d b/source/tanya/async/event/iocp.d index 97f5459..eaf647b 100644 --- a/source/tanya/async/event/iocp.d +++ b/source/tanya/async/event/iocp.d @@ -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); diff --git a/source/tanya/container/list.d b/source/tanya/container/list.d index 4800a76..c917b67 100644 --- a/source/tanya/container/list.d +++ b/source/tanya/container/list.d @@ -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 { diff --git a/source/tanya/format/conv.d b/source/tanya/format/conv.d index d069e38..fc33355 100644 --- a/source/tanya/format/conv.d +++ b/source/tanya/format/conv.d @@ -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; }