src/linter/rules/NamingConventionRule.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2026 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #pragma once | ||
| 4 | |||
| 5 | #include <linter/LintRule.h> | ||
| 6 | |||
| 7 | namespace spice::compiler { | ||
| 8 | |||
| 9 | /** | ||
| 10 | * Flags Spice-source identifiers that violate the naming conventions documented in STYLE_GUIDE.md | ||
| 11 | * (functions/procedures/methods: camelCase; structs/interfaces: PascalCase). | ||
| 12 | * | ||
| 13 | * This is deliberately a style rule, not a semantic one: unlike unused-symbol or shadowing checks | ||
| 14 | * (which stay compiler warnings, see CompilerWarning.h), naming conventions are opinionated and | ||
| 15 | * belong to the opt-in `spice lint` command rather than every `build`/`run`/`test` invocation. | ||
| 16 | */ | ||
| 17 | class NamingConventionRule final : public LintRule { | ||
| 18 | public: | ||
| 19 | 3 | [[nodiscard]] constexpr std::string_view id() const override { return "naming-convention"; } | |
| 20 | |||
| 21 | void checkFctDef(FctDefNode *node, std::vector<LintFinding> &findings) override; | ||
| 22 | void checkProcDef(ProcDefNode *node, std::vector<LintFinding> &findings) override; | ||
| 23 | void checkStructDef(StructDefNode *node, std::vector<LintFinding> &findings) override; | ||
| 24 | void checkInterfaceDef(InterfaceDefNode *node, std::vector<LintFinding> &findings) override; | ||
| 25 | void checkGlobalVarDef(GlobalVarDefNode *node, std::vector<LintFinding> &findings) override; | ||
| 26 | }; | ||
| 27 | |||
| 28 | } // namespace spice::compiler | ||
| 29 |