mirror of
https://github.com/kuhyx/engineer-thesis-WUT.git
synced 2026-07-04 13:43:28 +02: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: ''
|
||||
HeaderFilterRegex: ''
|
||||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: none
|
||||
User: kuchy
|
||||
CheckOptions:
|
||||
llvm-else-after-return.WarnOnConditionVariables: 'false'
|
||||
modernize-loop-convert.MinConfidence: reasonable
|
||||
modernize-replace-auto-ptr.IncludeStyle: llvm
|
||||
modernize-pass-by-value.IncludeStyle: llvm
|
||||
google-readability-namespace-comments.ShortNamespaceLines: '10'
|
||||
google-readability-namespace-comments.SpacesBeforeComments: '2'
|
||||
cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true'
|
||||
google-readability-braces-around-statements.ShortStatementLines: '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;'
|
||||
modernize-loop-convert.MaxCopySize: '16'
|
||||
cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU'
|
||||
cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
|
||||
cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
|
||||
modernize-use-nullptr.NullMacros: 'NULL'
|
||||
llvm-qualified-auto.AddConstToQualified: 'false'
|
||||
modernize-loop-convert.NamingStyle: CamelCase
|
||||
llvm-else-after-return.WarnOnUnfixable: 'false'
|
||||
google-readability-function-size.StatementThreshold: '800'
|
||||
- key: cert-dcl16-c.NewSuffixes
|
||||
value: 'L;LL;LU;LLU'
|
||||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||
value: '0'
|
||||
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
|
||||
value: '1'
|
||||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||
value: '1'
|
||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||
value: '1'
|
||||
- key: google-readability-function-size.LineThreshold
|
||||
value: '16'
|
||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||
value: '10'
|
||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||
value: '2'
|
||||
- key: modernize-loop-convert.MaxCopySize
|
||||
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);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int main(int argc, char *argv[]) {
|
||||
glfwInit();
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 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;
|
||||
// note that width and
|
||||
// height will be significantly larger than specified on retina displays.
|
||||
|
||||
@ -7,15 +7,10 @@
|
||||
#include "../dependencies/include/glad/glad.h"
|
||||
|
||||
// Represents the current state of the game
|
||||
enum GameState {
|
||||
GAME_ACTIVE,
|
||||
GAME_MENU,
|
||||
GAME_WIN
|
||||
};
|
||||
enum GameState { GAME_ACTIVE, GAME_MENU, GAME_WIN };
|
||||
|
||||
class Game
|
||||
{
|
||||
public:
|
||||
class Game {
|
||||
public:
|
||||
// game state
|
||||
GameState State;
|
||||
bool Keys[1024];
|
||||
|
||||
@ -5,15 +5,13 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
Shader &Shader::Use()
|
||||
{
|
||||
Shader &Shader::Use() {
|
||||
glUseProgram(this->ID);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Shader::Compile(const char* vertexSource,
|
||||
const char* fragmentSource,
|
||||
const char* geometrySource) {
|
||||
void Shader::Compile(const char *vertexSource, const char *fragmentSource,
|
||||
const char *geometrySource) {
|
||||
unsigned int sVertex, sFragment, gShader;
|
||||
// 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();
|
||||
glUniform2f(glGetUniformLocation(this->ID, name), x, y);
|
||||
}
|
||||
void Shader::SetVector2f(
|
||||
const char *name,
|
||||
const glm::vec2 &value,
|
||||
void Shader::SetVector2f(const char *name, const glm::vec2 &value,
|
||||
bool useShader) {
|
||||
if (useShader)
|
||||
this->Use();
|
||||
glUniform2f(glGetUniformLocation(this->ID, name), value.x, value.y);
|
||||
}
|
||||
void Shader::SetVector3f(
|
||||
const char *name,
|
||||
float x,
|
||||
float y,
|
||||
float z,
|
||||
void Shader::SetVector3f(const char *name, float x, float y, float z,
|
||||
bool useShader) {
|
||||
if (useShader)
|
||||
this->Use();
|
||||
glUniform3f(glGetUniformLocation(this->ID, name), x, y, z);
|
||||
}
|
||||
void Shader::SetVector3f(
|
||||
const char *name,
|
||||
const glm::vec3 &value,
|
||||
void Shader::SetVector3f(const char *name, const glm::vec3 &value,
|
||||
bool useShader) {
|
||||
if (useShader)
|
||||
this->Use();
|
||||
glUniform3f
|
||||
(glGetUniformLocation(this->ID, name),
|
||||
value.x, value.y, value.z);
|
||||
glUniform3f(glGetUniformLocation(this->ID, name), value.x, value.y, value.z);
|
||||
}
|
||||
void Shader::SetVector4f(
|
||||
const char *name,
|
||||
float x, float y, float z, float w, bool useShader) {
|
||||
void Shader::SetVector4f(const char *name, float x, float y, float z, float w,
|
||||
bool useShader) {
|
||||
if (useShader)
|
||||
this->Use();
|
||||
glUniform4f(glGetUniformLocation(this->ID, name), x, y, z, w);
|
||||
}
|
||||
void Shader::SetVector4f(
|
||||
const char *name,
|
||||
const glm::vec4 &value,
|
||||
void Shader::SetVector4f(const char *name, const glm::vec4 &value,
|
||||
bool useShader) {
|
||||
if (useShader)
|
||||
this->Use();
|
||||
glUniform4f(
|
||||
glGetUniformLocation(this->ID, name),
|
||||
value.x, value.y, value.z, value.w);
|
||||
glUniform4f(glGetUniformLocation(this->ID, name), value.x, value.y, value.z,
|
||||
value.w);
|
||||
}
|
||||
void Shader::SetMatrix4(
|
||||
const char *name,
|
||||
const glm::mat4 &matrix,
|
||||
void Shader::SetMatrix4(const char *name, const glm::mat4 &matrix,
|
||||
bool useShader) {
|
||||
if (useShader)
|
||||
this->Use();
|
||||
glUniformMatrix4fv(
|
||||
glGetUniformLocation(this->ID, name),
|
||||
1, false, glm::value_ptr(matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(this->ID, name), 1, false,
|
||||
glm::value_ptr(matrix));
|
||||
}
|
||||
|
||||
|
||||
void Shader::checkCompileErrors(unsigned int object, std::string type) {
|
||||
int success;
|
||||
char infoLog[1024];
|
||||
@ -127,8 +107,8 @@ void Shader::checkCompileErrors(unsigned int object, std::string type) {
|
||||
glGetShaderiv(object, GL_COMPILE_STATUS, &success);
|
||||
if (!success) {
|
||||
glGetShaderInfoLog(object, 1024, NULL, infoLog);
|
||||
std::cout << "| ERROR::SHADER: Compile-time error: Type: "
|
||||
<< type << "\n"
|
||||
std::cout
|
||||
<< "| ERROR::SHADER: Compile-time error: Type: " << type << "\n"
|
||||
<< infoLog
|
||||
<< "\n -- --------------------------------------------------- -- "
|
||||
<< std::endl;
|
||||
@ -137,8 +117,8 @@ void Shader::checkCompileErrors(unsigned int object, std::string type) {
|
||||
glGetProgramiv(object, GL_LINK_STATUS, &success);
|
||||
if (!success) {
|
||||
glGetProgramInfoLog(object, 1024, NULL, infoLog);
|
||||
std::cout << "| ERROR::Shader: Link-time error: Type: "
|
||||
<< type << "\n"
|
||||
std::cout
|
||||
<< "| ERROR::Shader: Link-time error: Type: " << type << "\n"
|
||||
<< infoLog
|
||||
<< "\n -- --------------------------------------------------- -- "
|
||||
<< std::endl;
|
||||
|
||||
@ -6,9 +6,8 @@
|
||||
|
||||
// Texture2D is able to store and configure a texture in OpenGL.
|
||||
// It also hosts utility functions for easy management.
|
||||
class Texture2D
|
||||
{
|
||||
public:
|
||||
class Texture2D {
|
||||
public:
|
||||
// holds the ID of the texture object,
|
||||
// used for all texture operations to reference to this particular texture
|
||||
unsigned int ID;
|
||||
@ -32,7 +31,7 @@ class Texture2D
|
||||
// constructor (sets default texture modes)
|
||||
Texture2D();
|
||||
// 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
|
||||
void Bind() const;
|
||||
};
|
||||
|
||||
@ -1,2 +1,4 @@
|
||||
#!/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