Skip to content

Commit 36f99db

Browse files
Improve some texts in CLion plugin (#362)
* Update readme.me file * Update usage.md file * Other corrections * Little correction
1 parent 131bf02 commit 36f99db

File tree

11 files changed

+52
-66
lines changed

11 files changed

+52
-66
lines changed

clion-plugin/README.md

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,52 @@
11
# UTBotCpp-CLion-plugin
22
<!-- Plugin description -->
3-
Plugin for communication with UTBotCpp server in CLion.
3+
Plugin to communicate with [UTBotCpp](https://github.com/UnitTestBot/UTBotCpp) server in CLion.
44

55
### Installation
66

7-
1. Clone UTBotCpp and cd there and do:
7+
1. Clone UTBotCpp into selected folder, select it in the command line and run:
88
```
99
cd clion-plugin
1010
./gradlew assembleDist
1111
```
12-
2. Open CLion, go to settings -> plugins
12+
2. Open CLion and go to `settings -> plugins`
1313
3. Click `Install Plugin from Disk...`:
1414
![](images/install/install-from-disk.png)
15-
4. Navigate to plugin folder `clion-plugin`, then go to `build/distributions`
15+
4. Navigate to plugin folder `clion-plugin`, go to `build/distributions`
1616
and choose `zip` file:
1717
![](images/install/choose-zip.png)
1818
5. Restart CLion
1919

20-
2120
### Configuration
2221

2322
#### Using quickstart wizard
24-
When you open a plugin for the first time the quickstart wizard will appear.
23+
When the plugin is opened for the first time, a quickstart wizard appears.
2524

2625
![](images/plugin_usage/wizard.png)
2726

28-
You can open it manually at any time by clicking on connection status and choosing
29-
`Show Quickstart Wizard`.
27+
You can open it manually any time: click on `connection status` and choose
28+
`Show Quickstart Wizard` action.
3029

3130
![](images/plugin_usage/show_wizard.png)
3231

33-
Or you can do it by pressing `shift` twice and finding an action:
32+
or press `shift` twice and find this action:
3433

3534

3635
![](images/plugin_usage/find-wizard-action.png)
3736

3837
#### Using settings
3938

40-
You also can configure plugin manually in settings, where you will find
41-
all configuration options.
39+
You can also configure plugin using settings. All options can be set manually.
4240

43-
1. Open plugin settings in settings - Tools - UTBot Settings
44-
2. Click `detect paths`. It will try to get source paths, build dir paths from CLion
45-
CMake model.
46-
3. Specify absolute path to build directory, it should be different from build directory that CLion uses,
47-
because there can be conflicts between UTBotCpp and CLion. For example, if CLion uses `project_path/cmake-build-debug`,
48-
then you can specify `project_path/utbot_build`.
41+
1. Open plugin settings in `settings` - `Tools` - `UTBot Settings`
42+
2. Click `detect paths`. It tries to get source paths and build directories paths from CLion
43+
cmake model.
44+
3. Specify an absolute path to the build directory, it should be different from the build directory that CLion uses,
45+
because conflicts between UTBotCpp and CLion may occur. For example, if CLion uses `project_path/cmake-build-debug`,
46+
you can specify `project_path/utbot_build`.
4947
4. For target path specify `/utbot/auto/target/path`
50-
5. Specify path to test folder.
51-
6. Specify name of the server and port.
48+
5. Specify a path to test folder.
49+
6. Specify a name of the server and port.
5250
7. If you use docker to run UTBotCpp and your project is mounted to docker,
5351
you can specify path to project inside docker.
5452

clion-plugin/USAGE.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,27 @@
22
# How to use plugin
33

44
### Check connection status
5-
To use plugin you should be connected to server, you can check
6-
the connection status in status bar:
5+
You must be connected to server to use plugin. \
6+
Connection status can be checked in the status bar.
77

88
![](images/plugin_usage/connectionStatus.png)
99

1010
### Configure project and generate json files
11-
For test generation to work your project must be configured by server.
1211

12+
Your project must be configured by server to generate tests.
1313

14-
To send request for project configuration or generation of json files
15-
click on connection status in the status bar and choose suitable option:
16-
14+
To send request for project configuration or json files generation,
15+
click on `connection status` in the status bar and choose a suitable option:
1716

1817
![](images/plugin_usage/generateJson.png)
1918

2019
Plugin sends request for project configuration when you open
21-
the project. Sometimes configuration fails, and then after you changed
20+
the project. Sometimes configuration fails, then after changing
2221
your project you need to send the request for project configuration.
2322

2423
### Choose source folders
2524

26-
The server needs to know under what folders source files are.
25+
To generate tests for project, server needs to know the folders source files are located in.
2726
The source folders are marked with green icons in the project view:
2827

2928
![](images/plugin_usage/source-folders.png)
@@ -33,22 +32,23 @@ You can mark/unmark selected folders from context menu.
3332
![](images/plugin_usage/mark-unmark-folders.gif)
3433

3534
### How to request tests generation
36-
Open a c/cpp file, right click in the text editor and in context menu
37-
choose suitable option:
35+
36+
Open a c/cpp file, right click in the text editor and
37+
choose suitable option in the context menu:
3838

3939
![editor actions](images/plugin_usage/editorActions.png)
4040

41-
To generate tests for a folder right click on a folder in project view
41+
For example, to generate tests for the folder, right click on it in the project view
4242
and choose `Generate for folder`:
4343

4444
![project view actions](images/plugin_usage/projectViewActions.png)
4545

4646
### See logs from server and client
47-
You can see what messages are sent to the server and server logging messages.
48-
For that click on the `UTBot consoles` tab in the bottom right corner:
47+
48+
You can see messages that are sent to the server and server own logging messages. Just click on the `UTBot consoles` tab in the bottom right corner:
4949

5050
![UTBot consoles tab](images/plugin_usage/consolesTab.png)
5151

52-
add choose the needed tab:
52+
add choose the required tab:
5353

5454
![UTBot consoles view](images/plugin_usage/consolesToolWindow.png)

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/client/channels/GTestLogChannelImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class GTestLogChannelImpl(project: Project): LogChannelImpl(project) {
1414
override val name: String = "GTest Log"
1515
override val logLevel: String = "TestLogLevel"
1616

17-
override val console: UTBotConsole = project.service<OutputProvider>().gtestOutputChannel.outputConsole
17+
override val console: UTBotConsole = project.service<OutputProvider>().gTestOutputChannel.outputConsole
1818

1919
override suspend fun open(stub: TestsGenServiceGrpcKt.TestsGenServiceCoroutineStub): Flow<Testgen.LogEntry> =
2020
stub.openGTestChannel(getLogChannelGrpcRequest(logLevel))

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/coverage/UTBotCoverageFileProvider.kt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@ import com.intellij.coverage.CoverageFileProvider
88
* don't need this class but for compatibility with api this class must be implemented.
99
*/
1010
class UTBotCoverageFileProvider : CoverageFileProvider {
11-
override fun getCoverageDataFilePath(): String? {
12-
return null
13-
}
11+
override fun getCoverageDataFilePath(): String? = null
1412

15-
override fun ensureFileExists(): Boolean {
16-
return true
17-
}
13+
override fun ensureFileExists(): Boolean = true
1814

19-
override fun isValid(): Boolean {
20-
return true
21-
}
15+
override fun isValid(): Boolean = true
2216
}

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/coverage/UTBotCoverageRunner.kt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,14 @@ class UTBotCoverageRunner : CoverageRunner() {
7070
return if (isAnyCoverage) projectData else null
7171
}
7272

73-
override fun getPresentableName(): String {
74-
return "UTBot: Coverage runner"
75-
}
73+
override fun getPresentableName(): String = "UTBot: Coverage runner"
7674

77-
override fun getId(): String {
78-
return "UTBotCoverageRunner"
79-
}
75+
override fun getId(): String = "UTBotCoverageRunner"
8076

8177
// actually no coverage file exists, but this method must be implemented, see UTBotCoverageFileProvider
82-
override fun getDataFileExtension(): String {
83-
return "txt"
84-
}
78+
override fun getDataFileExtension(): String = "txt"
8579

86-
override fun acceptsCoverageEngine(engine: CoverageEngine): Boolean {
87-
return engine is UTBotCoverageEngine
88-
}
80+
override fun acceptsCoverageEngine(engine: CoverageEngine): Boolean = engine is UTBotCoverageEngine
8981

9082
companion object {
9183
fun provideQualifiedNameForFile(absolutePath: String) = absolutePath

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/listeners/UTBotTestResultsReceivedListener.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import testsgen.Testgen
66
fun interface UTBotTestResultsReceivedListener {
77
companion object {
88
val TOPIC = Topic.create(
9-
"UTBot settings changed",
9+
"UTBot test results received",
1010
UTBotTestResultsReceivedListener::class.java
1111
)
1212
}

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/settings/UTBotAllProjectSettings.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class UTBotAllProjectSettings(val project: Project) {
2626
// so we should guess the project path
2727
storedSettings.projectPath = project.guessProjectDir()?.path
2828
return storedSettings.projectPath
29-
?: error("Could not guess project path! Should be specified in settings by user")
29+
?: error("Could not guess project path! Should be specified in settings")
3030
}
3131
set(value) {
3232
storedSettings.projectPath = value
@@ -49,7 +49,7 @@ class UTBotAllProjectSettings(val project: Project) {
4949

5050
/**
5151
* If this property returns true, plugin must convert path sent and returned from server.
52-
* @see [String.convertToRemotePathIfNeeded], [String.convertFromRemotePathIfNeeded]
52+
* @see [String.convertToRemotePathIfNeeded] and [String.convertFromRemotePathIfNeeded]
5353
*
5454
* If we are on Windows, this is not a server, so it is always a remote scenario.
5555
*/
@@ -74,7 +74,7 @@ class UTBotAllProjectSettings(val project: Project) {
7474
try {
7575
storedSettings.testDirPath = Paths.get(projectPath, "tests").toString()
7676
} catch (e: IllegalStateException) {
77-
notifyWarning("Guessing settings failed: could not guess project path! Please specify project path in settings!")
77+
notifyWarning("Guessing settings failed: could not guess project path! Please specify it in settings!")
7878
}
7979

8080
val cmakeRunConfiguration = CMakeAppRunConfiguration.getSelectedConfigurationAndTarget(project)?.first

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/settings/UTBotConfigurable.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("UnstableApiUsage")
2+
13
package org.utbot.cpp.clion.plugin.settings
24

35
import com.intellij.openapi.diagnostic.Logger
@@ -22,7 +24,7 @@ import org.utbot.cpp.clion.plugin.utils.commandLineEditor
2224
import java.awt.Dimension
2325

2426
class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(
25-
"Project Settings for Generating Tests"
27+
"Project Settings to generate tests"
2628
) {
2729
private val logger = Logger.getInstance("ProjectConfigurable")
2830
private val panel by lazy { createMainPanel() }
@@ -49,7 +51,7 @@ class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(
4951
}
5052
}
5153

52-
fun createMainPanel(): DialogPanel {
54+
private fun createMainPanel(): DialogPanel {
5355
logger.trace("createPanel was called")
5456
return panel {
5557
group("Connection Settings") {
@@ -73,7 +75,7 @@ class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(
7375
myProject,
7476
FileChooserDescriptorFactory.createSingleFileDescriptor()
7577
).bindText(
76-
getter = { myProject.settings.projectPath ?: "" },
78+
getter = { myProject.settings.projectPath },
7779
setter = { value -> myProject.settings.projectPath = value })
7880
.columns(COLUMNS_LARGE)
7981
}.rowComment(UTBot.message("settings.project.projectPath.info"))
@@ -110,7 +112,7 @@ class UTBotConfigurable(private val myProject: Project) : BoundConfigurable(
110112
myProject.settings.predictPaths()
111113
myProject.settings.fireUTBotSettingsChanged()
112114
}
113-
}.rowComment("Queries CMake configurations in order to get source paths, build path. Also predicts tests folder")
115+
}.rowComment("Queries CMake configurations to get source paths and build path. Also predicts tests folder")
114116
}
115117

116118
group("CMake") {

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/ui/services/OutputProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import javax.swing.JPanel
2121
@Service
2222
class OutputProvider(val project: Project) : Disposable {
2323
val clientOutputChannel: OutputChannel by lazy { createOutputChannel(OutputType.CLIENT_LOG) }
24-
val gtestOutputChannel: OutputChannel by lazy { createOutputChannel(OutputType.GTEST_LOG) }
24+
val gTestOutputChannel: OutputChannel by lazy { createOutputChannel(OutputType.GTEST_LOG) }
2525
val serverOutputChannel: OutputChannel by lazy { createOutputChannel(OutputType.SERVER_LOG) }
2626

2727
data class OutputChannel(val uiComponent: Component, val outputConsole: UTBotConsole, val type: OutputType)

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/ui/targetsToolWindow/UTBotTarget.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ data class UTBotTarget(val path: String, val name: String, val description: Stri
1919
val autoTarget = UTBotTarget(
2020
path = "/utbot/auto/target/path",
2121
name = "UTBot: auto",
22-
description = "Finds any target that contains the code under testing"
22+
description = "Finds any target that contains the code under test"
2323
)
2424
}
2525
}

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/ui/userLog/ConsoleToolWindow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ConsoleToolWindow(val project: Project) : SimpleToolWindowPanel(true, true
2929
val provider = project.service<OutputProvider>()
3030
for (channel in listOf(
3131
provider.clientOutputChannel,
32-
provider.gtestOutputChannel,
32+
provider.gTestOutputChannel,
3333
provider.serverOutputChannel
3434
)) {
3535
mainUI.addTab(channel.type.title, channel.uiComponent)

0 commit comments

Comments
 (0)