Esempio n. 1
0
 def check_dependencies(self):
     """
     See if foodcritic is on the PATH
     """
     return in_path('foodcritic') or bundle_exists('foodcritic')
Esempio n. 2
0
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.eslint import Eslint
from lintreview.utils import in_path
from lintreview.utils import npm_exists
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

eslint_missing = not(in_path('eslint') or npm_exists('eslint'))

class TestEslint(TestCase):

    needs_eslint = skipIf(eslint_missing, 'Needs eslint to run')

    fixtures = [
        'tests/fixtures/eslint/no_errors.js',
        'tests/fixtures/eslint/has_errors.js'
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Eslint(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertTrue(self.tool.match_file('test.js'))
        self.assertTrue(self.tool.match_file('dir/name/test.js'))
Esempio n. 3
0
 def check_dependencies(self):
     """
     See if swiftlint is on the system path.
     """
     return in_path('swiftlint')
Esempio n. 4
0
 def check_dependencies(self):
     """
     See if pep8 is on the PATH
     """
     return in_path('pep8')
Esempio n. 5
0
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.eslint import Eslint
from lintreview.utils import in_path
from lintreview.utils import npm_exists
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

eslint_missing = not (in_path('eslint') or npm_exists('eslint'))


class TestEslint(TestCase):

    needs_eslint = skipIf(eslint_missing, 'Needs eslint to run')

    fixtures = [
        'tests/fixtures/eslint/no_errors.js',
        'tests/fixtures/eslint/has_errors.js'
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Eslint(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertTrue(self.tool.match_file('test.js'))
        self.assertTrue(self.tool.match_file('dir/name/test.js'))
Esempio n. 6
0
 def check_dependencies(self):
     """
     See if shellcheck is on the system path.
     """
     return in_path('shellcheck')
Esempio n. 7
0
 def check_dependencies(self):
     """
     See if gpg is on the PATH
     """
     return in_path('gpg')
Esempio n. 8
0
 def check_dependencies(self):
     """
     See if swiftlint is on the system path.
     """
     return in_path('swiftlint')
Esempio n. 9
0
 def check_dependencies(self):
     """
     See if foodcritic is on the PATH
     """
     return in_path('foodcritic') or bundle_exists('foodcritic')
Esempio n. 10
0
 def check_dependencies(self):
     """
     See if checkstyle is on the system path.
     """
     return in_path('checkstyle')
Esempio n. 11
0
from os.path import abspath
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path, bundle_exists
from lintreview.tools.puppet import Puppet
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_
from operator import attrgetter

puppet_missing = not(in_path('puppet-lint') or bundle_exists('puppet-lint'))


class TestPuppet(TestCase):
    needs_puppet = skipIf(puppet_missing, 'Missing puppet-lint, cannot run')

    fixtures = [
        'tests/fixtures/puppet/no_errors.pp',
        'tests/fixtures/puppet/has_errors.pp',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Puppet(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertTrue(self.tool.match_file('test.pp'))
        self.assertTrue(self.tool.match_file('dir/name/test.pp'))
Esempio n. 12
0
from lintreview.review import Comment
from lintreview.review import Problems
from lintreview.tools.foodcritic import Foodcritic
from lintreview.utils import in_path
from unittest import TestCase, skipIf
from nose.tools import eq_


critic_missing = not(in_path('foodcritic'))


class TestFoodcritic(TestCase):
    needs_critic = skipIf(critic_missing, 'Missing foodcritic, cannot run')

    fixtures = [
        'tests/fixtures/foodcritic/noerrors',
        'tests/fixtures/foodcritic/errors',
    ]

    def setUp(self):
        self.problems = Problems()

    @needs_critic
    def test_process_cookbook_pass(self):
        self.tool = Foodcritic(self.problems, None, self.fixtures[0])
        self.tool.process_files(None)
        eq_([], self.problems.all())

    @needs_critic
    def test_process_cookbook_fail(self):
        self.tool = Foodcritic(self.problems, None, self.fixtures[1])
Esempio n. 13
0
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.phpcs import Phpcs
from lintreview.utils import in_path
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

phpcs_missing = not(in_path('phpcs'))


class Testphpcs(TestCase):

    needs_phpcs = skipIf(phpcs_missing, 'Needs phpcs')

    fixtures = [
        'tests/fixtures/phpcs/no_errors.php',
        'tests/fixtures/phpcs/has_errors.php',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Phpcs(self.problems)

    def test_match_file(self):
        self.assertTrue(self.tool.match_file('test.php'))
        self.assertTrue(self.tool.match_file('dir/name/test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertFalse(self.tool.match_file('test.js'))
Esempio n. 14
0
 def check_dependencies(self):
     """
     See if golint is on the system path.
     """
     return in_path('golint') or go_bin_path('golint')
Esempio n. 15
0
from __future__ import absolute_import
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path
from lintreview.utils import npm_exists
from lintreview.tools.sasslint import Sasslint
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

sasslint_missing = not(in_path('sass-lint') or npm_exists('sass-lint'))


class TestSasslint(TestCase):

    needs_sasslint = skipIf(sasslint_missing, 'Needs sasslint')

    fixtures = [
        'tests/fixtures/sasslint/no_errors.scss',
        'tests/fixtures/sasslint/has_errors.scss',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Sasslint(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertTrue(self.tool.match_file('test.sass'))
Esempio n. 16
0
from unittest import TestCase
from unittest import skipIf

from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.standardjs import Standardjs
from lintreview.utils import in_path
from lintreview.utils import npm_exists
from nose.tools import eq_

standardjs_missing = not (in_path('standard') or npm_exists('standard'))

FILE_WITH_NO_ERRORS = 'tests/fixtures/standardjs/no_errors.js',
FILE_WITH_ERRORS = 'tests/fixtures/standardjs/has_errors.js'


class TestStandardjs(TestCase):

    needs_standardjs = skipIf(standardjs_missing, 'Needs standardjs to run')

    def setUp(self):
        self.problems = Problems()
        options = {}
        self.tool = Standardjs(self.problems, options)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertTrue(self.tool.match_file('test.js'))
        self.assertTrue(self.tool.match_file('dir/name/test.js'))
Esempio n. 17
0
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.phpcs import Phpcs
from lintreview.utils import in_path
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

phpcs_missing = not (in_path('phpcs'))


class Testphpcs(TestCase):

    fixtures = [
        'tests/fixtures/phpcs/no_errors.php',
        'tests/fixtures/phpcs/has_errors.php',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Phpcs(self.problems)

    def test_match_file(self):
        self.assertTrue(self.tool.match_file('test.php'))
        self.assertTrue(self.tool.match_file('dir/name/test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertFalse(self.tool.match_file('test.js'))

    @skipIf(phpcs_missing, 'Missing phpcs, cannot run')
    def test_check_dependencies(self):
Esempio n. 18
0
from __future__ import absolute_import
from unittest import TestCase
from unittest import skipIf

from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.xo import Xo
from lintreview.utils import in_path
from lintreview.utils import npm_exists
from nose.tools import eq_

xo_missing = not (in_path('xo') or npm_exists('xo'))

FILE_WITH_NO_ERRORS = 'tests/samples/xo/no_errors.js',
FILE_WITH_ERRORS = 'tests/samples/xo/has_errors.js'


class TestXo(TestCase):

    needs_xo = skipIf(xo_missing, 'Needs xo to run')

    def setUp(self):
        self.problems = Problems()
        options = {'ignore': ''}
        self.tool = Xo(self.problems, options)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertTrue(self.tool.match_file('test.js'))
Esempio n. 19
0
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.shellcheck import Shellcheck
from lintreview.utils import in_path
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

shellcheck_missing = not (in_path('shellCheck'))


class Testshellcheck(TestCase):

    needs_shellcheck = skipIf(shellcheck_missing, 'Needs shellcheck')

    fixtures = [
        'tests/fixtures/shellcheck/no_errors.sh',
        'tests/fixtures/shellcheck/has_errors.sh',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Shellcheck(self.problems)

    def test_match_file(self):
        self.assertTrue(self.tool.match_file('test.sh'))
        self.assertTrue(self.tool.match_file('dir/name/test.sh'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertFalse(self.tool.match_file('test.js'))
Esempio n. 20
0
from lintreview.review import Comment
from lintreview.review import Problems
from lintreview.tools.foodcritic import Foodcritic
from lintreview.utils import in_path
from unittest import TestCase, skipIf
from nose.tools import eq_

critic_missing = not (in_path('foodcritic'))


class TestFoodcritic(TestCase):
    needs_critic = skipIf(critic_missing, 'Missing foodcritic, cannot run')

    fixtures = [
        'tests/fixtures/foodcritic/noerrors',
        'tests/fixtures/foodcritic/errors',
    ]

    def setUp(self):
        self.problems = Problems()

    @needs_critic
    def test_process_cookbook_pass(self):
        self.tool = Foodcritic(self.problems, None, self.fixtures[0])
        self.tool.process_files(None)
        eq_([], self.problems.all())

    @needs_critic
    def test_process_cookbook_fail(self):
        self.tool = Foodcritic(self.problems, None, self.fixtures[1])
        self.tool.process_files(None)
Esempio n. 21
0
 def check_dependencies(self):
     """
     See if puppet-lint is on the PATH
     """
     return in_path('puppet-lint') or bundle_exists('puppet-lint')
Esempio n. 22
0
def test_in_path():
    assert utils.in_path('python'), 'No python in path'
    assert not utils.in_path('bad_cmd_name')
Esempio n. 23
0
 def check_dependencies(self):
     """
     See if flake8 is on the PATH
     """
     return in_path('flake8')
Esempio n. 24
0
 def check_dependencies(self):
     """
     See if ansible-lint is on the PATH
     """
     return in_path('ansible-lint')
Esempio n. 25
0
from __future__ import absolute_import
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.jscs import Jscs
from lintreview.utils import in_path
from lintreview.utils import npm_exists
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

jscs_missing = not (in_path('jscs') or npm_exists('jscs'))


class TestJscs(TestCase):

    needs_jscs = skipIf(jscs_missing, 'Needs jscs to run')

    fixtures = [
        'tests/fixtures/jscs/no_errors.js',
        'tests/fixtures/jscs/has_errors.js',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Jscs(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertTrue(self.tool.match_file('test.js'))
Esempio n. 26
0
 def check_dependencies(self):
     """
     See if XO is on the system path.
     """
     return in_path('xo') or npm_exists('xo')
Esempio n. 27
0
from os.path import abspath
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path
from lintreview.tools.puppet import Puppet
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_
from operator import attrgetter

puppet_missing = not (in_path('puppet-lint'))


class TestPuppet(TestCase):
    needs_puppet = skipIf(puppet_missing, 'Missing puppet-lint, cannot run')

    fixtures = [
        'tests/fixtures/puppet/no_errors.pp',
        'tests/fixtures/puppet/has_errors.pp',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Puppet(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertTrue(self.tool.match_file('test.pp'))
        self.assertTrue(self.tool.match_file('dir/name/test.pp'))
Esempio n. 28
0
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path
from lintreview.utils import npm_exists
from lintreview.tools.sasslint import Sasslint
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

sasslint_missing = not (in_path("sass-lint") or npm_exists("sass-lint"))


class TestSasslint(TestCase):

    needs_sasslint = skipIf(sasslint_missing, "Needs sasslint")

    fixtures = ["tests/fixtures/sasslint/no_errors.scss", "tests/fixtures/sasslint/has_errors.scss"]

    def setUp(self):
        self.problems = Problems()
        self.tool = Sasslint(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file("test.php"))
        self.assertFalse(self.tool.match_file("dir/name/test.py"))
        self.assertFalse(self.tool.match_file("test.py"))
        self.assertTrue(self.tool.match_file("test.sass"))
        self.assertTrue(self.tool.match_file("dir/name/test.sass"))
        self.assertTrue(self.tool.match_file("dir/name/test.scss"))

    @needs_sasslint
Esempio n. 29
0
 def check_dependencies(self):
     """
     See if jsonlint is on the PATH
     """
     return in_path('jsonlint')
Esempio n. 30
0
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.jshint import Jshint
from lintreview.utils import in_path
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

jshint_missing = not (in_path('jshint'))


class TestJshint(TestCase):

    fixtures = [
        'tests/fixtures/jshint/no_errors.js',
        'tests/fixtures/jshint/has_errors.js',
        'tests/fixtures/jshint/error_on_multiple_lines.js',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Jshint(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertTrue(self.tool.match_file('test.js'))
        self.assertTrue(self.tool.match_file('dir/name/test.js'))

    @skipIf(jshint_missing, 'Missing jshint, cannot run')
Esempio n. 31
0
 def check_dependencies(self):
     """
     See if checkstyle is on the system path.
     """
     return in_path('checkstyle')
Esempio n. 32
0
from __future__ import absolute_import
from lintreview.review import Comment
from lintreview.review import Problems
from lintreview.tools.foodcritic import Foodcritic
from lintreview.utils import in_path, bundle_exists
from unittest import TestCase, skipIf
from nose.tools import eq_


critic_missing = not(in_path('foodcritic') or bundle_exists('foodcritic'))


class TestFoodcritic(TestCase):
    needs_critic = skipIf(critic_missing, 'Missing foodcritic, cannot run')

    fixtures = [
        'tests/fixtures/foodcritic/noerrors',
        'tests/fixtures/foodcritic/errors',
    ]

    def setUp(self):
        self.problems = Problems()

    @needs_critic
    def test_process_cookbook_pass(self):
        self.tool = Foodcritic(self.problems, None, self.fixtures[0])
        self.tool.process_files(None)
        eq_([], self.problems.all())

    @needs_critic
    def test_process_cookbook_fail(self):
Esempio n. 33
0
 def check_dependencies(self):
     """
     See if puppet-lint is on the PATH
     """
     return in_path('puppet-lint')
Esempio n. 34
0
from os.path import abspath
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path
from lintreview.tools.rubocop import Rubocop
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

rubocop_missing = not (in_path('rubocop'))


class TestRubocop(TestCase):
    needs_rubocop = skipIf(rubocop_missing, 'Missing rubocop, cannot run')

    fixtures = [
        'tests/fixtures/rubocop/no_errors.rb',
        'tests/fixtures/rubocop/has_errors.rb',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Rubocop(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertTrue(self.tool.match_file('test.rb'))
        self.assertTrue(self.tool.match_file('dir/name/test.rb'))

    @needs_rubocop
Esempio n. 35
0
 def check_dependencies(self):
     """
     See if phpcs is on the system path.
     """
     return in_path('phpcs') or composer_exists('phpcs')
Esempio n. 36
0
 def check_dependencies(self):
     """
     See if reek is on the PATH
     """
     return in_path('reek') or bundle_exists('reek')
Esempio n. 37
0
from __future__ import absolute_import
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.shellcheck import Shellcheck
from lintreview.utils import in_path
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

shellcheck_missing = not(in_path('shellCheck'))


class Testshellcheck(TestCase):

    needs_shellcheck = skipIf(shellcheck_missing, 'Needs shellcheck')

    fixtures = [
        'tests/fixtures/shellcheck/no_errors.sh',
        'tests/fixtures/shellcheck/has_errors.sh',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Shellcheck(self.problems)

    def test_match_file(self):
        self.assertTrue(self.tool.match_file('test.bash'))
        self.assertTrue(self.tool.match_file('test.zsh'))
        self.assertTrue(self.tool.match_file('test.ksh'))
        self.assertTrue(self.tool.match_file('test.sh'))
        self.assertTrue(self.tool.match_file('dir/name/test.sh'))
Esempio n. 38
0
from __future__ import absolute_import
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.checkstyle import Checkstyle
from lintreview.utils import in_path
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_, assert_in

checkstyle_missing = not(in_path('checkstyle'))


class TestCheckstyle(TestCase):

    needs_checkstyle = skipIf(checkstyle_missing, 'Needs checkstyle to run')

    fixtures = [
        'tests/fixtures/checkstyle/no_errors.java',
        'tests/fixtures/checkstyle/has_errors.java',
    ]

    def setUp(self):
        self.problems = Problems()
        config = {
            'config': 'tests/fixtures/checkstyle/config.xml'
        }
        self.tool = Checkstyle(self.problems, config)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
Esempio n. 39
0
 def check_dependencies(self):
     """
     See if ESLint is on the system path.
     """
     return in_path('eslint') or npm_exists('eslint')
Esempio n. 40
0
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.jshint import Jshint
from lintreview.utils import in_path
from lintreview.utils import npm_exists
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

jshint_missing = not (in_path("jshint") or npm_exists("jshint"))


class TestJshint(TestCase):

    needs_jshint = skipIf(jshint_missing, "Needs jshint to run")

    fixtures = [
        "tests/fixtures/jshint/no_errors.js",
        "tests/fixtures/jshint/has_errors.js",
        "tests/fixtures/jshint/error_on_multiple_lines.js",
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Jshint(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file("test.php"))
        self.assertFalse(self.tool.match_file("dir/name/test.py"))
        self.assertFalse(self.tool.match_file("test.py"))
        self.assertTrue(self.tool.match_file("test.js"))
Esempio n. 41
0
 def check_dependencies(self):
     """
     See if shellcheck is on the system path.
     """
     return in_path('shellcheck')
Esempio n. 42
0
from __future__ import absolute_import
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.luacheck import Luacheck
from lintreview.utils import in_path
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

luacheck_missing = not (in_path('luaCheck'))


class Testluacheck(TestCase):

    needs_luacheck = skipIf(luacheck_missing, 'Needs luacheck')

    fixtures = [
        'tests/fixtures/luacheck/no_errors.lua',
        'tests/fixtures/luacheck/has_errors.lua',
        'tests/fixtures/luacheck/has_warnings.lua',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Luacheck(self.problems)

    def test_match_file(self):
        self.assertTrue(self.tool.match_file('test.lua'))
        self.assertTrue(self.tool.match_file('dir/name/test.lua'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.py'))
Esempio n. 43
0
 def check_dependencies(self):
     """
     See if phpcs is on the system path.
     """
     return in_path('phpcs') or composer_exists('phpcs')
Esempio n. 44
0
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.tools.jscs import Jscs
from lintreview.utils import in_path
from lintreview.utils import npm_exists
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

jscs_missing = not (in_path("jscs") or npm_exists("jscs"))


class TestJcs(TestCase):

    needs_jscs = skipIf(jscs_missing, "Needs jscs to run")

    fixtures = ["tests/fixtures/jscs/no_errors.js", "tests/fixtures/jscs/has_errors.js"]

    def setUp(self):
        self.problems = Problems()
        self.tool = Jscs(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file("test.php"))
        self.assertFalse(self.tool.match_file("dir/name/test.py"))
        self.assertFalse(self.tool.match_file("test.py"))
        self.assertTrue(self.tool.match_file("test.js"))
        self.assertTrue(self.tool.match_file("dir/name/test.js"))

    @needs_jscs
    def test_check_dependencies(self):
Esempio n. 45
0
from os.path import abspath
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path
from lintreview.tools.rubocop import Rubocop
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_


rubocop_missing = not(in_path('rubocop'))


class TestRubocop(TestCase):
    needs_rubocop = skipIf(rubocop_missing, 'Missing rubocop, cannot run')

    fixtures = [
        'tests/fixtures/rubocop/no_errors.rb',
        'tests/fixtures/rubocop/has_errors.rb',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Rubocop(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertTrue(self.tool.match_file('test.rb'))
        self.assertTrue(self.tool.match_file('dir/name/test.rb'))
Esempio n. 46
0
 def check_dependencies(self):
     """
     See if golint is on the system path.
     """
     return in_path('golint') or go_bin_path('golint')
Esempio n. 47
0
 def check_dependencies(self):
     """
     See if standard is on the system path.
     """
     return in_path('standard') or npm_exists('standard')
Esempio n. 48
0
 def check_dependencies(self):
     """
     See if jscs is on the system path.
     """
     return in_path('jscs') or npm_exists('jscs')
Esempio n. 49
0
 def check_dependencies(self):
     """
     See if brakeman is on the PATH
     """
     return in_path('brakeman') or bundle_exists('brakeman')
Esempio n. 50
0
from __future__ import absolute_import
from os.path import abspath
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path, bundle_exists
from lintreview.tools.puppet import Puppet
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_
from operator import attrgetter

puppet_missing = not (in_path('puppet-lint') or bundle_exists('puppet-lint'))


class TestPuppet(TestCase):
    needs_puppet = skipIf(puppet_missing, 'Missing puppet-lint, cannot run')

    fixtures = [
        'tests/fixtures/puppet/no_errors.pp',
        'tests/fixtures/puppet/has_errors.pp',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Puppet(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertTrue(self.tool.match_file('test.pp'))
        self.assertTrue(self.tool.match_file('dir/name/test.pp'))
Esempio n. 51
0
 def check_dependencies(self):
     """
     See if csslint is on the system path.
     """
     return in_path('csslint') or npm_exists('csslint')
Esempio n. 52
0
 def check_dependencies(self):
     """
     See if yamllint is on the PATH
     """
     return in_path('yamllint')
Esempio n. 53
0
from os.path import abspath
from lintreview.review import Problems
from lintreview.review import Comment
from lintreview.utils import in_path, bundle_exists
from lintreview.tools.rubocop import Rubocop
from unittest import TestCase
from unittest import skipIf
from nose.tools import eq_

rubocop_missing = not (in_path('rubocop') or bundle_exists('rubocop'))


class TestRubocop(TestCase):
    needs_rubocop = skipIf(rubocop_missing, 'Missing rubocop, cannot run')

    fixtures = [
        'tests/fixtures/rubocop/no_errors.rb',
        'tests/fixtures/rubocop/has_errors.rb',
    ]

    def setUp(self):
        self.problems = Problems()
        self.tool = Rubocop(self.problems)

    def test_match_file(self):
        self.assertFalse(self.tool.match_file('test.py'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertTrue(self.tool.match_file('test.rb'))
        self.assertTrue(self.tool.match_file('dir/name/test.rb'))

    @needs_rubocop
Esempio n. 54
0
 def check_dependencies(self):
     """
     See if rubocop is on the PATH
     """
     return in_path('rubocop')