Add a code of conduct to qelectrotech project
why, to avoid different coding styles in the same program.
Tab = 8 spaces
/**
Gere les relachements de la souris sur ce widget
@param event Evenement decrivant le relachement de la souris
*/
void QTextOrientationWidget::mouseReleaseEvent(QMouseEvent *event) {
if (read_only_) return;
double clicked_angle;
bool drawn_angle_clicked = positionIsASquare(event -> localPos(), &clicked_angle);
if (drawn_angle_clicked) {
setOrientation(clicked_angle);
emit(orientationChanged(clicked_angle));
must_highlight_angle_ = false;
update();
}
}
vs
Tab = 4 spaces
/**
* @brief NumerotationContext::addValue, add a new value on the contexte
* @param type the type of value
* @param value the value itself
* @param increase the increase number of value
* @return true if value is append
*/
bool NumerotationContext::addValue(const QString &type, const QVariant &value, const int increase, const int initialvalue) {
if (!keyIsAcceptable(type) && !value.canConvert(QVariant::String)) return false;
if (keyIsNumber(type) && !value.canConvert(QVariant::Int)) return false;
QString valuestr = value.toString();
valuestr.remove("|");
content_ << type + "|" + valuestr + "|" + QString::number(increase) + "|" + QString::number(initialvalue);
return true;
}
problem:
developer A Tab = 8 spaces
developer B Tab = 4 spaces
developer B had written the function.
developer A adds "setIdentifier(element.firstChildElement("identifier").text());"
the code works, but the compiler complains
Wmisleading-indentation
is misleadingly indented as if it were guarded by the ‘if’
@@ -274,7 +274,7 @@ void ProjectDBModel::fromXml(const QDomElement &element)
if (element.tagName() != xmlTagName())
return;
- setIdentifier(element.firstChildElement("identifier").text());
+ setIdentifier(element.firstChildElement("identifier").text());
setQuery(element.firstChildElement("query").text());
//Index 0,0
can consensus be reached on this?
Tab = 8 spaces vs 4 spaces
What do we take as standard,
and then we can start equalize the code Style.