DScanner: Enable a check blacklist for a gradual transition #5501
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continuing the discussion at #5495 (comment)
The idea is
properly_documented_public_functions
) or providing public examples (has_public_example
) as anyone can do this one module at a timeSo instead of the all-or-nothing state for a Dscanner check before, a gradual, distributed transition can happen. While DScanner has a lot of great and useful checks, of course, a bit of care needs to be taken, so that they don't stand in the way of collaborators.
Hence, for convenience I copy/pasted my summary of currently "actionable" checks:
Actionable
asm_style_check
: onlystd.math
could_be_immutable_check
: @JackStouffer and @bbasile are big fans of thisexception_check
: Pokemon exception catching style (silent sinkhole for bugs), only a few occurrencesfunction_attribute_check
: duplicate attributes@safe @safe void foo() {}
has_public_example
: high-level vision, "Make sure every function in Phobos has an example" (this is still in the DScanner queue)label_var_same_name_check
: very confusing to read, only a few occurrenceslong_line_check
: fixed in Fix line_length checker for multiLine literals dlang-community/D-Scanner#465mismatched_args_check
: preventsmyFunction(counter, obj)
forvoid myFunction(A)(A obj, int counter)
object_const_check
: checks whetheropEquals
,opCmp
andtoHash
areconst
opequals_tohash_check
checks for aggregates which haveopEquals
defined, but nottoHash
properly_documented_public_functions
: high-level vision ("Make sure every function in Phobos has Params: and Returns: sections"), call to action)redundant_attributes_check
: see Remove redundant access specifier from Phobos #5477undocumented_declaration_check
: prevents accidentally leaked symbols, unfortunately a lot has happend in the past. I tried to fix std.algorithm once: std.algorithms: document public methods #4312unused_label_check
: this check doesn't support mixins yet (unused_label: Detect unknown labels dlang-community/D-Scanner#467)unused_variable_check
: mostly artifacts from debug sessionsTo be discussed
auto_ref_assignment_check
: only two occurrences, false positives?imports_sortedness
: I still need to modify the Dscanner check to ignore selective sortedness ...length_subtraction_check
: these may be unsigned and could lead to integer underflowlogical_precedence_check
:if (a && b || c) // bad
,if (a && (b || c)) // good
number_style_check
: big numbers should use an underscorestyle_check
: many, many symbols aren't named according to the DStyleuseless_initializer
: seems to be a quite common pattern in Phobosvcall_in_ctor
: only four occurrencesBoring details
phobos
branch at DScanner isn't vanilla anymore, but I am trying to get the bug fixes and features to upstream/master"+disabled"
instead of setting the check to disabled, to have all (partially) disabled checks at one place)