Skip to content

Commit

Permalink
#42 Start using Detekt to check a code style of the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Vinogradov committed Aug 9, 2019
1 parent 3ab9320 commit 5a99bc7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
5 changes: 4 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ intellij {

detekt {
toolVersion = "1.0.0-RC16"
input = files("src/main/kotlin")
input = files("src/main/kotlin", "src/test/kotlin")
filters = ".*/resources/.*,.*/build/.*"
buildUponDefaultConfig = true
failFast = true
config = files("default-detekt-config.yml")
}
2 changes: 1 addition & 1 deletion default-detekt-config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @todo #9:30m Needs to set up most restrict policy that ever can be.
build:
maxIssues: 1
maxIssues: 0
weights:
# complexity: 2
# LongParameterList: 1
Expand Down
16 changes: 12 additions & 4 deletions src/main/kotlin/com/aivinog1/pdd/plugin/TestTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.ui.Messages

// @todo #26:30m It is a simple task that does nothing. Created for a testing purpose (verifying that a Kotlin code is compiled). Needs to remove this.
// @todo #26:30m It is a simple task that does nothing.
// Created for a testing purpose (verifying that a Kotlin code is compiled).
// Needs to remove this.
class TestTask : AnAction("test task") {
override fun actionPerformed(event: AnActionEvent) {
val project = event.getData(PlatformDataKeys.PROJECT)
val txt = Messages.showInputDialog(project, "What is your name?", "Input your name", Messages.getQuestionIcon())
Messages.showMessageDialog(project, "Hello, $txt!\n I am glad to see you.", "Information", Messages.getInformationIcon())
val txt = Messages.showInputDialog(
project,
"What is your name?",
"Input your name",
Messages.getQuestionIcon())
Messages.showMessageDialog(project,
"Hello, $txt!\n I am glad to see you.",
"Information", Messages.getInformationIcon())
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ import com.intellij.psi.PsiFile

/**
* This action creates a new PDD todo.
* @todo #38:30m Consider moving to the EditorAction. I think, this class would be more suitable for this task.
* @todo #38:30m Consider moving to the EditorAction.
* I think, this class would be more suitable for this task.
*/
class CreateNewPddAction(private val logger: Logger = Logger.getInstance("CreateNewPddAction")) : AnAction("Create a new PDD.") {
class CreateNewPddAction(private val logger:
Logger = Logger.getInstance("CreateNewPddAction"))
: AnAction("Create a new PDD.") {

override fun actionPerformed(e: AnActionEvent) {
val file = e.getData(CommonDataKeys.PSI_FILE)
Expand All @@ -33,7 +36,8 @@ class CreateNewPddAction(private val logger: Logger = Logger.getInstance("Create
val document = editor.document
if (document.isWritable) {
WriteCommandAction.runWriteCommandAction(project) {
// @todo #38:30 For now this action just comment line and nothing more. Needs to implement inserting a todo.
// @todo #38:30 For now this action just comment line and nothing more.
// Needs to implement inserting a todo.
document.insertString(0, lineCommentPrefix)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class CreateNewPddActionTest : LightPlatformCodeInsightFixture4TestCase() {
@Test
fun `test that simple java file has comment`() {
every { logger.trace("Current language: Language: JAVA. It's comment is //.") } just Runs
// @todo #15:30m After CreateNewPddAction became registered let's drop this mock and invite action via the IntelliJ platform.
// @todo #15:30m After CreateNewPddAction became registered
// let's drop this mock and invite action via the IntelliJ platform.
val actionEvent: AnActionEvent = mockk()
val fileName = "SimpleJavaClass.java"
val file = myFixture.configureByFile(fileName)
Expand Down

0 comments on commit 5a99bc7

Please sign in to comment.