Test Failed
Push — master ( 47aaa2...5ffdf1 )
by Daniel
02:25
created

tableau_hyper_management.BasicNeeds   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 50 %

Importance

Changes 0
Metric Value
eloc 10
dl 10
loc 20
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A BasicNeeds.fn_timestamped_print() 4 4 1
A BasicNeeds.fn_optional_print() 3 3 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
"""
2
BasicNeeds - useful functions library
3
4
This library has functions useful to keep main logic short and simple
5
"""
6
# standard Python packages
7
from datetime import datetime, timezone
8
9
10 View Code Duplication
class BasicNeeds:
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
11
12
    def fn_optional_print(self, boolean_variable, string_to_print):
13
        if boolean_variable:
14
            self.fn_timestamped_print(self, string_to_print)
15
16
    @staticmethod
17
    def fn_timestamped_print(self, string_to_print):
18
        print(datetime.now(timezone.utc).strftime("%Y-%b-%d %H:%M:%S.%f %Z")
19
              + ' - ' + string_to_print)
20