Failed Conditions
Pull Request — master (#1291)
by Sudheesh
01:30
created

bears.tests.go.GoLintBearTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %
Metric Value
dl 0
loc 16
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_run() 0 3 1
A setUp() 0 9 1
1
import os
2
import sys
3
from queue import Queue
4
from shutil import which
5
from unittest.case import skipIf
6
7
sys.path.insert(0, ".")
8
import unittest
9
from coalib.settings.Setting import Setting
0 ignored issues
show
Unused Code introduced by
Unused Setting imported from coalib.settings.Setting
Loading history...
10
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
11
from bears.go.GoLintBear import GoLintBear
12
from coalib.settings.Section import Section
13
14
15
@skipIf(which('golint') is None, 'golint is not installed')
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
class GoLintBearTest(LocalBearTestHelper):
17
18
    def setUp(self):
19
        self.section = Section("Test Section")
20
        self.uut = GoLintBear(self.section, Queue())
21
        self.good_file = os.path.join(os.path.dirname(__file__),
22
                                      "test_files",
23
                                      "golint_good.go")
24
        self.bad_file = os.path.join(os.path.dirname(__file__),
25
                                     "test_files",
26
                                     "golint_bad.go")
27
28
    def test_run(self):
29
        self.assertLinesValid(self.uut, [], self.good_file)
30
        self.assertLinesInvalid(self.uut, [], self.bad_file)
31
32
if __name__ == '__main__':
33
    unittest.main(verbosity=2)
34