@@ -34,17 +34,16 @@ class ToolSelectorSpec extends Specification with NoLanguageFeatures {
3434 needsCompilation = false ,
3535 hasConfigFile = true ,
3636 configFilenames = Set .empty,
37- isClientSide = false ,
37+ standalone = false ,
3838 hasUIConfiguration = true )
3939
40- override def listTools (): Either [AnalyserError , Seq [ToolSpec ]] =
41- Right (
42- Seq (
43- getToolSpec(" 34225275-f79e-4b85-8126-c7512c987c0d" , " PyLint" , Set (Python )),
44- getToolSpec(" c6273c22-5248-11e5-885d-feff819cdc9f" , " Brakeman" , Set (Languages .Ruby )),
45- getToolSpec(" 724f98da-f616-4e37-9606-f16919137a1e" , " Rubocop" , Set (Languages .Ruby )),
46- getToolSpec(" 38794ba2-94d8-4178-ab99-1f5c1d12760c" , " BundlerAudit" , Set (Languages .Ruby )),
47- getToolSpec(" cf05f3aa-fd23-4586-8cce-5368917ec3e5" , " ESLint" , Set (Languages .Javascript ))))
40+ override val allTools = Right (
41+ Seq (
42+ getToolSpec(" 34225275-f79e-4b85-8126-c7512c987c0d" , " PyLint" , Set (Python )),
43+ getToolSpec(" c6273c22-5248-11e5-885d-feff819cdc9f" , " Brakeman" , Set (Languages .Ruby )),
44+ getToolSpec(" 724f98da-f616-4e37-9606-f16919137a1e" , " Rubocop" , Set (Languages .Ruby )),
45+ getToolSpec(" 38794ba2-94d8-4178-ab99-1f5c1d12760c" , " BundlerAudit" , Set (Languages .Ruby )),
46+ getToolSpec(" cf05f3aa-fd23-4586-8cce-5368917ec3e5" , " ESLint" , Set (Languages .Javascript ))))
4847
4948 override def listPatterns (tool : ToolSpec ): Either [AnalyserError , Seq [PatternSpec ]] = Right (Seq .empty)
5049
@@ -74,40 +73,13 @@ class ToolSelectorSpec extends Specification with NoLanguageFeatures {
7473 }
7574
7675 " AnalyseExecutor.tools" should {
77- " use input over remote configuration" in {
78-
79- val expectedToolName = " PyLint"
80- val toolConfigs =
81- Set (CLIConfiguration .IssuesTool (" InvalidToolName" , enabled = true , notEdited = false , Set .empty))
82- val toolConfiguration =
83- CLIConfiguration .Tool (Option .empty, allowNetwork = false , Right (toolConfigs), Option .empty, Map .empty)
84- val userInput = Some (expectedToolName)
85-
86- val toolEither =
87- toolSelector.tools(userInput, toolConfiguration, Set (Python ))
88- toolEither must beRight
89- toolEither must beLike {
90- case Right (toolSet) =>
91- toolSet.size mustEqual 1
92- toolSet.head.name mustEqual expectedToolName
93- }
94- }
95-
9676 " fail on incorrect input (even if remote configuration is valid)" in {
9777
9878 val expectedToolName = " SomeInvalidTool"
9979
100- val userInput = Some (expectedToolName)
101- val toolConfigs =
102- Set (
103- CLIConfiguration
104- .IssuesTool (" 34225275-f79e-4b85-8126-c7512c987c0d" , enabled = true , notEdited = false , Set .empty))
105- val toolConfiguration =
106- CLIConfiguration .Tool (Option .empty, allowNetwork = false , Right (toolConfigs), Option .empty, Map .empty)
10780 val languages = LanguagesHelper .fromFileTarget(emptyFilesTarget, Map .empty)
10881
109- val toolEither =
110- toolSelector.tools(userInput, toolConfiguration, languages)
82+ val toolEither = toolSelector.tool(expectedToolName, languages)
11183 toolEither must beLeft(CLIError .NonExistingToolInput (expectedToolName))
11284 }
11385
@@ -116,7 +88,6 @@ class ToolSelectorSpec extends Specification with NoLanguageFeatures {
11688 val expectedToolUuid1 = " 34225275-f79e-4b85-8126-c7512c987c0d"
11789 val expectedToolUuid2 = " cf05f3aa-fd23-4586-8cce-5368917ec3e5"
11890
119- val userInput = None
12091 val toolConfigs =
12192 Set (
12293 CLIConfiguration .IssuesTool (expectedToolUuid1, enabled = true , notEdited = false , Set .empty),
@@ -126,8 +97,7 @@ class ToolSelectorSpec extends Specification with NoLanguageFeatures {
12697 val toolConfiguration =
12798 CLIConfiguration .Tool (Option .empty, allowNetwork = false , Right (toolConfigs), Option .empty, Map .empty)
12899
129- val toolEither =
130- toolSelector.tools(userInput, toolConfiguration, Set (Javascript , Python ))
100+ val toolEither = toolSelector.tools(toolConfiguration, Set (Javascript , Python ))
131101 toolEither must beRight
132102 toolEither must beLike {
133103 case Right (toolSet) =>
@@ -137,14 +107,13 @@ class ToolSelectorSpec extends Specification with NoLanguageFeatures {
137107 }
138108
139109 " fallback to finding tools if remote configuration is not present" in {
140- val userInput = None
141110 val toolConfigs = Left (" some error" )
142111 val filesTarget = FilesTarget (File (" " ), Set (File (" SomeClazz.rb" ).path), Set .empty)
143112 val toolConfiguration =
144113 CLIConfiguration .Tool (Option .empty, allowNetwork = false , toolConfigs, Option .empty, Map .empty)
145114 val languages = LanguagesHelper .fromFileTarget(filesTarget, Map .empty)
146115
147- val toolEither = toolSelector.tools(userInput, toolConfiguration, languages)
116+ val toolEither = toolSelector.tools(toolConfiguration, languages)
148117 toolEither must beRight
149118 toolEither must beLike {
150119 case Right (toolSet) =>
@@ -153,15 +122,14 @@ class ToolSelectorSpec extends Specification with NoLanguageFeatures {
153122 }
154123
155124 " fallback to finding tools (with custom extensions) if remote configuration is not present" in {
156- val userInput = None
157125 val toolConfigs = Left (" some error" )
158126 val filesTarget = FilesTarget (File (" " ), Set (File (" SomeClazz.rawr" ).path), Set .empty)
159127 val languageExtensions : Map [Language , Set [String ]] = Map (Languages .Ruby -> Set (" rawr" ))
160128 val toolConfiguration =
161129 CLIConfiguration .Tool (Option .empty, allowNetwork = true , toolConfigs, Option .empty, languageExtensions)
162130 val languages = LanguagesHelper .fromFileTarget(filesTarget, languageExtensions)
163131
164- val toolEither = toolSelector.tools(userInput, toolConfiguration, languages)
132+ val toolEither = toolSelector.tools(toolConfiguration, languages)
165133 toolEither must beRight
166134 toolEither must beLike {
167135 case Right (toolSet) =>
0 commit comments