コード例 #1
0
ファイル: golint.py プロジェクト: structurely/lint-review
 def create_command(self, files):
     command = ['golint']
     if go_bin_path('golint'):
         command = [go_bin_path('golint')]
     if 'min_confidence' in self.options:
         command += ['-min_confidence', self.options.get('min_confidence')]
     command += files
     return command
コード例 #2
0
ファイル: golint.py プロジェクト: esoergel/lint-review
 def create_command(self, files):
     command = ['golint']
     if go_bin_path('golint'):
         command = [go_bin_path('golint')]
     if 'min_confidence' in self.options:
         command += ['-min_confidence', self.options.get('min_confidence')]
     command += files
     return command
コード例 #3
0
    def test_process_files_with_config__mocked(self, mock_command):
        mock_command.return_value = []
        config = {'min_confidence': 0.95}
        tool = Golint(self.problems, config)
        tool.process_files([self.fixtures[1]])

        mock_command.assert_called_with(
            [go_bin_path('golint'), '-min_confidence', 0.95, self.fixtures[1]],
            ignore_error=True,
            split=True)
コード例 #4
0
    def test_process_files_with_config__mocked(self, mock_command):
        mock_command.return_value = []
        config = {
            'min_confidence': 0.95
        }
        tool = Golint(self.problems, config)
        tool.process_files([self.fixtures[1]])

        mock_command.assert_called_with(
            [
                go_bin_path('golint'),
                '-min_confidence', 0.95,
                self.fixtures[1]
            ],
            ignore_error=True,
            split=True)
コード例 #5
0
ファイル: test_golint.py プロジェクト: Techievena/lint-review
from lintreview.review import Problems, Comment
from lintreview.tools.golint import Golint
from lintreview.utils import go_bin_path
from unittest import TestCase, skipIf
from nose.tools import eq_
from mock import patch

golint_missing = not(go_bin_path('golint'))


class TestGolint(TestCase):

    needs_golint = skipIf(golint_missing, 'Needs phpcs')

    fixtures = [
        'tests/fixtures/golint/no_errors.go',
        'tests/fixtures/golint/has_errors.go',
        'tests/fixtures/golint/http.go',
    ]

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

    def test_match_file(self):
        self.assertTrue(self.tool.match_file('test.go'))
        self.assertTrue(self.tool.match_file('dir/name/test.go'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('test.golp'))
コード例 #6
0
ファイル: golint.py プロジェクト: structurely/lint-review
 def check_dependencies(self):
     """
     See if golint is on the system path.
     """
     return in_path('golint') or go_bin_path('golint')
コード例 #7
0
from lintreview.review import Problems, Comment
from lintreview.tools.golint import Golint
from lintreview.utils import go_bin_path
from unittest import TestCase, skipIf
from nose.tools import eq_
from mock import patch

golint_missing = not(go_bin_path('golint'))


class TestGolint(TestCase):

    needs_golint = skipIf(golint_missing, 'Needs phpcs')

    fixtures = [
        'tests/fixtures/golint/no_errors.go',
        'tests/fixtures/golint/has_errors.go',
        'tests/fixtures/golint/http.go',
    ]

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

    def test_match_file(self):
        self.assertTrue(self.tool.match_file('test.go'))
        self.assertTrue(self.tool.match_file('dir/name/test.go'))
        self.assertFalse(self.tool.match_file('dir/name/test.py'))
        self.assertFalse(self.tool.match_file('test.php'))
        self.assertFalse(self.tool.match_file('test.golp'))
コード例 #8
0
ファイル: golint.py プロジェクト: esoergel/lint-review
 def check_dependencies(self):
     """
     See if golint is on the system path.
     """
     return in_path('golint') or go_bin_path('golint')