-
Notifications
You must be signed in to change notification settings - Fork 186
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
force usage of shaded TPrint #1546
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package scalafix.internal.rule | ||
|
||
import java.util.regex.Pattern | ||
|
||
import pprint.TPrint | ||
import scalafix.config.CustomMessage | ||
|
||
class TPrintImplicits { | ||
implicit val tprintPattern: TPrint[List[CustomMessage[Pattern]]] = | ||
TPrint.literal("List[Regex]") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package scalafix.internal.rule | ||
|
||
import java.util.regex.Pattern | ||
|
||
import metaconfig.pprint._ | ||
import scalafix.config.CustomMessage | ||
|
||
class TPrintImplicits { | ||
implicit val tprintPattern: TPrint[List[CustomMessage[Pattern]]] = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This implicit has actually no effect (neither before or after this PR) as the signature of the param it was targeting changed in https://github.com/scalacenter/scalafix/pull/907/files#diff-fa445c2f97a1bfb229caa4cd2fdc97cb9c243ddac155698a132bcbdb22970910R91. Following-up in #1547. |
||
new TPrint[List[CustomMessage[Pattern]]] { | ||
def render(implicit tpc: TPrintColors): fansi.Str = | ||
fansi.Str("List[Regex]") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,14 +25,6 @@ final class TestkitPath( | |
val testPath: RelativePath, | ||
val semanticdbPath: RelativePath | ||
) { | ||
override def toString: String = { | ||
val map = Map( | ||
"input" -> input, | ||
"testPath" -> testPath, | ||
"semanticdbPath" -> semanticdbPath | ||
) | ||
pprint.PPrinter.BlackWhite.tokenize(map).mkString | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only |
||
} | ||
def testName: String = testPath.toURI(isDirectory = false).toString | ||
def toInput: Input = | ||
Input.VirtualFile(testName, FileIO.slurp(input, StandardCharsets.UTF_8)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will follow up in coursier/coursier with a repro, since the
scalafix
CLIs installed by Coursier will most likely be unable to load old rules (just like the test was showing before this workaround was added) since they won't load pprint.Running community rules with the CLI is probably not common anyway since it requires setting up the tool classpath yourself, so I think it's OK to break this until it's fixed in
cs install/launch
.https://github.com/scalacenter/scalafix/runs/5184084825?check_suite_focus=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it works as expected when using sonatype:
So the there shouldn't be any problem with CLI installed by coursier. There is however something fishy with ivy2local: coursier/coursier#2370. So the code added there is probably needed only for tests to pass, but it does not hurt anyway.