File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
scalafix-cli/src/main/scala/scalafix/internal/v1
scalafix-reflect/src/main/scala/scalafix/internal/reflect
scalafix-tests/unit/src/test/scala/scalafix/tests/cli Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ case class Args(
187
187
def configuredSymtab : Configured [SymbolTable ] = {
188
188
Try (
189
189
ClasspathOps .newSymbolTable(
190
- classpath = classpath ,
190
+ classpath = validatedClasspath ,
191
191
out = out
192
192
)
193
193
) match {
Original file line number Diff line number Diff line change @@ -55,6 +55,10 @@ object ClasspathOps {
55
55
path.resolve(META_INF ).resolve(SEMANTICDB ).toFile.isDirectory
56
56
}
57
57
58
+ private def isJar (path : AbsolutePath ): Boolean =
59
+ path.isFile &&
60
+ path.toFile.getName.endsWith(" .jar" )
61
+
58
62
def autoClasspath (roots : List [AbsolutePath ]): Classpath = {
59
63
val buffer = List .newBuilder[AbsolutePath ]
60
64
val visitor = new SimpleFileVisitor [Path ] {
@@ -71,6 +75,7 @@ object ClasspathOps {
71
75
}
72
76
}
73
77
roots.foreach(x => Files .walkFileTree(x.toNIO, visitor))
78
+ roots.filter(isJar).foreach(buffer += _)
74
79
Classpath (buffer.result())
75
80
}
76
81
Original file line number Diff line number Diff line change @@ -2,10 +2,12 @@ package scalafix.tests.cli
2
2
3
3
import java .nio .charset .StandardCharsets
4
4
import java .nio .file .Files
5
+
5
6
import scala .meta .internal .io .PathIO
6
7
import scala .meta .internal .io .FileIO
7
8
import scala .meta .io .Classpath
8
9
import scalafix .cli ._
10
+ import scalafix .tests .core .Classpaths
9
11
10
12
class CliSemanticSuite extends BaseCliSuite {
11
13
@@ -125,6 +127,24 @@ class CliSemanticSuite extends BaseCliSuite {
125
127
files = explicitResultTypesPath.toString()
126
128
)
127
129
130
+ checkSemantic(
131
+ name = " explicit result types OK (auto-classpath)" ,
132
+ args = Array (
133
+ " --auto-classpath" ,
134
+ " --auto-classpath-roots" ,
135
+ PathIO .workingDirectory.toString
136
+ ) ++ Classpaths .scalaLibrary.entries.to[Array ].flatMap { path =>
137
+ Array (
138
+ " --auto-classpath-roots" ,
139
+ path.toString
140
+ )
141
+ },
142
+ expectedExit = ExitStatus .Ok ,
143
+ rule = " ExplicitResultTypes" ,
144
+ path = explicitResultTypesPath,
145
+ files = explicitResultTypesPath.toString()
146
+ )
147
+
128
148
checkSemantic(
129
149
name = " incomplete classpath does not result in error exit code" ,
130
150
args = Array (
You can’t perform that action at this time.
0 commit comments