matiasmenares/Nissboard

View on GitHub
dashboard/core/database.py

Summary

Maintainability
F
3 days
Test Coverage

Showing 6 of 6 total issues

Function set_dashboards_seed has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def set_dashboards_seed(self):
cursorObj = self.con.cursor()
if len(cursorObj.execute('SELECT * FROM obd').fetchall()) == 0:
cursorObj.execute("INSERT INTO obd VALUES(NULL, 'Coolant Temp', 'COOLANT_TEMP', 'Engine Coolant Temperature', NULL )")
cursorObj.execute("INSERT INTO obd VALUES(NULL, 'Throttle Position', 'THROTTLE_POS', 'Throttle Position Sensor', NULL )")
Severity: Minor
Found in dashboard/core/database.py - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if len(cursorObj.execute('SELECT * FROM measure').fetchall()) == 0:
#Boost
cursorObj.execute("INSERT INTO measure VALUES(1, 'Psi', ' * 0.001) * 14 ) - 14)', ' - 14 ) / 14.504)', 'This sensor substract 14 PSI to pressure', 1)")
cursorObj.execute("INSERT INTO measure VALUES(2, 'Bar', ' * 0.001) - 1.0 ))', ' - 1.0 )', 'This sensor substract 1.0 Bar to pressure', 1)")
cursorObj.execute("INSERT INTO measure VALUES(3, 'Kilopascal', ' * 0.001) -1.0 ) * 100)', ' - 1.0 )', 'This sensor substract 100 Kilopascal to pressure', 1)")
Severity: Major
Found in dashboard/core/database.py and 1 other location - About 1 day to fix
dashboard/core/database.py on lines 137..148

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if len(cursorObj.execute('SELECT * FROM consult').fetchall()) == 0:
cursorObj.execute("INSERT INTO consult VALUES(NULL, 'Temp', '0x08', 'Colant/Water Temperature')")
cursorObj.execute("INSERT INTO consult VALUES(NULL, 'MPH', '0x0b', 'Speed in Miles per hours')")
cursorObj.execute("INSERT INTO consult VALUES(NULL, 'KPH', '0x0b', 'Speed in kilometers per hours')")
cursorObj.execute("INSERT INTO consult VALUES(NULL, 'RPM', '0x00,0x01', 'Rev. Per Minutes')")
Severity: Major
Found in dashboard/core/database.py and 1 other location - About 1 day to fix
dashboard/core/database.py on lines 113..128

Similar blocks of code found in 3 locations. Consider refactoring.
Open

if len(cursorObj.execute('SELECT * FROM measure_group').fetchall()) == 0:
cursorObj.execute("INSERT INTO measure_group VALUES(1, 'Pressure (Boost)')")
cursorObj.execute("INSERT INTO measure_group VALUES(2, 'Pressure')")
cursorObj.execute("INSERT INTO measure_group VALUES(3, 'Temperature')")
cursorObj.execute("INSERT INTO measure_group VALUES(4, 'RPM')")
Severity: Major
Found in dashboard/core/database.py and 2 other locations - About 3 hrs to fix
dashboard/core/database.py on lines 48..54
dashboard/core/database.py on lines 130..135

Similar blocks of code found in 3 locations. Consider refactoring.
Open

if len(cursorObj.execute('SELECT * FROM dashboard').fetchall()) == 0:
cursorObj.execute("INSERT INTO dashboard VALUES(1, 'KINEK', '0', '0')")
cursorObj.execute("INSERT INTO dashboard VALUES(2, 'DUST', '0', '0')")
cursorObj.execute("INSERT INTO dashboard VALUES(3, 'INIT', '0', '0')")
cursorObj.execute("INSERT INTO dashboard VALUES(4, 'BLUME', '0', '0')")
Severity: Major
Found in dashboard/core/database.py and 2 other locations - About 3 hrs to fix
dashboard/core/database.py on lines 96..101
dashboard/core/database.py on lines 130..135

Similar blocks of code found in 3 locations. Consider refactoring.
Open

if len(cursorObj.execute('SELECT * FROM color').fetchall()) == 0:
cursorObj.execute("INSERT INTO color VALUES(NULL, 'Red', '2345', '255,0,0')")
cursorObj.execute("INSERT INTO color VALUES(NULL, 'Blue', '2345', '0,0,255')")
cursorObj.execute("INSERT INTO color VALUES(NULL, 'Green', '2345', '0,255,0')")
cursorObj.execute("INSERT INTO color VALUES(NULL, 'Yellow', '2345', '255,255,0')")
Severity: Major
Found in dashboard/core/database.py and 2 other locations - About 3 hrs to fix
dashboard/core/database.py on lines 48..54
dashboard/core/database.py on lines 96..101

There are no issues that match your filters.

Category
Status