Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix D-Scanner linting issues #9070

Merged
merged 5 commits into from
Oct 27, 2024
Merged

Conversation

Vladiwostok
Copy link
Contributor

This PR contains only code format changes.

There are a couple of linting issues that are now detected with the dmd-as-a-lib D-Scanner.

  • UndocumentedDeclarationCheck => detects undocumented public declarations; the fix consists of changing the normal comment chars to DDoc comment chars and documenting the unit test;
  • IfConstraintsIndentCheck => detects static ifs that are not on separate lines nor to they match the template's column indentation; the fix consists of moving the if conditions on separate lines and aligning them with the template declaration.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @Vladiwostok! 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 run digger -- build "master + phobos#9070"

std/random.d Outdated Show resolved Hide resolved
std/algorithm/searching.d Outdated Show resolved Hide resolved
std/array.d Outdated Show resolved Hide resolved
Copy link
Collaborator

@RazvanN7 RazvanN7 left a comment

Choose a reason for hiding this comment

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

As I understand the check should limit itself to highlighting instances of unaligned if constraints. We should leave it to the user to then split the constraints as he/she sees fit.

@Vladiwostok
Copy link
Contributor Author

As I understand the check should limit itself to highlighting instances of unaligned if constraints. We should leave it to the user to then split the constraints as he/she sees fit.

I see. I just saw those conditions split on multiple lines and thought it would be easier to read if they can fit in a single line. Will revert those kind of changes

@CyberShadow
Copy link
Member

UndocumentedDeclarationCheck => detects undocumented public declarations; the fix consists of changing the normal comment chars to DDoc comment chars and documenting the unit test;

Careful, there are many cases where a declaration is not intended for public use but must be public for technical reasons. I think a way to override this check would be more useful.

@Vladiwostok
Copy link
Contributor Author

UndocumentedDeclarationCheck => detects undocumented public declarations; the fix consists of changing the normal comment chars to DDoc comment chars and documenting the unit test;

Careful, there are many cases where a declaration is not intended for public use but must be public for technical reasons. I think a way to override this check would be more useful.

I agree. We can create an issue in D-Scanner to implement @nolint exception for UndocumentedDeclarationCheck.

@thewilsonator
Copy link
Contributor

generated/linux/debug/64/publictests/std_random.d(2287): Error: template instance `isForwardRange!(typeof(gen))` template `isForwardRange` is not defined
generated/linux/debug/64/publictests/std_random.d(2287):        while evaluating: `static assert(isForwardRange!(typeof(gen)))`
generated/linux/debug/64/publictests/std_random.d(2296): Error: undefined identifier `meta` in package `std`, perhaps add `static import std.meta;`
generated/linux/debug/64/publictests/std_random.d(2350): Error: undefined identifier `meta` in package `std`, perhaps add `static import std.meta;`

@Vladiwostok
Copy link
Contributor Author

UndocumentedDeclarationCheck => detects undocumented public declarations; the fix consists of changing the normal comment chars to DDoc comment chars and documenting the unit test;

Careful, there are many cases where a declaration is not intended for public use but must be public for technical reasons. I think a way to override this check would be more useful.

I agree. We can create an issue in D-Scanner to implement @nolint exception for UndocumentedDeclarationCheck.

Created issue: Dlang-UPB/D-scanner#165

@Vladiwostok Vladiwostok force-pushed the fix-linting-issues branch 3 times, most recently from 1e8ebb5 to f354eba Compare October 26, 2024 11:57
std/path.d Show resolved Hide resolved
@LightBender LightBender merged commit 231ae8b into dlang:master Oct 27, 2024
8 of 10 checks passed
@Vladiwostok Vladiwostok deleted the fix-linting-issues branch October 27, 2024 13:51
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.

7 participants