mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-18 02:49:03 -06:00
Cleanup for coding style
Add strict mode to check_style_guide script
This commit is contained in:
@@ -77,7 +77,7 @@ void registerCoreClasses(scripting::ScriptEngine& engine) {
|
||||
engine.addLibrary(scripting::ScriptScheduler::luaLibrary());
|
||||
engine.addLibrary(WindowWrapper::luaLibrary());
|
||||
engine.addLibrary(MissionManager::luaLibrary());
|
||||
|
||||
|
||||
engine.addLibrary(scripting::generalSystemCapabilities());
|
||||
engine.addLibrary(scripting::openglSystemCapabilities());
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ std::string to_string(openspace::documentation::TestResult::Offense::Reason reas
|
||||
throw ghoul::MissingCaseException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string to_string(openspace::documentation::TestResult::Warning::Reason reason) {
|
||||
switch (reason) {
|
||||
case openspace::documentation::TestResult::Warning::Reason::Deprecated:
|
||||
@@ -106,7 +106,7 @@ SpecificationError::SpecificationError(TestResult res, std::string comp)
|
||||
, result(std::move(res))
|
||||
{
|
||||
ghoul_assert(!result.success, "Result's success must be false");
|
||||
|
||||
|
||||
message += " (";
|
||||
for (const TestResult::Offense& o : result.offenses) {
|
||||
message += o.offender + ',';
|
||||
|
||||
@@ -60,7 +60,7 @@ DocumentationGenerator::DocumentationGenerator(std::string name,
|
||||
}
|
||||
ghoul_precondition(!_javascriptFile.empty(), "javascriptFilename must not be empty");
|
||||
}
|
||||
|
||||
|
||||
void DocumentationGenerator::writeDocumentation(const std::string& filename) {
|
||||
std::ifstream handlebarsInput;
|
||||
handlebarsInput.exceptions(~std::ofstream::goodbit);
|
||||
@@ -97,19 +97,19 @@ void DocumentationGenerator::writeDocumentation(const std::string& filename) {
|
||||
std::ofstream file;
|
||||
file.exceptions(~std::ofstream::goodbit);
|
||||
file.open(filename);
|
||||
|
||||
|
||||
std::string json = generateJson();
|
||||
// We probably should escape backslashes here?
|
||||
|
||||
|
||||
file << "<!DOCTYPE html>" << '\n'
|
||||
<< "<html>" << '\n'
|
||||
<< "\t" << "<head>" << '\n';
|
||||
|
||||
|
||||
for (const HandlebarTemplate& t : _handlebarTemplates) {
|
||||
const char* Type = "text/x-handlebars-template";
|
||||
file << "\t\t"
|
||||
<< "<script id=\"" << t.name << "\" type=\"" << Type << "\">" << '\n';
|
||||
|
||||
|
||||
std::ifstream templateFilename(absPath(t.filename));
|
||||
std::string templateContent(
|
||||
std::istreambuf_iterator<char>{templateFilename},
|
||||
@@ -119,14 +119,14 @@ void DocumentationGenerator::writeDocumentation(const std::string& filename) {
|
||||
file << "\t"
|
||||
<< "</script>" << '\n';
|
||||
}
|
||||
|
||||
|
||||
const std::string Version =
|
||||
"[" +
|
||||
std::to_string(OPENSPACE_VERSION_MAJOR) + "," +
|
||||
std::to_string(OPENSPACE_VERSION_MINOR) + "," +
|
||||
std::to_string(OPENSPACE_VERSION_PATCH) +
|
||||
"]";
|
||||
|
||||
|
||||
file
|
||||
<< "\t" << "<script>" << '\n'
|
||||
<< "\t\t" << "var " << _jsonName << " = JSON.parse('" << json << "');" << '\n'
|
||||
@@ -144,7 +144,7 @@ void DocumentationGenerator::writeDocumentation(const std::string& filename) {
|
||||
<< "\t" << "</body>" << '\n'
|
||||
<< "</html>" << '\n';
|
||||
}
|
||||
|
||||
|
||||
std::string escapedJson(const std::string& text) {
|
||||
std::string jsonString = "";
|
||||
for (const char& c : text) {
|
||||
@@ -170,9 +170,7 @@ std::string escapedJson(const std::string& text) {
|
||||
jsonString += c;
|
||||
}
|
||||
}
|
||||
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user