Skip to content

DScanner: Enable warnings for unused parameters ...#10700

Closed
MoonlightSentinel wants to merge 6 commits intodlang:masterfrom
MoonlightSentinel:style-unused
Closed

DScanner: Enable warnings for unused parameters ...#10700
MoonlightSentinel wants to merge 6 commits intodlang:masterfrom
MoonlightSentinel:style-unused

Conversation

@MoonlightSentinel
Copy link
Copy Markdown
Contributor

@MoonlightSentinel MoonlightSentinel commented Dec 27, 2019

... and fix access.d, astbase, todt.d, traits.d and typesem.d for starters. This obviously requires quite a blacklist right now but still covers about 2/3 of all source files.

Bonus: This revealed that the documentation of checkAccess did not match its implementation.

CC @wilzbach

@dlang-bot
Copy link
Copy Markdown
Contributor

Thanks for your pull request and interest in making D better, @MoonlightSentinel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#10700"

@MoonlightSentinel MoonlightSentinel force-pushed the style-unused branch 2 times, most recently from fbfd8c4 to e88df8d Compare December 27, 2019 21:21
Copy link
Copy Markdown
Member

@rainers rainers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the changes are good (e.g. adding module declarations), but I'm not so sure about enabling warnings about unused parameters. Removing them also reduces information provided by intellisense or documentation.

@MoonlightSentinel
Copy link
Copy Markdown
Contributor Author

Some of the changes are good (e.g. adding module declarations), but I'm not so sure about enabling warnings about unused parameters. Removing them also reduces information provided by intellisense or documentation.

I think checking for unused parameters should be done because it can reveal violations of a functions contract/documentation (see e.g. checkAccess). But DScanner should have something like Javas SuppressWarnings("unused") to mark parameters that are reserved for overriding methods.

Anyway, i would be fine with splitting this into different PRs for local/parameters. But limiting this check to local variables is currently not possible (because it was introduced after dlang-community/D-Scanner#786 appeared.

@MoonlightSentinel
Copy link
Copy Markdown
Contributor Author

PR to enable checks for unused variables only #10714

@MoonlightSentinel MoonlightSentinel changed the title DScanner: Enable warnings for unused parameters/variables ... DScanner: Enable warnings for unused parameters ... Feb 12, 2020
@MoonlightSentinel
Copy link
Copy Markdown
Contributor Author

Closing until D-Scanner provides some means to allow unused parameters for documentation purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants