diff --git a/.clang-format b/.clang-format
index 6f64d25..9ae1d4e 100644
--- a/.clang-format
+++ b/.clang-format
@@ -76,6 +76,6 @@ SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: c++17
+Standard: c++20
TabWidth: 4
UseTab: Never
diff --git a/.clang-tidy b/.clang-tidy
index d6cf774..f9aeba8 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -34,5 +34,4 @@ Checks: >-
-modernize-avoid-c-arrays,
-bugprone-easily-swappable-parameters,
-misc-const-correctness
-WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 4796385..fd58d96 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -20,12 +20,7 @@
"extensions": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools"
- ],
- "settings": {
- "C_Cpp.formatting": "clangFormat",
- "C_Cpp.codeAnalysis.clangTidy.enabled": true,
- "editor.formatOnSave": true
- }
+ ]
}
},
"features": {
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
new file mode 100644
index 0000000..6de4d25
--- /dev/null
+++ b/.vscode/c_cpp_properties.json
@@ -0,0 +1,16 @@
+{
+ "configurations": [
+ {
+ "name": "DevContainer",
+ "includePath": [
+ "${workspaceFolder}/**",
+ "/root/.conan2/**"
+ ],
+ "defines": [],
+ "compilerPath": "/usr/bin/clang",
+ "intelliSenseMode": "linux-clang-x64",
+ "cppStandard": "c++20"
+ }
+ ],
+ "version": 4
+}
\ No newline at end of file
diff --git a/.vscode/cpp.code-snippets b/.vscode/cpp.code-snippets
new file mode 100644
index 0000000..f0199d7
--- /dev/null
+++ b/.vscode/cpp.code-snippets
@@ -0,0 +1,9 @@
+{
+ "NOLINTNEXTLINE": {
+ "prefix": "nolint",
+ "body": [
+ "// NOLINTNEXTLINE"
+ ],
+ "description": "Add NOLINTNEXTLINE comment"
+ }
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..60dbb41
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,13 @@
+{
+ "editor.formatOnSave": true,
+ "C_Cpp.formatting": "clangFormat",
+ "C_Cpp.codeAnalysis.clangTidy.enabled": true,
+ "C_Cpp.codeAnalysis.exclude": {
+ "build/**": true,
+ "**/odb-gen/*.cxx": true,
+ "**/odb-gen/*.hxx": true,
+ "**/odb-gen/*.ixx": true,
+ "**/.conan2/**": true,
+ },
+ "C_Cpp.autoAddFileAssociations": false
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 5a4f0e4..09b1886 100644
--- a/README.md
+++ b/README.md
@@ -38,12 +38,27 @@ When the project configuration is finished, click Build to build the project.
To launch the executable, click Launch in the CMake extension.

-## How to run clang-tidy static code analyzer
+## Linters
-To run clang-tidy, run the following command:
-```
-find ./src -name "*.cpp" -not -path "*/build/*" -exec echo "Checking {}..." \; -exec clang-tidy --config-file=.clang-tidy {} -- -I./include -std=c++20 \;
-```
+The project includes the `clang-tidy` code analyzer and the `clang-format` formatter. Configuration files are located in the project root: `.clang-tidy` and `.clang-format`, respectively.
+
+To use linters you need to install:
+- [VSCode](https://code.visualstudio.com/)
+- [C/C++ VSCode Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)
+
+### Clang-format
+
+Clang-format code formatting occurs automatically when saving a file using the CodeAnalysis C/C++ extension.
+
+To start manually, you need to run the command `find ./src -name "*.cpp" -o -name "*.h" | xargs clang-format --dry-run`, while in the root of the project.
+
+To automatically fix errors, run `find ./src -name "*.cpp" -o -name "*.h" | xargs clang-format -i` from the project root.
+
+### Clang-tidy
+
+Clang-tidy code checking occurs in the background using the CodeAnalysis C/C++ extension.
+
+To start manually, you need to run the command `find ./src -name "*.cpp" -o -name "*.h" | xargs clang-tidy -p ./build/Debug | grep "error:"`, while in the root of the project.
## Tests run
diff --git a/src/data/commands/todo-commands.cpp b/src/data/commands/todo-commands.cpp
index c6a3e21..edf2423 100644
--- a/src/data/commands/todo-commands.cpp
+++ b/src/data/commands/todo-commands.cpp
@@ -1,7 +1,7 @@
#include "todo-commands.h"
#include "data/models/odb-gen/to-do-odb.hxx"
-#include
#include
+#include
uint64_t ToDoCommands::create_todo(const std::string& name, std::time_t createdAtUtc)
{
diff --git a/src/data/models/to-do.h b/src/data/models/to-do.h
index ee5b535..2631294 100644
--- a/src/data/models/to-do.h
+++ b/src/data/models/to-do.h
@@ -1,9 +1,9 @@
#pragma once
-#include
#include
#include
#include
+#include
#pragma db object table("todo")
class ToDo
@@ -11,7 +11,10 @@ class ToDo
public:
ToDo() = default;
ToDo(const std::string& name, std::time_t createdAtUtc)
- : name_(name), createdAtUtc_(createdAtUtc), deletedAtUtc_() {}
+ : name_(name),
+ createdAtUtc_(createdAtUtc),
+ deletedAtUtc_()
+ {}
std::uint64_t id() const { return id_; }
const std::string& name() const { return name_; }
@@ -25,14 +28,14 @@ class ToDo
private:
friend class odb::access;
- #pragma db id auto
+#pragma db id auto
std::uint64_t id_;
std::string name_;
- #pragma db type("BIGINT")
+#pragma db type("BIGINT")
std::time_t createdAtUtc_;
- #pragma db null
- #pragma db type("BIGINT")
+#pragma db null
+#pragma db type("BIGINT")
odb::nullable deletedAtUtc_;
};
\ No newline at end of file
diff --git a/src/data/queries/todo-queries.cpp b/src/data/queries/todo-queries.cpp
index 5ed6df7..aecb7ed 100644
--- a/src/data/queries/todo-queries.cpp
+++ b/src/data/queries/todo-queries.cpp
@@ -1,7 +1,7 @@
#include "todo-queries.h"
#include "data/models/odb-gen/to-do-odb.hxx"
-#include
#include
+#include
std::shared_ptr> ToDoQueries::get_all_todos()
{
diff --git a/src/data/queries/todo-queries.h b/src/data/queries/todo-queries.h
index 4920224..504e571 100644
--- a/src/data/queries/todo-queries.h
+++ b/src/data/queries/todo-queries.h
@@ -8,8 +8,9 @@
class ToDoQueries
{
public:
- ToDoQueries
-(odb::database& db) : db_(db) {}
+ ToDoQueries(odb::database& db)
+ : db_(db)
+ {}
std::shared_ptr> get_all_todos();
std::shared_ptr get_todo_by_id(int id);
diff --git a/src/main.cpp b/src/main.cpp
index 8bdedd1..be21213 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,12 +1,4 @@
-#include "data/commands/todo-commands.h"
-#include "data/queries/todo-queries.h"
-#include
#include
-#include
-#include
-#include
-#include
-#include
int main()
{