def check_dependencies(self): """ See if foodcritic is on the PATH """ return in_path('foodcritic') or bundle_exists('foodcritic')
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'))
def check_dependencies(self): """ See if swiftlint is on the system path. """ return in_path('swiftlint')
def check_dependencies(self): """ See if pep8 is on the PATH """ return in_path('pep8')
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'))
def check_dependencies(self): """ See if shellcheck is on the system path. """ return in_path('shellcheck')
def check_dependencies(self): """ See if gpg is on the PATH """ return in_path('gpg')
def check_dependencies(self): """ See if swiftlint is on the system path. """ return in_path('swiftlint')
def check_dependencies(self): """ See if foodcritic is on the PATH """ return in_path('foodcritic') or bundle_exists('foodcritic')
def check_dependencies(self): """ See if checkstyle is on the system path. """ return in_path('checkstyle')
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'))
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])
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'))
def check_dependencies(self): """ See if golint is on the system path. """ return in_path('golint') or go_bin_path('golint')
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'))
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'))
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):
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'))
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'))
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)
def check_dependencies(self): """ See if puppet-lint is on the PATH """ return in_path('puppet-lint') or bundle_exists('puppet-lint')
def test_in_path(): assert utils.in_path('python'), 'No python in path' assert not utils.in_path('bad_cmd_name')
def check_dependencies(self): """ See if flake8 is on the PATH """ return in_path('flake8')
def check_dependencies(self): """ See if ansible-lint is on the PATH """ return in_path('ansible-lint')
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'))
def check_dependencies(self): """ See if XO is on the system path. """ return in_path('xo') or npm_exists('xo')
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'))
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
def check_dependencies(self): """ See if jsonlint is on the PATH """ return in_path('jsonlint')
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')
def check_dependencies(self): """ See if checkstyle is on the system path. """ return in_path('checkstyle')
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):
def check_dependencies(self): """ See if puppet-lint is on the PATH """ return in_path('puppet-lint')
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
def check_dependencies(self): """ See if phpcs is on the system path. """ return in_path('phpcs') or composer_exists('phpcs')
def check_dependencies(self): """ See if reek is on the PATH """ return in_path('reek') or bundle_exists('reek')
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'))
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'))
def check_dependencies(self): """ See if ESLint is on the system path. """ return in_path('eslint') or npm_exists('eslint')
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"))
def check_dependencies(self): """ See if shellcheck is on the system path. """ return in_path('shellcheck')
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'))
def check_dependencies(self): """ See if phpcs is on the system path. """ return in_path('phpcs') or composer_exists('phpcs')
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):
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'))
def check_dependencies(self): """ See if golint is on the system path. """ return in_path('golint') or go_bin_path('golint')
def check_dependencies(self): """ See if standard is on the system path. """ return in_path('standard') or npm_exists('standard')
def check_dependencies(self): """ See if jscs is on the system path. """ return in_path('jscs') or npm_exists('jscs')
def check_dependencies(self): """ See if brakeman is on the PATH """ return in_path('brakeman') or bundle_exists('brakeman')
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'))
def check_dependencies(self): """ See if csslint is on the system path. """ return in_path('csslint') or npm_exists('csslint')
def check_dependencies(self): """ See if yamllint is on the PATH """ return in_path('yamllint')
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
def check_dependencies(self): """ See if rubocop is on the PATH """ return in_path('rubocop')