diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..ed0a13a --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,25 @@ +Checks: > + -*, + clang-diagnostic-*, + clang-analyzer-*, + readability-*, + -readability-identifier-length, + -readability-magic-numbers, + -readability-function-cognitive-complexity, + bugprone-*, + -bugprone-easily-swappable-parameters, + misc-*, + -misc-unused-parameters, + portability-* + +WarningsAsErrors: '' + +HeaderFilterRegex: '.*' + +CheckOptions: + - key: readability-function-size.LineThreshold + value: '100' + - key: readability-function-size.StatementThreshold + value: '50' + +FormatStyle: none \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8a579ce..7e1aae6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ build/ cmake-build-debug/ +cmake-build-release/ diff --git a/CMakeLists.txt b/CMakeLists.txt index a1b61c7..218ddd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project(cordle C) set(CMAKE_C_STANDARD 90) set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c90 -pedantic") # Find ncurses library find_package(Curses REQUIRED) @@ -27,5 +28,5 @@ target_link_libraries(cordle ${CURSES_LIBRARIES}) # Set compiler flags for C90 compliance if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") - target_compile_options(cordle PRIVATE -Wall -Wextra -pedantic) + target_compile_options(cordle PRIVATE -Wpedantic -Wextra -pedantic) endif() diff --git a/build.sh b/build.sh index f08d31a..ea01efb 100755 --- a/build.sh +++ b/build.sh @@ -3,11 +3,15 @@ mkdir -p build/cordle echo "Building application." -gcc -std=c90 -pedantic -Wall -o build/cordle/cordle src/*.c -Iinclude -lncurses +gcc -v -std=c90 -pedantic -Wpedantic -o build/cordle/cordle src/*.c -Iinclude -lncurses > build/cordle-build.log 2>&1 export RESULT=$? if (( RESULT == 0 )); then echo "Compile successful. Copying wordlists..." cp -R wordlists build/cordle echo "Build completed." + rm build/cordle-build.log +else + echo "Something went wrong..." + cat build/cordle-build.log fi diff --git a/CordleDosBoxLauncher.bat b/dosbox/CordleDosBoxLauncher.bat similarity index 100% rename from CordleDosBoxLauncher.bat rename to dosbox/CordleDosBoxLauncher.bat diff --git a/CordleDosMakefile.mk b/dosbox/CordleDosMakefile.mk similarity index 100% rename from CordleDosMakefile.mk rename to dosbox/CordleDosMakefile.mk diff --git a/DosBoxCordleSetupGuide.md b/dosbox/DosBoxCordleSetupGuide.md similarity index 100% rename from DosBoxCordleSetupGuide.md rename to dosbox/DosBoxCordleSetupGuide.md diff --git a/DosboxCordleLauncher.sh b/dosbox/DosboxCordleLauncher.sh similarity index 100% rename from DosboxCordleLauncher.sh rename to dosbox/DosboxCordleLauncher.sh diff --git a/cordle_dos_REAMDE.txt b/dosbox/cordle_dos_REAMDE.txt similarity index 100% rename from cordle_dos_REAMDE.txt rename to dosbox/cordle_dos_REAMDE.txt diff --git a/dosbox_config_cordle.ini b/dosbox/dosbox_config_cordle.ini similarity index 100% rename from dosbox_config_cordle.ini rename to dosbox/dosbox_config_cordle.ini diff --git a/dosbox_cordle_configuration.ini b/dosbox/dosbox_cordle_configuration.ini similarity index 100% rename from dosbox_cordle_configuration.ini rename to dosbox/dosbox_cordle_configuration.ini diff --git a/src/game.c b/src/game.c index 6e7d27e..3afe2a7 100644 --- a/src/game.c +++ b/src/game.c @@ -76,7 +76,7 @@ void check_guess(GameState *game, const char *guess, int *colors) { break; } } - /* If still absent, mark letter as not in word */ + /* If still absent, mark a letter as not in word */ if (colors[i] == COLOR_ABSENT) { if (game->letter_status[guess_copy[i] - 'A'] == STATUS_UNUSED) { game->letter_status[guess_copy[i] - 'A'] = STATUS_ABSENT;