mirror of
https://github.com/kuhyx/engineer-thesis-WUT.git
synced 2026-11-28 03:49:12 +01:00
feat: set up the most restrictive clang tidy settings
This commit is contained in:
parent
b2e5e1a356
commit
140fbbc4a1
48
.clang-tidy
48
.clang-tidy
@ -1,28 +1,38 @@
|
|||||||
---
|
---
|
||||||
Checks: 'clang-diagnostic-*,clang-analyzer-*'
|
Checks: '*'
|
||||||
WarningsAsErrors: ''
|
WarningsAsErrors: ''
|
||||||
HeaderFilterRegex: ''
|
HeaderFilterRegex: ''
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
FormatStyle: none
|
FormatStyle: none
|
||||||
User: kuchy
|
User: kuchy
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
llvm-else-after-return.WarnOnConditionVariables: 'false'
|
- key: cert-dcl16-c.NewSuffixes
|
||||||
modernize-loop-convert.MinConfidence: reasonable
|
value: 'L;LL;LU;LLU'
|
||||||
modernize-replace-auto-ptr.IncludeStyle: llvm
|
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||||
modernize-pass-by-value.IncludeStyle: llvm
|
value: '0'
|
||||||
google-readability-namespace-comments.ShortNamespaceLines: '10'
|
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
|
||||||
google-readability-namespace-comments.SpacesBeforeComments: '2'
|
value: '1'
|
||||||
cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true'
|
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||||
google-readability-braces-around-statements.ShortStatementLines: '1'
|
value: '1'
|
||||||
cert-err33-c.CheckedFunctions: '::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;'
|
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||||
modernize-loop-convert.MaxCopySize: '16'
|
value: '1'
|
||||||
cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU'
|
- key: google-readability-function-size.LineThreshold
|
||||||
cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
|
value: '16'
|
||||||
cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
|
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||||
modernize-use-nullptr.NullMacros: 'NULL'
|
value: '10'
|
||||||
llvm-qualified-auto.AddConstToQualified: 'false'
|
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||||
modernize-loop-convert.NamingStyle: CamelCase
|
value: '2'
|
||||||
llvm-else-after-return.WarnOnUnfixable: 'false'
|
- key: modernize-loop-convert.MaxCopySize
|
||||||
google-readability-function-size.StatementThreshold: '800'
|
value: '16'
|
||||||
|
- key: modernize-loop-convert.MinConfidence
|
||||||
|
value: reasonable
|
||||||
|
- key: modernize-loop-convert.NamingStyle
|
||||||
|
value: CamelCase
|
||||||
|
- key: modernize-pass-by-value.IncludeStyle
|
||||||
|
value: llvm
|
||||||
|
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||||
|
value: llvm
|
||||||
|
- key: modernize-use-nullptr.NullMacros
|
||||||
|
value: 'NULL'
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|||||||
@ -23,8 +23,7 @@ const unsigned int SCREEN_HEIGHT = 600;
|
|||||||
|
|
||||||
Game Breakout(SCREEN_WIDTH, SCREEN_HEIGHT);
|
Game Breakout(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[]) {
|
||||||
{
|
|
||||||
glfwInit();
|
glfwInit();
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
@ -110,8 +109,7 @@ int scancode, int action, int mode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
|
||||||
{
|
|
||||||
// make sure the viewport matches the new window dimensions;
|
// make sure the viewport matches the new window dimensions;
|
||||||
// note that width and
|
// note that width and
|
||||||
// height will be significantly larger than specified on retina displays.
|
// height will be significantly larger than specified on retina displays.
|
||||||
|
|||||||
@ -7,15 +7,10 @@
|
|||||||
#include "../dependencies/include/glad/glad.h"
|
#include "../dependencies/include/glad/glad.h"
|
||||||
|
|
||||||
// Represents the current state of the game
|
// Represents the current state of the game
|
||||||
enum GameState {
|
enum GameState { GAME_ACTIVE, GAME_MENU, GAME_WIN };
|
||||||
GAME_ACTIVE,
|
|
||||||
GAME_MENU,
|
|
||||||
GAME_WIN
|
|
||||||
};
|
|
||||||
|
|
||||||
class Game
|
class Game {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
// game state
|
// game state
|
||||||
GameState State;
|
GameState State;
|
||||||
bool Keys[1024];
|
bool Keys[1024];
|
||||||
|
|||||||
@ -5,15 +5,13 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
Shader &Shader::Use()
|
Shader &Shader::Use() {
|
||||||
{
|
|
||||||
glUseProgram(this->ID);
|
glUseProgram(this->ID);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shader::Compile(const char* vertexSource,
|
void Shader::Compile(const char *vertexSource, const char *fragmentSource,
|
||||||
const char* fragmentSource,
|
const char *geometrySource) {
|
||||||
const char* geometrySource) {
|
|
||||||
unsigned int sVertex, sFragment, gShader;
|
unsigned int sVertex, sFragment, gShader;
|
||||||
// vertex Shader
|
// vertex Shader
|
||||||
sVertex = glCreateShader(GL_VERTEX_SHADER);
|
sVertex = glCreateShader(GL_VERTEX_SHADER);
|
||||||
@ -63,63 +61,45 @@ void Shader::SetVector2f(const char *name, float x, float y, bool useShader) {
|
|||||||
this->Use();
|
this->Use();
|
||||||
glUniform2f(glGetUniformLocation(this->ID, name), x, y);
|
glUniform2f(glGetUniformLocation(this->ID, name), x, y);
|
||||||
}
|
}
|
||||||
void Shader::SetVector2f(
|
void Shader::SetVector2f(const char *name, const glm::vec2 &value,
|
||||||
const char *name,
|
|
||||||
const glm::vec2 &value,
|
|
||||||
bool useShader) {
|
bool useShader) {
|
||||||
if (useShader)
|
if (useShader)
|
||||||
this->Use();
|
this->Use();
|
||||||
glUniform2f(glGetUniformLocation(this->ID, name), value.x, value.y);
|
glUniform2f(glGetUniformLocation(this->ID, name), value.x, value.y);
|
||||||
}
|
}
|
||||||
void Shader::SetVector3f(
|
void Shader::SetVector3f(const char *name, float x, float y, float z,
|
||||||
const char *name,
|
|
||||||
float x,
|
|
||||||
float y,
|
|
||||||
float z,
|
|
||||||
bool useShader) {
|
bool useShader) {
|
||||||
if (useShader)
|
if (useShader)
|
||||||
this->Use();
|
this->Use();
|
||||||
glUniform3f(glGetUniformLocation(this->ID, name), x, y, z);
|
glUniform3f(glGetUniformLocation(this->ID, name), x, y, z);
|
||||||
}
|
}
|
||||||
void Shader::SetVector3f(
|
void Shader::SetVector3f(const char *name, const glm::vec3 &value,
|
||||||
const char *name,
|
|
||||||
const glm::vec3 &value,
|
|
||||||
bool useShader) {
|
bool useShader) {
|
||||||
if (useShader)
|
if (useShader)
|
||||||
this->Use();
|
this->Use();
|
||||||
glUniform3f
|
glUniform3f(glGetUniformLocation(this->ID, name), value.x, value.y, value.z);
|
||||||
(glGetUniformLocation(this->ID, name),
|
|
||||||
value.x, value.y, value.z);
|
|
||||||
}
|
}
|
||||||
void Shader::SetVector4f(
|
void Shader::SetVector4f(const char *name, float x, float y, float z, float w,
|
||||||
const char *name,
|
bool useShader) {
|
||||||
float x, float y, float z, float w, bool useShader) {
|
|
||||||
if (useShader)
|
if (useShader)
|
||||||
this->Use();
|
this->Use();
|
||||||
glUniform4f(glGetUniformLocation(this->ID, name), x, y, z, w);
|
glUniform4f(glGetUniformLocation(this->ID, name), x, y, z, w);
|
||||||
}
|
}
|
||||||
void Shader::SetVector4f(
|
void Shader::SetVector4f(const char *name, const glm::vec4 &value,
|
||||||
const char *name,
|
|
||||||
const glm::vec4 &value,
|
|
||||||
bool useShader) {
|
bool useShader) {
|
||||||
if (useShader)
|
if (useShader)
|
||||||
this->Use();
|
this->Use();
|
||||||
glUniform4f(
|
glUniform4f(glGetUniformLocation(this->ID, name), value.x, value.y, value.z,
|
||||||
glGetUniformLocation(this->ID, name),
|
value.w);
|
||||||
value.x, value.y, value.z, value.w);
|
|
||||||
}
|
}
|
||||||
void Shader::SetMatrix4(
|
void Shader::SetMatrix4(const char *name, const glm::mat4 &matrix,
|
||||||
const char *name,
|
|
||||||
const glm::mat4 &matrix,
|
|
||||||
bool useShader) {
|
bool useShader) {
|
||||||
if (useShader)
|
if (useShader)
|
||||||
this->Use();
|
this->Use();
|
||||||
glUniformMatrix4fv(
|
glUniformMatrix4fv(glGetUniformLocation(this->ID, name), 1, false,
|
||||||
glGetUniformLocation(this->ID, name),
|
glm::value_ptr(matrix));
|
||||||
1, false, glm::value_ptr(matrix));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Shader::checkCompileErrors(unsigned int object, std::string type) {
|
void Shader::checkCompileErrors(unsigned int object, std::string type) {
|
||||||
int success;
|
int success;
|
||||||
char infoLog[1024];
|
char infoLog[1024];
|
||||||
@ -127,8 +107,8 @@ void Shader::checkCompileErrors(unsigned int object, std::string type) {
|
|||||||
glGetShaderiv(object, GL_COMPILE_STATUS, &success);
|
glGetShaderiv(object, GL_COMPILE_STATUS, &success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
glGetShaderInfoLog(object, 1024, NULL, infoLog);
|
glGetShaderInfoLog(object, 1024, NULL, infoLog);
|
||||||
std::cout << "| ERROR::SHADER: Compile-time error: Type: "
|
std::cout
|
||||||
<< type << "\n"
|
<< "| ERROR::SHADER: Compile-time error: Type: " << type << "\n"
|
||||||
<< infoLog
|
<< infoLog
|
||||||
<< "\n -- --------------------------------------------------- -- "
|
<< "\n -- --------------------------------------------------- -- "
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -137,8 +117,8 @@ void Shader::checkCompileErrors(unsigned int object, std::string type) {
|
|||||||
glGetProgramiv(object, GL_LINK_STATUS, &success);
|
glGetProgramiv(object, GL_LINK_STATUS, &success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
glGetProgramInfoLog(object, 1024, NULL, infoLog);
|
glGetProgramInfoLog(object, 1024, NULL, infoLog);
|
||||||
std::cout << "| ERROR::Shader: Link-time error: Type: "
|
std::cout
|
||||||
<< type << "\n"
|
<< "| ERROR::Shader: Link-time error: Type: " << type << "\n"
|
||||||
<< infoLog
|
<< infoLog
|
||||||
<< "\n -- --------------------------------------------------- -- "
|
<< "\n -- --------------------------------------------------- -- "
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|||||||
@ -6,9 +6,8 @@
|
|||||||
|
|
||||||
// Texture2D is able to store and configure a texture in OpenGL.
|
// Texture2D is able to store and configure a texture in OpenGL.
|
||||||
// It also hosts utility functions for easy management.
|
// It also hosts utility functions for easy management.
|
||||||
class Texture2D
|
class Texture2D {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
// holds the ID of the texture object,
|
// holds the ID of the texture object,
|
||||||
// used for all texture operations to reference to this particular texture
|
// used for all texture operations to reference to this particular texture
|
||||||
unsigned int ID;
|
unsigned int ID;
|
||||||
@ -32,7 +31,7 @@ class Texture2D
|
|||||||
// constructor (sets default texture modes)
|
// constructor (sets default texture modes)
|
||||||
Texture2D();
|
Texture2D();
|
||||||
// generates texture from image data
|
// generates texture from image data
|
||||||
void Generate(unsigned int width, unsigned int height, unsigned char* data);
|
void Generate(unsigned int width, unsigned int height, unsigned char *data);
|
||||||
// binds the texture as the current active GL_TEXTURE_2D texture object
|
// binds the texture as the current active GL_TEXTURE_2D texture object
|
||||||
void Bind() const;
|
void Bind() const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,2 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
clang-tidy --config-file=.clang-tidy --fix-errors --fix-notes -p ./build/compile_commands.json ./breakout/breakout.cpp ./breakout/game.cpp ./breakout/game.hpp ./breakout/resourceManager.cpp ./breakout/resourceManager.hpp ./breakout/shader.cpp ./breakout/shader.hpp ./breakout/texture.cpp ./breakout/texture.hpp
|
clang-tidy --config-file=./.clang-tidy --fix-errors --fix-notes -p ./build/compile_commands.json ./breakout/breakout.cpp ./breakout/game.cpp ./breakout/game.hpp ./breakout/resourceManager.cpp ./breakout/resourceManager.hpp ./breakout/shader.cpp ./breakout/shader.hpp ./breakout/texture.cpp ./breakout/texture.hpp
|
||||||
|
|
||||||
|
cpplint ./breakout/breakout.cpp ./breakout/game.cpp ./breakout/game.hpp ./breakout/resourceManager.cpp ./breakout/resourceManager.hpp ./breakout/shader.cpp ./breakout/shader.hpp ./breakout/texture.cpp ./breakout/texture.hpp
|
||||||
Loading…
Reference in New Issue
Block a user