]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Add some of my cursor rules
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 3 Oct 2025 11:26:50 +0000 (12:26 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 3 Oct 2025 11:26:50 +0000 (12:26 +0100)
.cursor/rules/commits-and-tags.mdc
.cursor/rules/rspamd.mdc [new file with mode: 0644]

index 35b6157be5b3627f506fc53f52cd1be4c1b1205a..e02f0fb7444eec4ba6bc1e8e5b48d9833c4ec53d 100644 (file)
@@ -22,6 +22,8 @@ Use one of the following tags at the beginning of commit messages:
 - `[Test]` - Test additions or modifications
 - `[Rules]` - Changes to spam detection rules
 
+Prefer `[Minor]` if a fix or a change is minor (e.g. whitespaces change or a missing nil check).
+
 ## Commit Message Examples
 
 **Version updates:**
@@ -148,4 +150,4 @@ set(RSPAMD_VERSION_PATCH Z)
 - One logical change per commit
 - Reference issue numbers when applicable
 - Keep commit history clean and meaningful
-- Always sign commits and tags with GPG
\ No newline at end of file
+- Always sign commits and tags with GPG
diff --git a/.cursor/rules/rspamd.mdc b/.cursor/rules/rspamd.mdc
new file mode 100644 (file)
index 0000000..f9f6c2a
--- /dev/null
@@ -0,0 +1,23 @@
+---
+description: "Rspamd: code style, code checks, and special project requirements"
+globs: ["src/**", "lualib/**", "rules/**"]
+alwaysApply: true
+---
+
+# C and C++
+- For all C and C++ code changes, run `clang-format` using the `.clang-format` file located in the project root.
+- Always follow the formatting specified in this file, and ensure formatting is applied before every commit.
+- Do NOT use C++ standard library hash maps (`std::unordered_map`, `std::hash`). Always use containers from `contrib/ankerl/unordered_dense` for maps/sets and related hashes.
+
+# Lua (src/plugins/lua/, lualib/, rules/)
+- Run `luacheck src/plugins/lua/ lualib/ rules/` before every commit.
+- Make sure you change to the project root directory before running luacheck.
+- Resolve all luacheck warnings except those explicitly permitted by project exceptions.
+- rspamd_logger uses `%s` in the format strings for all arguments placeholders
+
+# Logging and Debug
+- All debug logging functions use a custom `printf` format string implementation. Before touching or adding logging code, read the comments in `src/libutil/printf.h` and follow the style and requirements described there.
+
+# General principles
+- Do not introduce changes that conflict with these rules or established project practices.
+- If unsure, consult Rspamd maintainers or refer to in-code comments.