Skip to content

Commit

Permalink
JavaPMDBear: Use ExecutableRequirement
Browse files Browse the repository at this point in the history
Describe current executable requirements of pmd or run.sh.

Related to coala#2937
  • Loading branch information
jayvdb committed Aug 3, 2019
1 parent 28fdbc6 commit 39d4b7b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions bears/java/JavaPMDBear.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from shutil import which

from dependency_management.requirements.AnyOneOfRequirements import (
AnyOneOfRequirements)
from dependency_management.requirements.ExecutableRequirement import (
ExecutableRequirement)

from coalib.bearlib.abstractions.Linter import linter
from coalib.bearlib import deprecate_settings
from coala_utils.param_conversion import negate
Expand All @@ -17,6 +22,13 @@ class JavaPMDBear:
"""

LANGUAGES = {'Java'}
REQUIREMENTS = {
AnyOneOfRequirements(
[ExecutableRequirement('pmd'),
ExecutableRequirement('run.sh'),
]
),
}
AUTHORS = {'The coala developers'}
AUTHORS_EMAILS = {'[email protected]'}
LICENSE = 'AGPL-3.0'
Expand All @@ -25,9 +37,7 @@ class JavaPMDBear:

@classmethod
def check_prerequisites(cls):
if which('bash') is None:
return 'bash is not installed.'
elif which('pmd') is None and which('run.sh') is None:
if which('pmd') is None and which('run.sh') is None:
return ('PMD is missing. Make sure to install it from '
'<https://pmd.github.io/>')
else:
Expand Down

0 comments on commit 39d4b7b

Please sign in to comment.