[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2023-09-12 13:03:02 +00:00
committed by WandererFan
parent a207d11fa4
commit e92ed45df9
435 changed files with 2669 additions and 2645 deletions

View File

@@ -38,7 +38,7 @@ public:
Module()
: Py::ExtensionModule<Module>("Spreadsheet")
{
initialize("This module is the Spreadsheet module.");// register with Python
initialize("This module is the Spreadsheet module."); // register with Python
}
private:
@@ -48,7 +48,7 @@ PyObject* initModule()
{
return Base::Interpreter().addModule(new Module);
}
}// namespace Spreadsheet
} // namespace Spreadsheet
/* Python entry */
PyMOD_INIT_FUNC(Spreadsheet)

View File

@@ -38,7 +38,7 @@ namespace Base
class Unit;
class XMLReader;
class Writer;
}// namespace Base
} // namespace Base
namespace Spreadsheet
{
@@ -211,6 +211,6 @@ private:
friend class PropertySheet;
};
}// namespace Spreadsheet
} // namespace Spreadsheet
#endif// CELL_H
#endif // CELL_H

View File

@@ -60,6 +60,6 @@ public:
}
};
}// namespace Spreadsheet
} // namespace Spreadsheet
#endif// DISPLAYUNIT_H
#endif // DISPLAYUNIT_H

View File

@@ -31,7 +31,7 @@
#pragma warning(disable : 4251)
#pragma warning(disable : 4275)
#pragma warning(disable : 4503)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#pragma warning(disable : 4786) // specifier longer then 255 chars
#endif
#ifdef _PreComp_
@@ -56,6 +56,6 @@
// Qt
#include <QLocale>
#endif//_PreComp_
#endif //_PreComp_
#endif// SPREADSHEET_PRECOMPILED_H
#endif // SPREADSHEET_PRECOMPILED_H

View File

@@ -112,14 +112,14 @@ void PropertyColumnWidths::Save(Base::Writer& writer) const
{
// Save column information
writer.Stream() << writer.ind() << "<ColumnInfo Count=\"" << size() << "\">" << std::endl;
writer.incInd();// indentation for 'ColumnInfo'
writer.incInd(); // indentation for 'ColumnInfo'
std::map<int, int>::const_iterator coli = begin();
while (coli != end()) {
writer.Stream() << writer.ind() << "<Column name=\"" << columnName(coli->first)
<< "\" width=\"" << coli->second << "\" />" << std::endl;
++coli;
}
writer.decInd();// indentation for 'ColumnInfo'
writer.decInd(); // indentation for 'ColumnInfo'
writer.Stream() << writer.ind() << "</ColumnInfo>" << std::endl;
}

View File

@@ -94,6 +94,6 @@ private:
Py::Object PythonObject;
};
}// namespace Spreadsheet
} // namespace Spreadsheet
#endif// PROPERTYCOLUMNWIDTHS_H
#endif // PROPERTYCOLUMNWIDTHS_H

View File

@@ -38,7 +38,8 @@ std::string PropertyColumnWidthsPy::representation() const
return {"<PropertyColumnWidths object>"};
}
PyObject* PropertyColumnWidthsPy::PyMake(struct _typeobject*, PyObject*, PyObject*)// Python wrapper
PyObject*
PropertyColumnWidthsPy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
{
// create a new instance of PropertyColumnWidthsPy and the Twin object
return new PropertyColumnWidthsPy(new PropertyColumnWidths);

View File

@@ -86,7 +86,7 @@ void PropertyRowHeights::Save(Base::Writer& writer) const
{
// Save row information
writer.Stream() << writer.ind() << "<RowInfo Count=\"" << size() << "\">" << std::endl;
writer.incInd();// indentation for 'RowInfo'
writer.incInd(); // indentation for 'RowInfo'
std::map<int, int>::const_iterator ri = begin();
while (ri != end()) {
@@ -94,7 +94,7 @@ void PropertyRowHeights::Save(Base::Writer& writer) const
<< ri->second << "\" />" << std::endl;
++ri;
}
writer.decInd();// indentation for 'RowInfo'
writer.decInd(); // indentation for 'RowInfo'
writer.Stream() << writer.ind() << "</RowInfo>" << std::endl;
}

View File

@@ -93,6 +93,6 @@ private:
Py::Object PythonObject;
};
}// namespace Spreadsheet
} // namespace Spreadsheet
#endif// PROPERTYROWHEIGHTS_H
#endif // PROPERTYROWHEIGHTS_H

