Skip to content

DScanner: Add a minimal .dscanner.ini + start to fix easy DScanner issues#8548

Merged
dlang-bot merged 2 commits intodlang:masterfrom
wilzbach:dscanner
Aug 13, 2018
Merged

DScanner: Add a minimal .dscanner.ini + start to fix easy DScanner issues#8548
dlang-bot merged 2 commits intodlang:masterfrom
wilzbach:dscanner

Conversation

@wilzbach
Copy link
Contributor

@wilzbach wilzbach commented Aug 8, 2018

  • redundant attributes
  • redundant if/else
  • empty declarations (required as libdparse's parser is a bit more strict.)
  • misleading static if, else
  • equivalent assignment
  • const on opEquals or toHash
  • if constraint indentation

CC @bbasile

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

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#8548"

; - GOTO: Remove a module
;
; Some checks are currently disabled.
[analysis.config.ModuleFilters]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a very simplistic blacklist. For Phobos, we generated the entire blacklist for important checks.
See: dlang/phobos#5501

return returnEarly();
}
}
else if (!needExpansion)
Copy link

Choose a reason for hiding this comment

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

The changes between here and line 946 seem unrelated to the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dmd/statementsem.d(918:18)[warn]: Mismatched static if. Use 'else static if' here.

src/posix.mak Outdated
# runs static code analysis with Dscanner
dscanner: $(DSCANNER_DIR)/dsc
@echo "Running DScanner"
$(DSCANNER_DIR)/dsc --config .dscanner.ini --styleCheck $$(find dmd -name "*.d" | grep -v "func.d") -I.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exclusion of func.d was necessary as libdparse currently isn't able to parse.
See dlang-community/libdparse#258

Copy link

Choose a reason for hiding this comment

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

This can be removed already. Just update the submodule in D-Scanner and the hash in this PR.

Copy link

Choose a reason for hiding this comment

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

new hash : 3a859d39c4b59822b1bc0452b3ddcd598ef390a2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

@wilzbach wilzbach force-pushed the dscanner branch 2 times, most recently from 7293912 to bfb3a6d Compare August 13, 2018 16:12
- redundant attributes
- redundant if/else
- empty declarations
- misleading static if, else
@wilzbach
Copy link
Contributor Author

This is passing on Buildkite now and thus finally ready (:

image

Running DScanner
../generated/linux/release/64/dscanner-3a859d39c4b59822b1bc0452b3ddcd598ef390a2/dsc --config .dscanner.ini --styleCheck dmd -I.

@dlang-bot dlang-bot merged commit 2de58e0 into dlang:master Aug 13, 2018
@JinShil JinShil mentioned this pull request Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments