Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixes to critical code smells from sonarqube. #469

Open
wants to merge 6 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ static void setIoDirection() {
#endif

static void setStatus(bool enabled) {
// setStatus will only run if BlueTooth support is enabled
#ifdef BLUETOOTH_ENABLE_SUPPORT
enabled = BLUETOOTH_ENABLE_PIN_POLARITY ? enabled : !enabled;
debug("Turning Bluetooth %s", enabled ? "on" : "off");
Expand All @@ -193,6 +194,7 @@ void openxc::bluetooth::start(UartDevice* device) {
}

void openxc::bluetooth::initialize(UartDevice* device) {
// Initializing Bluetooth in disabled state for UART device
#ifdef BLUETOOTH_SUPPORT
debug("Initializing Bluetooth in disabled state...");
setStatus(false);
Expand Down
1 change: 1 addition & 0 deletions src/can/canutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void openxc::can::initializeCommon(CanBus* bus) {
}

void openxc::can::destroy(CanBus* bus) {
// Possible derived class
}

bool openxc::can::busActive(CanBus* bus) {
Expand Down
3 changes: 3 additions & 0 deletions src/platform/pic32/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ HTTP_STATUS httpClient::execute() {
case HTTP_FAILED:
goto fcn_exit;
break;

//default: //Do nothing by default
//break;
}

// watch for timeout
Expand Down
8 changes: 7 additions & 1 deletion src/platform/pic32/server_apis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ API_RETURN openxc::server_api::serverPOSTdata(char* deviceId, char* host, char*
ret = Failed;
state = 0;
break;
//default: //Do nothing by default
//break;
}
break;
}
Expand Down Expand Up @@ -140,6 +142,8 @@ API_RETURN openxc::server_api::serverGETfirmware(char* deviceId, char* host) {
ret = Failed;
state = 0;
break;
//default: //Do nothing by default
//break;
}
break;
}
Expand Down Expand Up @@ -199,6 +203,8 @@ API_RETURN openxc::server_api::serverGETcommands(char* deviceId, char* host, uin
ret = Failed;
state = 0;
break;
//default: //Do nothing by default
//break;
}
break;
}
Expand Down Expand Up @@ -245,4 +251,4 @@ static int cbHeaderComplete(http_parser* parser) {
return 1;
}
return 0;
}
}
4 changes: 4 additions & 0 deletions src/platform/pic32/server_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ void openxc::server_task::firmwareCheck(TelitDevice* device) {
//timer = uptimeMs();
state = 0;
break;
//default: //Do nothing by default
//break;
}
break;
}
Expand Down Expand Up @@ -220,6 +222,8 @@ void openxc::server_task::flushDataBuffer(TelitDevice* device) {
state = 0;
closeSocket(POST_DATA_SOCKET);
break;
//default: //Do nothing by default
//break;
}
break;
}
Expand Down
18 changes: 18 additions & 0 deletions src/platform/pic32/telit_he910.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ static TELIT_CONNECTION_STATE openxc::telitHE910::DSM_Power_On_Delay(TelitDevice
}

break;

// default: //Do nothing by default
// break;
}

return l_state;
Expand Down Expand Up @@ -260,6 +263,9 @@ static TELIT_CONNECTION_STATE openxc::telitHE910::DSM_Power_Up_Delay(TelitDevice
}

break;

// default: //Do nothing by default
// break;
}

return l_state;
Expand Down Expand Up @@ -385,6 +391,9 @@ static TELIT_CONNECTION_STATE openxc::telitHE910::DSM_Initialize(TelitDevice* de
l_state = WAIT_FOR_NETWORK;

break;

default: //Do nothing by default
break;
}

return l_state;
Expand Down Expand Up @@ -444,6 +453,9 @@ static TELIT_CONNECTION_STATE openxc::telitHE910::DSM_Wait_For_Network(TelitDevi
}

break;

// default: //Do nothing by default
// break;
}

return l_state;
Expand Down Expand Up @@ -495,6 +507,9 @@ static TELIT_CONNECTION_STATE openxc::telitHE910::DSM_Open_PDP_Delay(TelitDevice
}

break;

// default: //Do nothing by default
// break;
}

return l_state;
Expand Down Expand Up @@ -568,6 +583,9 @@ static TELIT_CONNECTION_STATE openxc::telitHE910::DSM_Ready(TelitDevice* device)
sub_state = 0;

break;

// default: //Do nothing by default
// break;
}

return l_state;
Expand Down