View File

@@ -38,7 +38,7 @@ std::string PropertyRowHeightsPy::representation() const
return {"<PropertyRowHeights object>"};
}
PyObject* PropertyRowHeightsPy::PyMake(struct _typeobject*, PyObject*, PyObject*)// Python wrapper
PyObject* PropertyRowHeightsPy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
{
// create a new instance of PropertyRowHeightsPy and the Twin object
return new PropertyRowHeightsPy(new PropertyRowHeights);

View File

@@ -191,7 +191,7 @@ std::tuple<CellAddress, CellAddress> extractRange(const std::vector<CellAddress>
}
return std::make_tuple(firstRowAndColumn, lastRowAndColumn);
}
}// namespace
} // namespace
std::vector<CellAddress> PropertySheet::getUsedCells() const
{
@@ -328,11 +328,11 @@ void PropertySheet::Paste(const Property& from)
if (rows != r || cols != c) {
spanChanges.push_back(ifrom->first);
}
*cell = *(ifrom->second);// Exists; assign cell directly
*cell = *(ifrom->second); // Exists; assign cell directly
}
else {
cell = new Cell(this,
*(ifrom->second));// Doesn't exist, copy using Cell's copy constructor
*(ifrom->second)); // Doesn't exist, copy using Cell's copy constructor
if (cell->getSpans(rows, cols)) {
spanChanges.push_back(ifrom->first);
}
@@ -696,7 +696,7 @@ void PropertySheet::setAlignment(CellAddress address, int _alignment)
{
Cell* cell = nonNullCellAt(address);
assert(cell);
if (cell->address != address) {// Reject alignment change for merged cell except top-left one
if (cell->address != address) { // Reject alignment change for merged cell except top-left one
return;
}
cell->setAlignment(_alignment);
@@ -907,7 +907,7 @@ void PropertySheet::insertRows(int row, int count)
/* Sort them */
std::sort(keys.begin(),
keys.end(),
std::bind(&PropertySheet::rowSortFunc, this, sp::_1, sp::_2));// NOLINT
std::bind(&PropertySheet::rowSortFunc, this, sp::_1, sp::_2)); // NOLINT
MoveCellsExpressionVisitor<PropertySheet> visitor(*this,
CellAddress(row, CellAddress::MAX_COLUMNS),
@@ -1029,7 +1029,7 @@ void PropertySheet::removeRows(int row, int count)
}
if (key.row() >= row && key.row() < row + count) {
clear(key, false);// aliases were cleared earlier
clear(key, false); // aliases were cleared earlier
}
else if (key.row() >= row + count) {
moveCell(key, CellAddress(key.row() - count, key.col()), renames);
@@ -1148,7 +1148,7 @@ void PropertySheet::removeColumns(int col, int count)
/* Sort them */
std::sort(keys.begin(),
keys.end(),
std::bind(&PropertySheet::colSortFunc, this, sp::_1, sp::_2));// NOLINT
std::bind(&PropertySheet::colSortFunc, this, sp::_1, sp::_2)); // NOLINT
MoveCellsExpressionVisitor<PropertySheet> visitor(
*this,
@@ -1185,7 +1185,7 @@ void PropertySheet::removeColumns(int col, int count)
}
if (key.col() >= col && key.col() < col + count) {
clear(key, false);// aliases were cleared earlier
clear(key, false); // aliases were cleared earlier
}
else if (key.col() >= col + count) {
moveCell(key, CellAddress(key.row(), key.col() - count), renames);

View File

@@ -330,5 +330,5 @@ private:
bool restoring = false;
};
}// namespace Spreadsheet
#endif// PROPERTYSHEET_H
} // namespace Spreadsheet
#endif // PROPERTYSHEET_H

View File

