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

Refactor scapegoat rules and repositories #383

Merged
merged 4 commits into from Feb 23, 2020

Conversation

@mwz
Copy link
Owner

mwz commented Feb 22, 2020

The refactoring continues...

Relates to #343.

mwz added 3 commits Feb 22, 2020
@mwz mwz mentioned this pull request Feb 22, 2020
2 of 6 tasks complete
@mwz mwz merged commit 58a0433 into master Feb 23, 2020
3 checks passed
3 checks passed
ci/circleci: test Your tests passed on CircleCI!
Details
security/snyk - build.sbt (mwz) No new issues
Details
security/snyk - project/build.sbt (mwz) No manifest changes detected
@mwz mwz deleted the refactor-scapegoat-rules-and-repositories branch Feb 23, 2020
Copy link
Contributor

BalmungSan left a comment

Cool 👍

Just some minor comments.


private[scapegoat] object Level {
private[metadata] sealed trait Level
object Level {
case object Error extends Level
case object Warning extends Level
case object Info extends Level

This comment has been minimized.

Copy link
@BalmungSan

BalmungSan Feb 23, 2020

Contributor

ditto case objects should be final.

This comment has been minimized.

Copy link
@mwz

mwz Feb 23, 2020

Author Owner

thanks for the reminder, I keep forgetting 😅

"main",
"scala",
"project/src/main/scala",
"com/mwz/sonar/scala/metadata/scalastyle",

This comment has been minimized.

Copy link
@BalmungSan

BalmungSan Feb 23, 2020

Contributor

Isn't the point of Path.get to do not use / because that won't work on Windows?

This comment has been minimized.

Copy link
@mwz

mwz Feb 23, 2020

Author Owner

ah yes, very good point - I'll fix that

ScalastyleInspections.AllInspections should have size 72 // 31 templates + 41 default rules
ScalastyleInspections.AllInspectionsByClass.size shouldBe ScalastyleInspections.AllInspections.size
ScalastyleRules.rules.length shouldBe 72 // 31 templates + 41 default rules
ScalastyleRules.rules.map(r => r.key -> r).iterator.toMap.size shouldBe ScalastyleRules.rules.length

This comment has been minimized.

Copy link
@BalmungSan

BalmungSan Feb 23, 2020

Contributor

Any particular reason for not using have size or have length?

Also, for the second test, I believe it would be better to ensure that all the keys are unique.

ScalastyleRules.rules.distinctBy(_.key) shouldBe ScalastyleRules.rules

This comment has been minimized.

Copy link
@mwz

mwz Feb 23, 2020

Author Owner

Any particular reason for not using have size or have length?

Yes, so Chain doesn't have the size property (it has length) and I found the autocompletion to work better in metals when you first access the property and then use matchers for comparing the value. It couldn't easily infer the have length syntax, so I settled on .length shouldBe.

Also, for the second test, I believe it would be better to ensure that all the keys are unique.

I think this is testing the same thing, but yeah your example is more concise, so I'll use that instead, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.