LGTM: [skip ci] fix: Empty branch of conditional

An empty block after a conditional can be a sign of an omission and can decrease maintainability of the code.
Such blocks should contain an explanatory comment to aid future maintainers.
This commit is contained in:
wmayer
2020-07-26 15:49:14 +02:00
parent 8dac7e4666
commit dc65b055e5
11 changed files with 36 additions and 18 deletions

View File

@@ -332,7 +332,7 @@ PyObject* DocumentPy::importLinks(PyObject *args)
return NULL; // NULL triggers exception
std::vector<App::DocumentObject*> objs;
if(PySequence_Check(obj)) {
if (PySequence_Check(obj)) {
Py::Sequence seq(obj);
for(size_t i=0;i<seq.size();++i) {
if(!PyObject_TypeCheck(seq[i].ptr(),&DocumentObjectPy::Type)) {
@@ -341,13 +341,18 @@ PyObject* DocumentPy::importLinks(PyObject *args)
}
objs.push_back(static_cast<DocumentObjectPy*>(seq[i].ptr())->getDocumentObjectPtr());
}
}else if(obj == Py_None) {
}else if(!PyObject_TypeCheck(obj,&DocumentObjectPy::Type)) {
}
else if(obj == Py_None) {
// do nothing here
}
else if(!PyObject_TypeCheck(obj,&DocumentObjectPy::Type)) {
PyErr_SetString(PyExc_TypeError,
"Expect first argument to be either a document object or sequence of document objects");
return 0;
}else
}
else {
objs.push_back(static_cast<DocumentObjectPy*>(obj)->getDocumentObjectPtr());
}
if(objs.empty())
objs = getDocumentPtr()->getObjects();

View File

@@ -900,8 +900,6 @@ void DlgCustomToolbarsImp::moveDownCustomCommand(const QString& name, const QByt
void DlgCustomToolbarsImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
}
DlgCustomToolbars::changeEvent(e);
}

View File

@@ -739,6 +739,7 @@ void NavigationStyle::zoom(SoCamera * cam, float diffvalue)
// sqrt(FLT_MAX) == ~ 1e+19, which should be both safe for further
// calculations and ok for the end-user and app-programmer.
if (distorigo > float(sqrt(FLT_MAX))) {
// do nothing here
}
else {
cam->position = newpos;

View File

@@ -213,6 +213,7 @@ void SoFCColorBar::eventCallback(void * /*userdata*/, SoEventCallback * node)
const SoMouseButtonEvent* e = static_cast<const SoMouseButtonEvent*>(event);
if ((e->getButton() == SoMouseButtonEvent::BUTTON2)) {
if (e->getState() == SoButtonEvent::UP) {
// do nothing here
}
}
}

View File

@@ -3555,6 +3555,7 @@ void View3DInventorViewer::selectCB(void* viewer, SoPath* path)
{
ViewProvider* vp = static_cast<View3DInventorViewer*>(viewer)->getViewProviderByPath(path);
if (vp && vp->useNewSelectionModel()) {
// do nothing here
}
}
@@ -3562,6 +3563,7 @@ void View3DInventorViewer::deselectCB(void* viewer, SoPath* path)
{
ViewProvider* vp = static_cast<View3DInventorViewer*>(viewer)->getViewProviderByPath(path);
if (vp && vp->useNewSelectionModel()) {
// do nothing here
}
}

View File

@@ -686,9 +686,7 @@ void MeshFillHole::fileHoleCallback(void * ud, SoEventCallback * n)
else if (ev->getTypeId() == SoMouseButtonEvent::getClassTypeId()) {
n->setHandled();
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent *>(ev);
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
}
else if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::UP) {
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::UP) {
if (self->myNumPoints > 1)
return;
SoRayPickAction rp(view->getSoRenderManager()->getViewportRegion());

View File

@@ -978,6 +978,7 @@ bool ViewProviderPartExt::setEdit(int ModNum)
void ViewProviderPartExt::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Color) {
// Do nothing here
}
else {
Gui::ViewProviderGeometryObject::unsetEdit(ModNum);

View File

@@ -953,6 +953,7 @@ bool ProfileBased::isEqualGeometry(const TopoDS_Shape& s1, const TopoDS_Shape& s
}
}
else if (s1.ShapeType() == TopAbs_EDGE && s2.ShapeType() == TopAbs_EDGE) {
// Do nothing here
}
else if (s1.ShapeType() == TopAbs_VERTEX && s2.ShapeType() == TopAbs_VERTEX) {
gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(s1));

View File

@@ -114,6 +114,7 @@ bool ViewProviderLux::setEdit(int ModNum)
void ViewProviderLux::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default) {
// Do nothing here
}
else {
ViewProviderDocumentObjectGroup::unsetEdit(ModNum);
@@ -192,6 +193,7 @@ bool ViewProviderPovray::setEdit(int ModNum)
void ViewProviderPovray::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default) {
// Do nothing here
}
else {
ViewProviderDocumentObjectGroup::unsetEdit(ModNum);

View File

@@ -2572,15 +2572,18 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
solve();
return 0;
} else
} else {
return -1;
}
} else if (theta1 < 0.001*arcLength) { // drop the second intersection point
std::swap(GeoId1,GeoId2);
std::swap(point1,point2);
} else if (theta2 > 0.999*arcLength) {
// Do nothing here
}
else
else {
return -1;
}
}
if (GeoId1 >= 0) {
@@ -2749,14 +2752,17 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
solve();
return 0;
} else
} else {
return -1;
}
} else if (theta1 < 0.001*arcLength) { // drop the second intersection point
std::swap(GeoId1,GeoId2);
std::swap(point1,point2);
} else if (theta2 > 0.999*arcLength) {
} else
// Do nothing here
} else {
return -1;
}
}
if (GeoId1 >= 0) {
@@ -2927,14 +2933,17 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
delete newConstr;
return 0;
} else
} else {
return -1;
}
} else if (theta1 < 0.001*arcLength) { // drop the second intersection point
std::swap(GeoId1,GeoId2);
std::swap(point1,point2);
} else if (theta2 > 0.999*arcLength) {
} else
// Do nothing here
} else {
return -1;
}
}
if (GeoId1 >= 0) {

View File

@@ -67,9 +67,9 @@ TaskSketcherCreateCommands::~TaskSketcherCreateCommands()
void TaskSketcherCreateCommands::changeEvent(QEvent *e)
{
TaskBox::changeEvent(e);
if (e->type() == QEvent::LanguageChange) {
//ui->retranslateUi(proxy);
}
//if (e->type() == QEvent::LanguageChange) {
// ui->retranslateUi(proxy);
//}
}
/// @cond DOXERR