Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Run linter depending of existence of rubocop gem
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcljx committed Dec 25, 2015
1 parent c6ebb04 commit dff7468
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/io/github/sirlantis/rubymine/rubocop/RubocopTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.intellij.openapi.application.Application
import org.jetbrains.plugins.ruby.ruby.run.RunnerUtil
import io.github.sirlantis.rubymine.rubocop.utils.NotifyUtil
import org.jetbrains.plugins.ruby.gem.util.BundlerUtil
import org.jetbrains.plugins.ruby.gem.util.GemSearchUtil

class RubocopTask(val module: Module, val paths: List<String>) : Task.Backgroundable(module.project, "Running RuboCop", true) {

Expand Down Expand Up @@ -51,8 +52,8 @@ class RubocopTask(val module: Module, val paths: List<String>) : Task.Background
return
}

if (!hasRubocopConfig) {
logger.warn("Didn't find $RUBOCOP_CONFIG_FILENAME")
if (GemSearchUtil.findGem(module, "rubocop") == null) {
logger.warn("Didn't find rubocop gem")
return
}

Expand Down Expand Up @@ -187,11 +188,6 @@ class RubocopTask(val module: Module, val paths: List<String>) : Task.Background
file as VirtualFile
}

val hasRubocopConfig: Boolean
get() {
return workDirectory.findChild(RUBOCOP_CONFIG_FILENAME) != null
}

fun tryClose(closable: Closeable?) {
if (closable != null) {
try {
Expand All @@ -206,7 +202,6 @@ class RubocopTask(val module: Module, val paths: List<String>) : Task.Background

companion object {
val logger = Logger.getInstance(RubocopBundle.LOG_ID)
val RUBOCOP_CONFIG_FILENAME: String = ".rubocop.yml"
val validSdkNames = listOf("RUBY_SDK", "JRUBY_SDK")

fun isRubySdk(sdk: Sdk): Boolean {
Expand Down

0 comments on commit dff7468

Please sign in to comment.