From 2c0fd4f86b011bbc8c0d86c61f96ade3ea249508 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 25 Mar 2026 16:16:42 +0100 Subject: untrack .cursor/ --- .cursor/rules/writing-scannable-code.mdc | 52 -------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 .cursor/rules/writing-scannable-code.mdc (limited to '.cursor/rules/writing-scannable-code.mdc') diff --git a/.cursor/rules/writing-scannable-code.mdc b/.cursor/rules/writing-scannable-code.mdc deleted file mode 100644 index 2c36d496..00000000 --- a/.cursor/rules/writing-scannable-code.mdc +++ /dev/null @@ -1,52 +0,0 @@ ---- -alwaysApply: false ---- -# Scannable Code Guidelines/Separating Concerns. - -## Core Principle - -Code should be scannable through proper abstraction, not comments. Use variables and helper functions to make intent clear at a glance. - -## Good Scannable Code - -- Extract complex logic into well-named variables -- Create helper functions for multi-step operations -- Use descriptive names that explain intent - -Examples: - -```javascript -// ✅ Scannable: Intent is clear from variable names -const isValidUser = user.isActive && user.hasPermissions; -const shouldProcessPayment = amount > 0 && !order.isPaid; - -// ✅ Scannable: Complex logic extracted to helper -const searchParams = buildFreesoundSearchParams({ query, filters, pagination }); -const transformedResults = transformFreesoundResults({ rawResults }); -``` - -## Bad Unscannable Code - -Avoid: - -```javascript -// ❌ Hard to scan: What does this condition mean? -if (type === "effects" || !type) { - params.append("filter", "duration:[* TO 30.0]"); - params.append("filter", `avg_rating:[${min_rating} TO *]`); - if (commercial_only) { - params.append("filter", 'license:("Attribution" OR "Creative Commons 0")'); - } -} - -// ❌ Hard to scan: Complex ternary -const sortParam = query - ? sort === "score" - ? "score" - : `${sort}_desc` - : `${sort}_desc`; -``` - -## Rule - -Make code scannable by extracting intent into variables and helper functions. If you need to think about what code does, extract it. The reader should understand the flow without diving into implementation details. \ No newline at end of file -- cgit v1.3.1