@@ -38,7 +38,7 @@ std::string PropertySheetPy::representation() const
return {"<PropertySheet object>"};
}
PyObject* PropertySheetPy::PyMake(struct _typeobject*, PyObject*, PyObject*)// Python wrapper
PyObject* PropertySheetPy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
{
// create a new instance of PropertySheetPy and the Twin object
return new PropertySheetPy(new PropertySheet);

View File

@@ -53,15 +53,15 @@ using namespace Spreadsheet;
PROPERTY_SOURCE(Spreadsheet::Sheet, App::DocumentObject)
using DependencyList =
boost::adjacency_list<boost::vecS,// class OutEdgeListS : a Sequence or an AssociativeContainer
boost::vecS,// class VertexListS : a Sequence or a RandomAccessContainer
boost::directedS, // class DirectedS : This is a directed graph
boost::no_property,// class VertexProperty:
boost::no_property,// class EdgeProperty:
boost::no_property,// class GraphProperty:
boost::listS // class EdgeListS:
>;
using DependencyList = boost::adjacency_list<
boost::vecS, // class OutEdgeListS : a Sequence or an AssociativeContainer
boost::vecS, // class VertexListS : a Sequence or a RandomAccessContainer
boost::directedS, // class DirectedS : This is a directed graph
boost::no_property, // class VertexProperty:
boost::no_property, // class EdgeProperty:
boost::no_property, // class GraphProperty:
boost::listS // class EdgeListS:
>;
using Traits = boost::graph_traits<DependencyList>;
using Vertex = Traits::vertex_descriptor;
using Edge = Traits::edge_descriptor;
@@ -1120,7 +1120,7 @@ DocumentObjectExecReturn* Sheet::execute()
try {
boost::topological_sort(graph, std::front_inserter(make_order));
}
catch (std::exception&) {// TODO: evaluate using a more specific exception (not_a_dag)
catch (std::exception&) { // TODO: evaluate using a more specific exception (not_a_dag)
// Cycle detected; flag all with errors
Base::Console().Error("Cyclic dependency detected in spreadsheet : %s\n",
*pcNameInDocument);
@@ -1501,17 +1501,17 @@ void Sheet::setAlias(CellAddress address, const std::string& alias)
std::string existingAlias = getAddressFromAlias(alias);
if (!existingAlias.empty()) {
if (existingAlias == address.toString()) {// Same as old?
if (existingAlias == address.toString()) { // Same as old?
return;
}
else {
throw Base::ValueError("Alias already defined");
}
}
else if (alias.empty()) {// Empty?
else if (alias.empty()) { // Empty?
cells.setAlias(address, "");
}
else if (isValidAlias(alias)) {// Valid?
else if (isValidAlias(alias)) { // Valid?
cells.setAlias(address, alias);
}
else {
@@ -1795,4 +1795,4 @@ PyObject* Spreadsheet::SheetPython::getPyObject()
// explicit template instantiation
template class SpreadsheetExport FeaturePythonT<Spreadsheet::Sheet>;
}// namespace App
} // namespace App

View File

@@ -302,7 +302,7 @@ protected:
using SheetPython = App::FeaturePythonT<Sheet>;
}// namespace Spreadsheet
} // namespace Spreadsheet
#endif// Spreadsheet_Spreadsheet_H
#endif // Spreadsheet_Spreadsheet_H

View File

@@ -52,6 +52,6 @@ private:
PropertySheet* sheet;
};
}// namespace Spreadsheet
} // namespace Spreadsheet
#endif// SHEETOBSERVER_H
#endif // SHEETOBSERVER_H

View File

@@ -45,7 +45,7 @@ std::string SheetPy::representation() const
return {"<Sheet object>"};
}
PyObject* SheetPy::PyMake(struct _typeobject*, PyObject*, PyObject*)// Python wrapper
PyObject* SheetPy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
{
// create a new instance of SheetPy and the Twin object
return new SheetPy(new Sheet());

View File

@@ -43,6 +43,6 @@ createRectangles(std::set<std::pair<int, int>>& cells,
SpreadsheetExport std::string quote(const std::string& input);
SpreadsheetExport std::string unquote(const std::string& input);
}// namespace Spreadsheet
} // namespace Spreadsheet
#endif// UTILS_H
#endif // UTILS_H

View File

@@ -61,7 +61,7 @@ public:
: Py::ExtensionModule<Module>("SpreadsheetGui")
{
add_varargs_method("open", &Module::open);
initialize("This module is the SpreadsheetGui module.");// register with Python
initialize("This module is the SpreadsheetGui module."); // register with Python
}
private:
@@ -98,7 +98,7 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
/* Python entry */
PyMOD_INIT_FUNC(SpreadsheetGui)

View File

