Class: FunCi::Setup::MavenLinterDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/fun_ci/setup/maven_linter_detector.rb

Constant Summary collapse

LINTERS =
[
  { artifact_id: "detekt-maven-plugin", command: "mvn detekt:check" },
  { artifact_id: "ktlint-maven-plugin", command: "mvn ktlint:check" },
  { artifact_id: "maven-checkstyle-plugin", command: "mvn checkstyle:check" },
  { artifact_id: "spotbugs-maven-plugin", command: "mvn spotbugs:check" },
  { artifact_id: "maven-pmd-plugin", command: "mvn pmd:check" }
].freeze
DEFAULT_COMMAND =
"mvn verify -DskipTests"

Instance Method Summary collapse

Constructor Details

#initialize(pom_content) ⇒ MavenLinterDetector

Returns a new instance of MavenLinterDetector.



16
17
18
# File 'lib/fun_ci/setup/maven_linter_detector.rb', line 16

def initialize(pom_content)
  @pom_content = pom_content
end

Instance Method Details

#lint_commandObject



20
21
22
23
# File 'lib/fun_ci/setup/maven_linter_detector.rb', line 20

def lint_command
  match = LINTERS.find { |linter| @pom_content.include?(linter[:artifact_id]) }
  match ? match[:command] : DEFAULT_COMMAND
end