From e2b6106cec11ac4fa07e3ea28e7099d4bb25f5a3 Mon Sep 17 00:00:00 2001 From: rfprod Date: Tue, 22 Sep 2026 00:52:06 +0400 Subject: [PATCH] chore(cleanup): formatting config, vscode settings - [x] add formatting configuration for `clang-format`; - [x] remove redundant `vscode` settings; - [x] clean up shell tools, cmake configuration; --- .clang-format | 24 ++++++++++++++++++++++++ .vscode/extensions.json | 1 + .vscode/recommended-settings.json | 24 ------------------------ .vscode/setting.json | 19 ++++++++++++++++++- CMakeLists.txt | 3 --- conanfile.py | 2 +- src/.gitkeep | 0 src/main.cpp | 20 ++++++++++---------- tools/shell/install.sh | 1 - 9 files changed, 54 insertions(+), 40 deletions(-) create mode 100644 .clang-format delete mode 100644 .vscode/recommended-settings.json delete mode 100644 src/.gitkeep diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..a676325 --- /dev/null +++ b/.clang-format @@ -0,0 +1,24 @@ +Language: Cpp +BasedOnStyle: LLVM +IndentWidth: 4 +UseTab: Never +ColumnLimit: 100 +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true +BreakBeforeBinaryOperators: NonAssignment +PointerAlignment: Left +SpaceAfterCStyleCast: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +AlignConsecutiveAssignments: false +AlignTrailingComments: true diff --git a/.vscode/extensions.json b/.vscode/extensions.json index c086851..7e550d0 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,7 @@ "ms-vscode.cpptools", "ms-vscode.cpptools-extension-pack", "ms-vscode.cpptools-themes", + "ms-vscode.cmake-tools", "sadesyllas.vscode-workspace-switcher", "editorconfig.editorconfig", "xaver.clang-format", diff --git a/.vscode/recommended-settings.json b/.vscode/recommended-settings.json deleted file mode 100644 index 8a9f21e..0000000 --- a/.vscode/recommended-settings.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "clang-format.fallbackStyle": "Google", - "clang-format.language.apex.enable": false, - "clang-format.language.c.enable": false, - "clang-format.language.cpp.enable": true, - "clang-format.language.cuda.enable": false, - "clang-format.language.glsl.enable": false, - "clang-format.language.java.enable": false, - "clang-format.language.javascript.enable": false, - "clang-format.language.objective-c.enable": false, - "clang-format.language.objective-cpp.enable": false, - "clang-format.language.typescript.enable": false, - "clang-format.style": "Google", - "files.defaultLanguage": "cpp", - "files.hotExit": "onExit", - "yaml.format.enable": true, - "yaml.format.singleQuote": true, - "yaml.format.bracketSpacing": true, - "yaml.format.proseWrap": true, - "yaml.format.printWidth": true, - "yaml.validate": true, - "yaml.hover": true, - "yaml.completion": true -} diff --git a/.vscode/setting.json b/.vscode/setting.json index 4986666..3282641 100644 --- a/.vscode/setting.json +++ b/.vscode/setting.json @@ -1,4 +1,7 @@ { + "[c]": { + "editor.defaultFormatter": "xaver.clang-format" + }, "[cpp]": { "editor.defaultFormatter": "xaver.clang-format" }, @@ -38,5 +41,19 @@ "CMAKE_BUILD_TYPE": "Debug", "CMAKE_C_COMPILER": "gcc-13", "CMAKE_CXX_COMPILER": "g++-13" - } + }, + "clang-format.executable": "/usr/bin/clang-format", + "clang-format.fallbackStyle": "LLVM", + "clang-format.language.cpp.enable": true, + "clang-format.style": "file", + "files.defaultLanguage": "cpp", + "files.hotExit": "onExit", + "yaml.format.enable": true, + "yaml.format.singleQuote": true, + "yaml.format.bracketSpacing": true, + "yaml.format.proseWrap": true, + "yaml.format.printWidth": true, + "yaml.validate": true, + "yaml.hover": true, + "yaml.completion": true } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 76b9cca..60af9cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,9 +13,6 @@ add_executable(cpp-workspace-app src/main.cpp ) -# Add find_package() and target_link_libraries() here -# for each dependency installed by Conan. - find_package(fmt CONFIG REQUIRED) target_link_libraries(cpp-workspace-app PRIVATE fmt::fmt) diff --git a/conanfile.py b/conanfile.py index e326745..031e85b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -8,7 +8,7 @@ class AppConan(ConanFile): generators = "CMakeDeps", "CMakeToolchain" def requirements(self): - self.requires("fmt/11.2.0") # Replace with your dependencies + self.requires("fmt/11.2.0") def layout(self): cmake_layout(self) diff --git a/src/.gitkeep b/src/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/main.cpp b/src/main.cpp index 3c8f40c..0e3d46b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,17 +5,17 @@ using std::cout; using std::format; int main() { - const char string[]{"this is a string"}; + const char string[]{"this is a string"}; - for (auto *p = string; *p; p++) { - cout << format("char = {}\n", *p); - } + for (auto* p = string; *p; p++) { + cout << format("char = {}\n", *p); + } - for (int i{0}; string[i]; i++) { - cout << format("{} char = {}\n", i, string[i]); - } + for (int i{0}; string[i]; i++) { + cout << format("{} char = {}\n", i, string[i]); + } - for (const auto &el : string) { - cout << format("element = {}\n", el); - } + for (const auto& el : string) { + cout << format("element = {}\n", el); + } } diff --git a/tools/shell/install.sh b/tools/shell/install.sh index cf524ad..96f7193 100755 --- a/tools/shell/install.sh +++ b/tools/shell/install.sh @@ -1,7 +1,6 @@ #!/bin/bash source tools/shell/utils/config.sh -source tools/shell/utils/colors.sh '' source tools/shell/utils/print-utils.sh '' ##