Skip to content

Commit 7e46d3c

Browse files
committed
refactor: format with sonarqube
1 parent 40fdd63 commit 7e46d3c

File tree

6 files changed

+0
-33
lines changed

6 files changed

+0
-33
lines changed

src/main/kotlin/util/extension/FileExtension.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ import java.io.File
1212
const val ICON =
1313
"https://www.dropbox.com/scl/fi/4o3busy75hk1mga2i665g/aries.png?rlkey=fp7yrxl5lz5ldfcjndsiikus2&st=m9ydm8op&dl=1"
1414

15-
// URL of the openNotepad.scpt file
16-
const val SCPT =
17-
"https://www.dropbox.com/scl/fi/lppie7xcxbzloo860t7qg/openNotepad.scpt?rlkey=xv413n4dclvsjj6hdj580u0s6&st=1uk85psv&dl=1"
18-
1915
/**
2016
* Downloads a file from the specified URL and saves it to the given destination path.
2117
*

src/main/kotlin/util/notepad/LinuxNotepad.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import util.extension.type
99
import java.awt.Robot
1010
import java.awt.event.KeyEvent
1111
import java.io.File
12-
import java.io.IOException
1312

1413
class LinuxNotepad : Notepad {
1514
private val robot = Robot()
@@ -19,7 +18,6 @@ class LinuxNotepad : Notepad {
1918
val homeDirectory = System.getProperty("user.home") + File.separator + "Aries"
2019
}
2120

22-
@Throws(IOException::class)
2321
override fun openNotepad() {
2422
process =
2523
ProcessBuilder("notepadqq").start().also {
@@ -31,10 +29,6 @@ class LinuxNotepad : Notepad {
3129
}
3230
}
3331

34-
override fun writeText(text: String) {
35-
robot.type(text)
36-
}
37-
3832
override fun deleteText() {
3933
robot.apply {
4034
control(KeyEvent.VK_A)
@@ -61,7 +55,6 @@ class LinuxNotepad : Notepad {
6155
robot.control(KeyEvent.VK_N)
6256
}
6357

64-
@Throws(InterruptedException::class)
6558
override fun closeNotepad() {
6659
robot.control(KeyEvent.VK_F4)
6760
process?.waitFor()?.also { Logger.d("Exited Notepad++ with code: $it") }

src/main/kotlin/util/notepad/MacNotepad.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ class MacNotepad : Notepad {
2121
}
2222
}
2323

24-
override fun writeText(text: String) {
25-
robot.type(text)
26-
}
27-
2824
override fun deleteText() {
2925
robot.control(KeyEvent.VK_A)
3026
robot.type(KeyEvent.VK_BACK_SPACE)
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
package util.notepad
22

3-
import java.awt.AWTException
4-
import java.io.IOException
5-
63
interface Notepad {
7-
@Throws(IOException::class, InterruptedException::class, AWTException::class)
84
fun openNotepad()
95

10-
fun writeText(text: String)
11-
126
fun deleteText()
137

148
fun addNewLine()
@@ -17,6 +11,5 @@ interface Notepad {
1711

1812
fun openNewFile()
1913

20-
@Throws(InterruptedException::class)
2114
fun closeNotepad()
2215
}

src/main/kotlin/util/notepad/NotepadProcessor.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import util.emu.Platform.Companion.currentPlatform
44
import util.emu.Platform.LINUX
55
import util.emu.Platform.MAC
66
import util.emu.Platform.WINDOWS
7-
import java.awt.AWTException
8-
import java.io.IOException
97

108
class NotepadProcessor {
119
private val notepad: Notepad =
@@ -16,11 +14,8 @@ class NotepadProcessor {
1614
else -> error("Platform not supported")
1715
}
1816

19-
@Throws(IOException::class, InterruptedException::class, AWTException::class)
2017
fun openNotepad() = notepad.openNotepad()
2118

22-
fun writeText(text: String) = notepad.writeText(text)
23-
2419
fun deleteText() = notepad.deleteText()
2520

2621
fun addNewLine() = notepad.addNewLine()
@@ -29,6 +24,5 @@ class NotepadProcessor {
2924

3025
fun openNewFile() = notepad.openNewFile()
3126

32-
@Throws(InterruptedException::class)
3327
fun closeNotepad() = notepad.closeNotepad()
3428
}

src/main/kotlin/util/notepad/WinNotepad.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import util.extension.type
77
import java.awt.Robot
88
import java.awt.event.KeyEvent
99
import java.io.File.separator
10-
import java.io.IOException
1110
import java.nio.file.Files
1211
import java.nio.file.Paths
1312

@@ -23,14 +22,11 @@ class WinNotepad : Notepad {
2322
Files.createDirectories(Paths.get(homeDirectory))
2423
}
2524

26-
@Throws(IOException::class)
2725
override fun openNotepad() {
2826
process = ProcessBuilder("C:\\Program Files\\Notepad++\\notepad++.exe").start()
2927
robot.delay(1000)
3028
}
3129

32-
override fun writeText(text: String) = robot.type(text)
33-
3430
override fun deleteText() {
3531
robot.control(KeyEvent.VK_A)
3632
robot.type(KeyEvent.VK_BACK_SPACE)
@@ -54,7 +50,6 @@ class WinNotepad : Notepad {
5450

5551
override fun openNewFile() = robot.control(KeyEvent.VK_N)
5652

57-
@Throws(InterruptedException::class)
5853
override fun closeNotepad() {
5954
process?.let {
6055
it.destroy()

0 commit comments

Comments
 (0)