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

[DONOTMERGE] Upgrade Disable rule to scalafix v1 #23

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

wsargent
Copy link

@wsargent wsargent commented Jan 13, 2023

DO NOT MERGE, STILL BEING WORKED ON

This is a PR to upgrade the Disable scalafix rule from scalafix v0 to scalafix v1.

.map(Disable(index, _))
override def withConfiguration(config: Configuration): Configured[Rule] = {
// should this use DisableConfig.default?
config.conf.getOrElse("disable", "Disable")(this.config).map { newConfig => Disable(newConfig) }
Copy link
Author

Choose a reason for hiding this comment

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

Not sure about this bit

// errorCategory
// .copy(id = id)
// .at(message, pos)
DisableDiagnostic(symbol, details = details, position = pos)
Copy link
Author

Choose a reason for hiding this comment

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

Needs to be cleaned up

isBlocked.findMatch(s).map { disabled =>
SymbolOps.normalize(s) match {
case g: Symbol if g.info.get.signature.toString() != "<init>" =>
Left(Patch.lint(DisableDiagnostic(s, "", t.pos)).atomic) // XXX this is incorrect
Copy link
Author

Choose a reason for hiding this comment

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

Fix this

}

private def checkSynthetics(ctx: RuleCtx): Seq[Diagnostic] = {
// XXX what goes here?
private def checkSynthetics(implicit doc: SemanticDocument): Seq[Patch] = {
Copy link
Author

Choose a reason for hiding this comment

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

checkSynthetics I don't know what the v1 equivalent is

@@ -33,7 +32,7 @@ case class DisabledSymbol(
def matches(symbol: Symbol): Boolean = {
this.symbol match {
case Some(s) =>
SymbolOps.isSameNormalized(symbol, s)
symbol.normalized.equals(s.normalized)
Copy link
Author

Choose a reason for hiding this comment

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

I think this is the same

@@ -53,10 +52,14 @@ object DisabledSymbol {
} else {
msg
}

implicit lazy val symbolV1Reader: ConfDecoder[Symbol] =
Copy link
Author

Choose a reason for hiding this comment

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

best guess at what Symbol.Global equivalent is

@wsargent wsargent changed the title Upgrade to scalafix v1 [DONOTMERGE] Upgrade Disable rule to scalafix v1 Jan 13, 2023
@gafiatulin
Copy link

@wsargent fyi, I took the changes from this branch as base and continued the work in #25. I think all open question has been covered there, at least all the tests are passing.

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.

2 participants