From f73464ccc1b14b7f9421a33349a5f675727dc30a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 3 Oct 2025 12:26:50 +0100 Subject: [PATCH] [Minor] Add some of my cursor rules --- .cursor/rules/commits-and-tags.mdc | 4 +++- .cursor/rules/rspamd.mdc | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .cursor/rules/rspamd.mdc diff --git a/.cursor/rules/commits-and-tags.mdc b/.cursor/rules/commits-and-tags.mdc index 35b6157be..e02f0fb74 100644 --- a/.cursor/rules/commits-and-tags.mdc +++ b/.cursor/rules/commits-and-tags.mdc @@ -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 index 000000000..f9f6c2a5f --- /dev/null +++ b/.cursor/rules/rspamd.mdc @@ -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.