Passed
Push — main ( cdf0f7...3de8e8 )
by Douglas
01:40
created

mandos.entries.EntryMeta.set_logging()   A

Complexity

Conditions 5

Size

Total Lines 12
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 11
nop 4
dl 0
loc 12
rs 9.3333
c 0
b 0
f 0
1
from pathlib import Path
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
from typing import Optional
3
4
from mandos import MandosLogging
5
6
7
class EntryMeta:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
8
    @classmethod
9
    def set_logging(cls, verbose: bool, quiet: bool, log: Optional[Path]) -> str:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
10
        if verbose and quiet:
0 ignored issues
show
Unused Code introduced by
Unnecessary "elif" after "raise"
Loading history...
11
            raise ValueError(f"Cannot set both --quiet and --verbose")
0 ignored issues
show
introduced by
Using an f-string that does not have any interpolated variables
Loading history...
12
        elif quiet:
13
            level = "ERROR"
14
        elif verbose:
15
            level = "INFO"
16
        else:
17
            level = "WARNING"
18
        MandosLogging.set_log_level(level, log)
19
        return level
20
21
22
__all__ = ["EntryMeta"]
23