DScanner: Enable a check blacklist for a gradual transition#5501
DScanner: Enable a check blacklist for a gradual transition#5501dlang-bot merged 1 commit intodlang:masterfrom
Conversation
|
One concern is that bulk code additions (e.g. adding a binding module as those in It would be a bit nicer if the rules file was inverted: instead of a list of modules per rule, have a list of rules per module; then, such additions could just blacklist the entire module, and allow style fixes or finer-grained blacklists be done in follow-up PRs. Otherwise this looks good to me. Would be nice to improve in how style failures are communicated to users to reduce submitter frustration (a comment from dlang-bot telling the user how to run the style check locally is a start; inline comments on failing lines would be better; inline comments with suggestions on how to fix them, or automatic pull requests to their branch, would be best). |
98e94a7 to
bbcbae5
Compare
Hehe, ideally new submissions should adhere the existing checks ;-)
They can always do sth. like
This is on @MartinNowak's and my TODO list, e.g.
Of course help is welcome. |
|
Fine by me; going to leave this one open for a while more in case others have any opinions/arguments to present. |
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.mathcould_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,opCmpandtoHashareconstopequals_tohash_checkchecks for aggregates which haveopEqualsdefined, but nottoHashproperly_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)) // goodnumber_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
phobosbranch 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)