Skip to content
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
24 changes: 15 additions & 9 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# altera-struct-pack-align: does not affect the code for non FPGA targets -- gets interesting for OpenCL kernels
# boost-use-ranges: we do not want to use boost at all, to not increase our dependencies even more!!!
# bugprone-suspicious-include: flags more or less only false positives
# fuchsia-default-arguments-calls: there is a second check that disallows default arguments in function definitions, which is more important to us than this check (this for example triggers for simple std::vector constructors)
# fuchsia-overloaded-operator: we actually WANT to overload operators, so this check is not useful for us
# fuchsia-trailing-return: we actually WANT to use trailing return types, very useful for template functions, so this check is not useful for us

# Checks to be absolutely enabled:
# cert-env33-c: ::system is not available on all platforms, and we do not want to use it anyway
Expand All @@ -14,6 +17,9 @@
# cppcoreguidelines-pro-type-union-access: should be possible to avoid this warning for Vector3D, but needs a rework of the code base
# cppcoreguidelines-pro-type-member-init: needs a rework of the code base, but should be possible to fix it for all classes
# cppcoreguidelines-owning-memory: needs a rework of the code base, but should be possible to fix it for all classes
# fuchsia-statically-constructed-objects: needs a rework of the global const maps like atomMassMap, atomNumberMap, hubbardDerivMap3ob, etc. to avoid this warning
# fuchsia-virtual-inheritance: needs a huge rework of the engine code base, but should be possible to fix it for all classes
# fuchsia-multiple-inheritance: needs a huge rework of the engine code base, but should be possible to fix it for all classes
---
Checks:
'
Expand All @@ -26,6 +32,7 @@ Checks:
concurrency*,
cppcoreguidelines*,
darwin*,
fuchsia*,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-pro-type-union-access,
Expand All @@ -35,9 +42,16 @@ Checks:
-bugprone-easily-swappable-parameters,
-cert-env33-c,
-cert-err58-cpp,
-fuchsia-statically-constructed-objects,
-fuchsia-virtual-inheritance,
-fuchsia-multiple-inheritance,
-altera-struct-pack-align,
-altera-unroll-loops,
-bugprone-suspicious-include
-boost-use-ranges,
-bugprone-suspicious-include,
-fuchsia-default-arguments-calls,
-fuchsia-overloaded-operator,
-fuchsia-trailing-return,
'
WarningsAsErrors: ''
HeaderFileExtensions:
Expand Down Expand Up @@ -91,14 +105,6 @@ CheckOptions:
...

### TO BE INCLUDED IN THE FUTURE
# fuchsia-default-arguments-calls,
# fuchsia-default-arguments-declarations,
# fuchsia-header-anon-namespaces,
# fuchsia-multiple-inheritance,
# fuchsia-overloaded-operator,
# fuchsia-statically-constructed-objects,
# fuchsia-trailing-return,
# fuchsia-virtual-inheritance,
# google-build-explicit-make-pair,
# google-build-namespaces,
# google-build-using-namespace,
Expand Down
11 changes: 10 additions & 1 deletion apps/capabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace
cli::JsonWriter &json,
const std::string_view name,
const std::string_view type,
const std::string_view unit = ""
const std::string_view unit
)
{
json.beginObject(name);
Expand All @@ -71,6 +71,15 @@ namespace
json.value("unit", unit);
}

void beginParameter(
cli::JsonWriter &json,
const std::string_view name,
const std::string_view type
)
{
beginParameter(json, name, type, "");
}

void writeBuildCapabilities(cli::JsonWriter &json)
{
json.beginObject("build");
Expand Down
5 changes: 5 additions & 0 deletions apps/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ namespace
}
} // namespace

cli::ValidationResult cli::validateInputFile(std::string_view inputFile)
{
return validateInputFile(inputFile, ValidationScope::INSTALLED);
}

cli::ValidationResult cli::validateInputFile(
const std::string_view inputFile,
const ValidationScope scope
Expand Down
6 changes: 5 additions & 1 deletion apps/validation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ namespace cli

[[nodiscard]] ValidationResult validateInputFile(
std::string_view inputFile,
ValidationScope scope = ValidationScope::INSTALLED
ValidationScope scope
);

[[nodiscard]] ValidationResult validateInputFile(
std::string_view inputFile
);

void writeValidationJson(
Expand Down
8 changes: 6 additions & 2 deletions benchmarks/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
InheritParentConfig: true
Checks: >
-cppcoreguidelines-avoid-magic-numbers
Checks:
'
-cppcoreguidelines-avoid-magic-numbers,
-fuchsia-statically-constructed-objects,
-cert-err58-cpp
'
2 changes: 0 additions & 2 deletions benchmarks/src/box/benchmarkBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ namespace
}
}

