Failed Conditions
Pull Request — master (#2076)
by Abdeali
02:04
created

LocalBear.run()   A

Complexity

Conditions 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 14
rs 9.4285
1
from coalib.bears.Bear import Bear
2
from coalib.bears.BEAR_KIND import BEAR_KIND
3
from coalib.settings.FunctionMetadata import FunctionMetadata
4
5
6
class LocalBear(Bear):
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Bear does not seem to be defined.
Loading history...
7
    """
8
    A LocalBear is a Bear that analyzes only one file at once. It therefore can
9
    not analyze semantical facts over multiple files.
10
11
    This has the advantage that it can be highly parrallelized. In addition,
12
    the results from multiple bears for one file can be shown together for that
13
    file, which is better to grasp for the user. coala takes care of all that.
14
15
    Examples for LocalBear's could be:
16
17
    -   A SpaceConsistencyBear that checks every line for trailing whitespaces,
18
        tabs, etc.
19
    -   A VariableNameBear that checks variable names and constant names for
20
        certain conditions
21
    """
22
23
    @staticmethod
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable staticmethod does not seem to be defined.
Loading history...
24
    def kind():
25
        return BEAR_KIND.LOCAL
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable BEAR_KIND does not seem to be defined.
Loading history...
26
27
    def run(self,
28
            filename,
29
            file,
30
            *args,
31
            dependency_results=None,
32
            **kwargs):
33
        """
34
        Handles the given file.
35
36
        :param filename: The filename of the file
37
        :param file:     The file contents as string array
38
        :return:         A list of Result
39
        """
40
        raise NotImplementedError("This function has to be implemented for a "
41
                                  "runnable bear.")
42
43
    @classmethod
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable classmethod does not seem to be defined.
Loading history...
44
    def get_metadata(cls):
45
        return FunctionMetadata.from_function(
46
            cls.run,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable cls does not seem to be defined.
Loading history...
47
            omit={"self", "filename", "file", "dependency_results"})
48