@@ -161,7 +161,7 @@ void DlgBindSheet::accept()
try {
const char* ref = ui->comboBox->itemData(ui->comboBox->currentIndex())
.toByteArray()
.constData();// clazy:exclude=returning-data-from-temporary
.constData(); // clazy:exclude=returning-data-from-temporary
auto obj = sheet;
if (ref[0]) {
const char* sep = strchr(ref, '#');

View File

@@ -55,6 +55,6 @@ private:
Ui::DlgBindSheet* ui;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// DLG_BINDSHEET_H
#endif // DLG_BINDSHEET_H

View File

@@ -53,6 +53,6 @@ private:
std::unique_ptr<Ui_DlgSettings> ui;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// SPREADSHEETGUI_DLGSETTINGSIMP_H
#endif // SPREADSHEETGUI_DLGSETTINGSIMP_H

View File

@@ -58,6 +58,6 @@ private:
Ui::DlgSheetConf* ui;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// DLG_SHEETCONF_H
#endif // DLG_SHEETCONF_H

View File

@@ -51,7 +51,7 @@ bool LineEdit::eventFilter(QObject* object, QEvent* event)
if (completerActive()) {
hideCompleter();
event->accept();
return true;// To make sure this tab press doesn't do anything else
return true; // To make sure this tab press doesn't do anything else
}
else {
lastKeyPressed = keyEvent->key();
@@ -59,7 +59,7 @@ bool LineEdit::eventFilter(QObject* object, QEvent* event)
}
}
}
return false;// We don't usually actually "handle" the tab event, we just keep track of it
return false; // We don't usually actually "handle" the tab event, we just keep track of it
}
bool LineEdit::event(QEvent* event)

View File

@@ -50,6 +50,6 @@ private:
Qt::KeyboardModifiers lastModifiers;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// LINEEDIT_H
#endif // LINEEDIT_H

View File

@@ -31,7 +31,7 @@
#pragma warning(disable : 4005)
#pragma warning(disable : 4251)
#pragma warning(disable : 4503)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#pragma warning(disable : 4786) // specifier longer then 255 chars
#endif
#ifdef _PreComp_
@@ -51,6 +51,6 @@
#include <Gui/QtAll.h>
#endif
#endif//_PreComp_
#endif //_PreComp_
#endif// SPREADSHEET_PRECOMPILED_H
#endif // SPREADSHEET_PRECOMPILED_H

View File

@@ -77,6 +77,6 @@ private:
bool aliasOk;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// PROPERTIESDIALOG_H
#endif // PROPERTIESDIALOG_H

View File

