diff options
| -rw-r--r-- | .clang-tidy | 20 | ||||
| -rw-r--r-- | arch/x86_64/arch/boot/ld.hpp | 10 | ||||
| -rw-r--r-- | cspell.json | 4 | ||||
| -rw-r--r-- | kernel/src/filesystem/type_registry.cpp | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/integral.hpp | 6 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/observer_ptr.test.cpp | 20 |
6 files changed, 43 insertions, 21 deletions
diff --git a/.clang-tidy b/.clang-tidy index dc76491..f4b0b7b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -41,6 +41,7 @@ Checks: - misc-redundant-expression - misc-static-assert - misc-unused-using-decls + - modernize-avoid-c-arrays - modernize-loop-convert - modernize-use-auto @@ -52,17 +53,32 @@ Checks: - modernize-use-transparent-functors - modernize-use-using + - readability-identifier-naming - readability-magic-numbers CheckOptions: cppcoreguidelines-avoid-do-while.IgnoreMacros: true + cppcoreguidelines-avoid-non-const-global-variables.AllowInternalLinkage: true + modernize-use-std-print.ReplacementPrintFunction: "kstd::print" modernize-use-std-print.ReplacementPrintlnFunction: "kstd::println" modernize-use-std-print.PrintHeader: "kstd/print" + modernize-use-trailing-return-type.TransformLambdas: none - readability-magic-numbers.IgnoredIntegerValues: "1;2;3;4;5;6;7;10;15;20;25;30;3\ - 5;40;45;50;60;70;80;90;100;200;300;400;255" + + readability-identifier-naming.CheckAnonFieldInParent: true + readability-identifier-naming.ClassCase: lower_case + readability-identifier-naming.ConstantCase: lower_case + readability-identifier-naming.ConstexprVariableCase: lower_case + readability-identifier-naming.EnumCase: lower_case + readability-identifier-naming.FunctionCase: lower_case + readability-identifier-naming.PrivateMemberPrefix: m_ + readability-identifier-naming.TemplateParameterCase: CamelCase + readability-identifier-naming.TypeAliasCase: lower_case + readability-identifier-naming.VariableCase: lower_case + + readability-magic-numbers.IgnoredIntegerValues: "1;2;3;4;5;6;7;10;15;20;25;30;3;5;40;45;50;60;70;80;90;100;200;300;400;255" readability-magic-numbers.IgnorePowersOf2IntegerValues: true readability-magic-numbers.IgnoreBitFieldsWidths: true readability-magic-numbers.IgnoreTypeAliases: true diff --git a/arch/x86_64/arch/boot/ld.hpp b/arch/x86_64/arch/boot/ld.hpp index 988723d..a8b83d6 100644 --- a/arch/x86_64/arch/boot/ld.hpp +++ b/arch/x86_64/arch/boot/ld.hpp @@ -27,33 +27,33 @@ namespace arch::boot //! This symbol marks the start of the kernel image in physical memory. //! //! @see _end_physical - extern std::byte _start_physical; + extern std::byte _start_physical; // NOLINT(readability-identifier-naming) //! The first byte after the loaded kernel image. //! //! This symbol marks the end of the kernel image in physical memory. //! //! @see _start_physical - extern std::byte _end_physical; + extern std::byte _end_physical; // NOLINT(readability-identifier-naming) //! The first byte of the loaded kernel image in the virtual address space. //! //! This symbol and marks the start of the kernel image in virtual memory. //! //! @see _end_virtual - extern std::byte _start_virtual; + extern std::byte _start_virtual; // NOLINT(readability-identifier-naming) //! The first byte after the loaded kernel image in the virtual address space. //! //! This symbol marks the end of the kernel image in virtual memory. //! //! @see _start_virtual - extern std::byte _end_virtual; + extern std::byte _end_virtual; // NOLINT(readability-identifier-naming) //! The first byte of the kernel's virtual address space. //! //! This symbol marks beginning of the kernel virtual address space. - extern std::byte TEACHOS_VMA; + extern std::byte TEACHOS_VMA; // NOLINT(readability-identifier-naming) } } // namespace arch::boot diff --git a/cspell.json b/cspell.json index bfcd6af..99eea3e 100644 --- a/cspell.json +++ b/cspell.json @@ -7,11 +7,13 @@ "acpi", "APIC", "bugprone", + "Constexpr", "cppcoreguidelines", "crtc", "crtp", "efer", "FACS", + "fcondition", "functors", "hhdm", "idtr", @@ -48,4 +50,4 @@ ], "ignoreWords": [], "import": [] -}
\ No newline at end of file +} diff --git a/kernel/src/filesystem/type_registry.cpp b/kernel/src/filesystem/type_registry.cpp index d917c81..74b1209 100644 --- a/kernel/src/filesystem/type_registry.cpp +++ b/kernel/src/filesystem/type_registry.cpp @@ -16,8 +16,12 @@ namespace kernel::filesystem extern "C" { + // We need to suppress clang-tidy linting warnings here, since these symbols are generated by the linker and we + // cannot choose their names, unless we wanted to extend the linker script needlessly. + // NOLINTBEGIN(readability-identifier-naming) extern type_registry::pointer const __start_fs_types; extern type_registry::pointer const __stop_fs_types; + // NOLINTEND(readability-identifier-naming) } namespace diff --git a/libs/kstd/kstd/bits/format/formatter/integral.hpp b/libs/kstd/kstd/bits/format/formatter/integral.hpp index d17dc95..5ff76b2 100644 --- a/libs/kstd/kstd/bits/format/formatter/integral.hpp +++ b/libs/kstd/kstd/bits/format/formatter/integral.hpp @@ -74,8 +74,8 @@ namespace kstd final_width = bits::format::extrat_dynamic_width(arg); } - using unsigned_T = std::make_unsigned_t<T>; - auto absolute_value = static_cast<unsigned_T>(value); + using unsigned_t = std::make_unsigned_t<T>; + auto absolute_value = static_cast<unsigned_t>(value); auto is_negative = false; if constexpr (std::is_signed_v<T>) @@ -83,7 +83,7 @@ namespace kstd if (value < 0) { is_negative = true; - absolute_value = 0 - static_cast<unsigned_T>(value); + absolute_value = 0 - static_cast<unsigned_t>(value); } } diff --git a/libs/kstd/kstd/bits/observer_ptr.test.cpp b/libs/kstd/kstd/bits/observer_ptr.test.cpp index 1ba9c63..f26fc09 100644 --- a/libs/kstd/kstd/bits/observer_ptr.test.cpp +++ b/libs/kstd/kstd/bits/observer_ptr.test.cpp @@ -10,19 +10,19 @@ namespace { - struct Base + struct base { }; - struct Derived : Base + struct derived : base { }; - struct Element + struct element { int value{}; - constexpr auto operator<=>(Element const &) const noexcept = default; + constexpr auto operator<=>(element const &) const noexcept = default; }; } // namespace @@ -80,9 +80,9 @@ SCENARIO("Observer Pointer initialization and construction", "[observer_ptr]") WHEN("copy constructing from an existing observer pointer with a compatible type") { - auto value = Derived{}; - auto ptr = kstd::observer_ptr<Derived>(&value); - kstd::observer_ptr<Base> copy = ptr; + auto value = derived{}; + auto ptr = kstd::observer_ptr<derived>(&value); + kstd::observer_ptr<base> copy = ptr; THEN("the new observer pointer points to the same object as the other observer pointer") { @@ -228,7 +228,7 @@ SCENARIO("Observer pointer observers", "[observer_ptr]") { GIVEN("A non-null observer pointer") { - auto value = Element{1}; + auto value = element{1}; auto ptr = kstd::observer_ptr{&value}; WHEN("getting the raw pointer") @@ -263,7 +263,7 @@ SCENARIO("Observer pointer observers", "[observer_ptr]") WHEN("converting the observer pointer to a raw pointer") { - auto raw_ptr = static_cast<Element *>(ptr); + auto raw_ptr = static_cast<element *>(ptr); THEN("the raw pointer points to the correct object") { @@ -282,7 +282,7 @@ SCENARIO("Observer pointer observers", "[observer_ptr]") GIVEN("A null observer pointer") { - auto ptr = kstd::observer_ptr<Element>{}; + auto ptr = kstd::observer_ptr<element>{}; WHEN("checking the observer pointer as a boolean") { |