// NOLINTBEGIN(cert-err58-cpp)
BENCHMARK(BM_OrthorhombicShiftVector);
BENCHMARK(BM_TriclinicShiftVector);
BENCHMARK(BM_OrthorhombicWrapPosition);
Expand All @@ -166,6 +165,5 @@ namespace
BENCHMARK(BM_TriclinicToOrthoSpace);
BENCHMARK(BM_TriclinicToSimSpace);
BENCHMARK(BM_TriclinicTensorRoundTrip);
// NOLINTEND(cert-err58-cpp)

} // namespace
2 changes: 0 additions & 2 deletions benchmarks/src/math/benchmarkLinearAlgebra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ namespace
}
}

// NOLINTBEGIN(cert-err58-cpp)
BENCHMARK(BM_VectorArithmetic);
BENCHMARK(BM_DotProduct);
BENCHMARK(BM_CrossProduct);
Expand All @@ -195,5 +194,4 @@ namespace
BENCHMARK(BM_MatrixProduct);
BENCHMARK(BM_MatrixTranspose);
BENCHMARK(BM_MatrixDeterminant);
// NOLINTEND(cert-err58-cpp)
} // namespace
2 changes: 0 additions & 2 deletions benchmarks/src/potential/benchmarkPairPotentials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ namespace
runCoulombBenchmark(state, potential);
}

// NOLINTBEGIN(cert-err58-cpp)
BENCHMARK(BM_LennardJones)
->ArgName("distance_milliangstrom")
->Arg(1500)
Expand Down Expand Up @@ -132,5 +131,4 @@ namespace
->Arg(1500)
->Arg(3000)
->Arg(6000);
// NOLINTEND(cert-err58-cpp)
} // namespace
2 changes: 0 additions & 2 deletions benchmarks/src/simulationBox/benchmarkKinetics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ namespace
setItemsProcessed(state, simBox);
}

// NOLINTBEGIN(cert-err58-cpp)
BENCHMARK(BM_Temperature)
->ArgName("cells_per_side")
->Arg(5)
Expand All @@ -116,5 +115,4 @@ namespace
->Arg(5)
->Arg(8)
->Arg(12);
// NOLINTEND(cert-err58-cpp)
} // namespace
1 change: 1 addition & 0 deletions changes/developer/internal.clangd.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- fix a lot of more small clang-tidy warnings (larger one will be handled in separate PRs)
- address all cppcoreguidline clang-tidy checks and all darwin checks
- add most important fuchsia clang-tidy warnings (especially no default arguments)
10 changes: 5 additions & 5 deletions include/QM/external/externalQMRunner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ namespace QM
class ExternalQMRunner : public QMRunner
{
protected:
std::string _scriptPath = SCRIPT_PATH_;
const static inline std::string _singularity = SINGULARITY_;
const static inline std::string _staticBuild = STATIC_BUILD_;
std::string _scriptPath = SCRIPT_PATH_;
constexpr static auto *_singularity = SINGULARITY_;
constexpr static auto *_staticBuild = STATIC_BUILD_;

[[nodiscard]] std::string resolveScriptPath(
std::string_view script
Expand Down Expand Up @@ -91,8 +91,8 @@ namespace QM
*******************************/

[[nodiscard]] const std::string &getScriptPath() const;
[[nodiscard]] const std::string &getSingularity() const;
[[nodiscard]] const std::string &getStaticBuild() const;
[[nodiscard]] std::string getSingularity() const;
[[nodiscard]] std::string getStaticBuild() const;

void setScriptPath(const std::string_view &scriptPath);
};
Expand Down
2 changes: 1 addition & 1 deletion include/config/atomMassMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ namespace constants

} // namespace constants

#endif // _ATOM_MASS_MAP_HPP_
#endif // _ATOM_MASS_MAP_HPP_
2 changes: 1 addition & 1 deletion include/config/atomNumberMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ namespace constants

} // namespace constants

#endif // _ATOM_NUMBER_MAP_HPP_
#endif // _ATOM_NUMBER_MAP_HPP_
3 changes: 2 additions & 1 deletion include/exceptions/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ namespace customException
public:
explicit CustomException(
const std::string_view message,
std::optional<size_t> lineNumber = std::nullopt
std::optional<size_t> lineNumber
);
explicit CustomException(const std::string_view message);

void colorfulOutput(const Color::Code, const std::string_view) const;
void setLineNumber(const size_t lineNumber) noexcept;
Expand Down
6 changes: 2 additions & 4 deletions include/input/inputFileParser/QMInputParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ namespace input
bool _resolveBuiltInSlakosPath;

public:
explicit QMInputParser(
engine::Engine &,
bool resolveBuiltInSlakosPath = true
);
explicit QMInputParser(engine::Engine &, bool resolveBuiltInSlakosPath);
explicit QMInputParser(engine::Engine &);