@@ -101,7 +101,7 @@ QVariant formatCellDisplay(QString value, const Cell* cell)
}
return QVariant(value);
}
}// namespace
} // namespace
QVariant SheetModel::data(const QModelIndex& index, int role) const
{
@@ -258,7 +258,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
case Qt::ForegroundRole: {
return QColor(0,
0,
255.0);// TODO: Remove this hardcoded color, replace with preference
255.0); // TODO: Remove this hardcoded color, replace with preference
}
case Qt::TextAlignmentRole: {
qtAlignment = Qt::AlignHCenter | Qt::AlignVCenter;

View File

@@ -67,6 +67,6 @@ private:
QColor negativeFgColor;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// SHEETMODEL_H
#endif // SHEETMODEL_H

View File

@@ -897,7 +897,7 @@ void SheetTableView::finishEditWithMove(int keyPressed,
case Qt::Key_Left:
if (targetColumn == 0) {
break;// Nothing to do, we're already in the first column
break; // Nothing to do, we're already in the first column
}
if (modifiers == Qt::NoModifier || modifiers == Qt::ShiftModifier) {
targetColumn--;
@@ -907,13 +907,14 @@ void SheetTableView::finishEditWithMove(int keyPressed,
scanForRegionBoundary(targetRow, targetColumn, 0, -1);
}
else {
targetColumn--;// Unrecognized modifier combination: default to just moving one cell
targetColumn--; // Unrecognized modifier combination: default to just moving one
// cell
}
tabCounter = 0;
break;
case Qt::Key_Right:
if (targetColumn >= this->model()->columnCount() - 1) {
break;// Nothing to do, we're already in the last column
break; // Nothing to do, we're already in the last column
}
if (modifiers == Qt::NoModifier || modifiers == Qt::ShiftModifier) {
targetColumn += colSpan;
@@ -924,13 +925,13 @@ void SheetTableView::finishEditWithMove(int keyPressed,
}
else {
targetColumn +=
colSpan;// Unrecognized modifier combination: default to just moving one cell
colSpan; // Unrecognized modifier combination: default to just moving one cell
}
tabCounter = 0;
break;
case Qt::Key_Up:
if (targetRow == 0) {
break;// Nothing to do, we're already in the first column
break; // Nothing to do, we're already in the first column
}
if (modifiers == Qt::NoModifier || modifiers == Qt::ShiftModifier) {
targetRow--;
@@ -940,13 +941,13 @@ void SheetTableView::finishEditWithMove(int keyPressed,
scanForRegionBoundary(targetRow, targetColumn, -1, 0);
}
else {
targetRow--;// Unrecognized modifier combination: default to just moving one cell
targetRow--; // Unrecognized modifier combination: default to just moving one cell
}
tabCounter = 0;
break;
case Qt::Key_Down:
if (targetRow >= this->model()->rowCount() - 1) {
break;// Nothing to do, we're already in the last row
break; // Nothing to do, we're already in the last row
}
if (modifiers == Qt::NoModifier || modifiers == Qt::ShiftModifier) {
targetRow += rowSpan;
@@ -957,7 +958,7 @@ void SheetTableView::finishEditWithMove(int keyPressed,
}
else {
targetRow +=
rowSpan;// Unrecognized modifier combination: default to just moving one cell
rowSpan; // Unrecognized modifier combination: default to just moving one cell
}
tabCounter = 0;
break;

View File

@@ -128,6 +128,6 @@ protected:
std::set<App::CellAddress> spanChanges;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// SHEETTABLEVIEW_H
#endif // SHEETTABLEVIEW_H

View File

@@ -87,4 +87,4 @@ QAccessibleInterface* SheetTableViewAccessibleInterface::ifactory(const QString&
}
return nullptr;
}
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui

View File

@@ -54,6 +54,6 @@ public:
static QAccessibleInterface* ifactory(const QString& key, QObject* obj);
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// SHEETTABLEVIEW_INTERFACE_H
#endif // SHEETTABLEVIEW_INTERFACE_H

View File

@@ -63,6 +63,6 @@ private:
Spreadsheet::Sheet* sheet;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// SPREADSHEETDELEGATE_H
#endif // SPREADSHEETDELEGATE_H

View File

@@ -470,10 +470,10 @@ void SheetView::aliasChanged(const QString& text)
static auto originalStylesheet = ui->cellAlias->styleSheet();
QString warningColor;
if (qApp->styleSheet().contains(QLatin1String("dark"), Qt::CaseInsensitive)) {
warningColor = QLatin1String("rgb(255,90,90)");// Light red for dark mode
warningColor = QLatin1String("rgb(255,90,90)"); // Light red for dark mode
}
else {
warningColor = QLatin1String("rgb(200,0,0)");// Dark red for light mode
warningColor = QLatin1String("rgb(200,0,0)"); // Dark red for light mode
}
if (!text.isEmpty() && !sheet->isValidAlias(Base::Tools::toStdString(text))) {

View File

@@ -42,7 +42,7 @@ namespace App
{
class DocumentObject;
class Property;
}// namespace App
} // namespace App
namespace Ui
{
@@ -167,6 +167,6 @@ protected:
Gui::MDIViewPy base;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// SpreadsheetView_H
#endif // SpreadsheetView_H

View File

@@ -177,4 +177,4 @@ PROPERTY_SOURCE_TEMPLATE(SpreadsheetGui::ViewProviderSheetPython, SpreadsheetGui
// explicit template instantiation
template class SpreadsheetGuiExport ViewProviderPythonFeatureT<ViewProviderSheet>;
}// namespace Gui
} // namespace Gui

View File

@@ -94,7 +94,7 @@ private:
using ViewProviderSheetPython = Gui::ViewProviderPythonFeatureT<ViewProviderSheet>;
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// SPREADSHEET_ViewProviderSpreadsheet_H
#endif // SPREADSHEET_ViewProviderSpreadsheet_H

View File

@@ -46,7 +46,7 @@ using namespace App;
using namespace SpreadsheetGui;
using namespace Spreadsheet;
#if 0// needed for Qt's lupdate utility
#if 0 // needed for Qt's lupdate utility
qApp->translate("Workbench", "Spreadsheet");
qApp->translate("Workbench", "&Spreadsheet");
qApp->translate("Workbench", "&Alignment");

View File

@@ -66,7 +66,7 @@ protected:
Gui::ToolBarItem* setupCommandBars() const override;
};
}// namespace SpreadsheetGui
} // namespace SpreadsheetGui
#endif// SPREADSHEET_WORKBENCH_H
#endif // SPREADSHEET_WORKBENCH_H

View File

@@ -44,4 +44,4 @@
#endif
#endif
#endif// SPREADSHEET_GLOBAL_H
#endif // SPREADSHEET_GLOBAL_H