Completed
Pull Request — master (#1116)
by Lasse
01:41
created

bears.general.LineCountBear.run()   A

Complexity

Conditions 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 9
rs 9.6667
1
from coalib.bears.LocalBear import LocalBear
2
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
3
from coalib.results.Result import Result
4
5
6
class LineCountBear(LocalBear):
7
    def run(self, filename, file, *args):
8
        '''
9
        Counts the lines of each file.
10
        '''
11
        yield Result.from_values(
12
            origin=self,
13
            message="This file has {count} lines.".format(count=len(file)),
14
            severity=RESULT_SEVERITY.INFO,
15
            file=filename)
16