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

Deprecate Location.locationString #2084

Merged
merged 3 commits into from
Nov 14, 2019
Merged

Deprecate Location.locationString #2084

merged 3 commits into from
Nov 14, 2019

Conversation

BraisGabin
Copy link
Member

This PR is a continuation of #2014

This code is a bit strange: https://github.com/arturbosch/detekt/pull/2083/files#diff-3d9aab0c44e865c3fbae3f5f7a8edc8dR67 for that reason I research a bit about Location.locationString and it's not used in the production code. The only uses ar in the test code.

In this PR I refactor the tests to don't use that value and I add the @Deprecate annotation to that property.

Copy link
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

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

Thanks for refactoring this assert method!
This makes the test more maintainable and easier to read.
Cool!

To further improve the test we should consider having a test for each rule, which asserts the reported element at least once.
Of course this should be in a separate PR.
This is however a very good first step.

@BraisGabin
Copy link
Member Author

What do you think about a PR to talk about how to test a rule? The tests right now are SO different between them... There's no need to refactor all of them now but at least we should know how we want them.

@schalkms
Copy link
Member

@BraisGabin we have an existing issues regarding the rigorous case files (#1089).

What do you think about a PR to talk about how to test a rule?

It might be worth to create an issue for that. Docs would also be nice. Maybe that's a thing for the contributing guide in the Contributing.md file.

@arturbosch arturbosch added this to the 1.2.0 milestone Nov 14, 2019
@arturbosch
Copy link
Member

@schalkms I highly agree that we should a paragraph about the prefered way of testing detekt rules 👍

@arturbosch arturbosch merged commit 6800a8c into detekt:master Nov 14, 2019
smyachenkov pushed a commit to smyachenkov/detekt that referenced this pull request Dec 9, 2019
* Use hasSourceLocations instead of hasLocationString

* Deprecate locationString

* Generate documentation
smyachenkov pushed a commit to smyachenkov/detekt that referenced this pull request Dec 9, 2019
* Use hasSourceLocations instead of hasLocationString

* Deprecate locationString

* Generate documentation
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