void parseQMMethod(const std::vector<std::string> &, const size_t);
void parseQMScript(const std::vector<std::string> &, const size_t);
Expand Down
6 changes: 2 additions & 4 deletions include/input/inputFileParser/filesInputParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ namespace input
bool _validateFilePaths;

public:
explicit FilesInputParser(
engine::Engine &,
bool validateFilePaths = true
);
explicit FilesInputParser(engine::Engine &, bool validateFilePaths);
explicit FilesInputParser(engine::Engine &);

void parseIntraNonBondedFile(
const std::vector<std::string> &,
Expand Down
5 changes: 3 additions & 2 deletions include/input/inputFileReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ namespace input
explicit InputFileReader(
const std::string_view &,
engine::Engine &,
bool validateFilePaths = true,
bool resolveBuiltInSlakosPath = true
bool validateFilePaths,
bool resolveBuiltInSlakosPath
);
explicit InputFileReader(const std::string_view &, engine::Engine &);

void read();
void addKeywords();
Expand Down
3 changes: 2 additions & 1 deletion include/settings/qmSettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ namespace settings
static void setSlakosType(const std::string_view &slakos);
static void setSlakosType(
const SlakosType slakos,
bool resolveBuiltInPath = true
bool resolveBuiltInPath
);
static void setSlakosType(const SlakosType slakos);
static void setSlakosPath(const std::string_view &path);

static void setUseDispersionCorrection(const bool use);
Expand Down
14 changes: 4 additions & 10 deletions src/QM/external/externalQMRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,22 +279,16 @@ const std::string &ExternalQMRunner::getScriptPath() const
/**
* @brief getter for the singularity path
*
* @return const std::string&
* @return std::string
*/
const std::string &ExternalQMRunner::getSingularity() const
{
return _singularity;
}
std::string ExternalQMRunner::getSingularity() const { return _singularity; }

/**
* @brief getter for the static build path
*
* @return const std::string&
* @return std::string
*/
const std::string &ExternalQMRunner::getStaticBuild() const
{
return _staticBuild;
}
std::string ExternalQMRunner::getStaticBuild() const { return _staticBuild; }

/**
* @brief setter for the script path
Expand Down
10 changes: 10 additions & 0 deletions src/exceptions/exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ CustomException::CustomException(
{
}

/**
* @brief Construct a new Custom Exception:: Custom Exception object
*
* @param message
*/
CustomException::CustomException(const std::string_view message)
: CustomException(message, std::nullopt)
{
}

/**
* @brief Adds a source line if the exception has no line yet.
*
Expand Down
14 changes: 14 additions & 0 deletions src/input/inputFileParser/QMInputParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ using namespace engine;
using namespace references;
using namespace constants;

/**
* @brief Construct a new QMInputParser:: QMInputParser object
*
* @details following keywords are added to the _keywordFuncMap,
* _keywordRequiredMap and _keywordCountMap: 1) qm_prog <string> 2) qm_script
* <string>
*
* @param engine
*/
QMInputParser::QMInputParser(engine::Engine &engine)
: QMInputParser(engine, true)
{
}

/**
* @brief Construct a new QMInputParser:: QMInputParser object
*
Expand Down
18 changes: 18 additions & 0 deletions src/input/inputFileParser/filesInputParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ using namespace customException;
using namespace settings;
using namespace utilities;

/**
* @brief Construct a new Input File Parser Non Coulomb Type:: Input File Parser
* Non Coulomb Type object
*
* @details following keywords are added to the _keywordFuncMap,
* _keywordRequiredMap and _keywordCountMap: 1) intra-nonBonded_file <string> 2)
* topology_file <string> 3) parameter_file <string> 4) start_file <string>
* (required) 5) rpmd_start_file <string> 6) moldescriptor_file <string>
* 7) guff_path <string> (deprecated) 8) guff_file <string>
* 9) mshake_file <string> 10) dftb_file <string> 11) turbomole_file <string>
*
* @param engine
*/
FilesInputParser::FilesInputParser(Engine &engine)
: FilesInputParser(engine, true)
{
}

/**
* @brief Construct a new Input File Parser Non Coulomb Type:: Input File Parser
* Non Coulomb Type object
Expand Down
18 changes: 18 additions & 0 deletions src/input/inputFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ using namespace utilities;
using namespace customException;
using std::make_unique;

/**
* @brief Construct a new Input File Reader:: Input File Reader object
*
* @details adds all parsers to the _parsers vector and calls addKeywords() to
* add all keywords to the _keywordFuncMap, _keywordRequiredMap and
* _keywordCountMap
*
* @param fileName
* @param engine
*/
InputFileReader::InputFileReader(
const std::string_view &fileName,
engine::Engine &engine
)
: InputFileReader(fileName, engine, true, true)
{
}

/**
* @brief Construct a new Input File Reader:: Input File Reader object
*
Expand Down
Loading
Loading