whitejv MilanoWaterProject .cursorrules file for C (stars: 1)

# Add version and description at the top
version: "1.0"
description: "Configuration for mixed C/Go development with emphasis on type safety and code quality"

# .cursorrules file for Mixed C and Go Development
 rules: {
        "context_initialization": {
            "description": "Starting point for each interaction",
            "steps": [
                "ALWAYS read `.notes/project_overview.md` and `.notes/task_list.md`"
            ]
        },
        "operational_protocol": {
            "description": "How to approach tasks",
            "before_action": [
                "Create a MECE task breakdown"
            ],
            "code_changes": [
                "Read relevant code sections before editing",
                "Preserve existing functionality",
                "Maintain type safety"
            ]
        },
        "safety_requirements": [
            "NEVER break type safety",
            "ALWAYS maintain proper error handling",
            "ALWAYS document new code"
        ],
        "priorities": [
            {
                "source": ".notes/",
                "weight": 1.0
            }
        ],
        "modes": {
            "base": {
                "description": "For routine tasks",
                "triggers": [
                    "simple bug fixes",
                    "documentation updates",
                    "minor feature additions"
                ]
            },
            "enhanced": {
                "description": "For complex problems",
                "triggers": [
                    "architectural changes",
                    "performance optimization",
                    "security-related changes",
                    "cross-language integration"
                ]
            }
        },
        "project_directives": {
            "name": "mwp_project",
            "ai_first": true
        }
    }

# Language-specific rules
c_rules:
    struct_rules:
        - enforce: function_name_style
          style: camelCase
        - enforce: variable_name_style
          style: underscore
        - enforce: max_line_length
          length: 80
    style_rules:
        - enforce: indentation
          style: spaces
          spaces: 3
        - enforce: comment_style
          type: block

go_rules:
    struct_rules:
        - enforce: function_name_style
          style: mixed  # camelCase for internal, PascalCase for exported
        - enforce: variable_name_style
          style: camelCase
        - enforce: max_line_length
          length: 120
    style_rules:
        - enforce: indentation
          style: tabs
          width: 1
        - enforce: comment_style
          type: godoc

# Common rules for both languages
integration_rules:
    - enforce: mqtt_client_configuration
      mode: priority-based
      requirements:
          - use_tls: true
          - unique_client_id: true
          - reconnect_strategy: exponential_backoff
          - qos_level: 1
    - enforce: influxdb_integration
      default_resolution: 1s
      requirements:
          - batch_size: 1000
          - timeout: 5s
          - retry_interval: 1s

version_control_rules:
    - enforce: commit_message_format
      format: "JIRA-123: Description of changes"
    - enforce: branch_naming_convention
      convention: feature/issue-description

# File-based rules
file_rules:
    - pattern: "*.c"
      use_rules: c_rules
    - pattern: "*.h"
      use_rules: c_rules
    - pattern: "*.go"
      use_rules: go_rules

# Testing practices
testing_rules:
    c_tests:
        - enforce: unit_testing
          framework: unity
        - enforce: test_naming
          convention: test_function_name
    go_tests:
        - enforce: test_naming
          convention: TestFunctionName
        - enforce: test_coverage
          minimum: 80

# Common best practices
best_practices:
    - encourage: code_reviews
    - encourage: documentation
    - enforce: error_handling
      c_style: return_codes
      go_style: explicit_errors

# Project structure
project_structure:
    c_source:
        - path: "/src/c"
          rules: c_rules
    go_source:
        - path: "/src/go"
          rules: go_rules
    shared:
        - path: "/src/common"
          rules: common_rules

# IDE settings
ide_settings:
    description: "Editor settings are maintained in .editorconfig file"
    reference: ".editorconfig"

# Add error handling specifics
error_handling:
    c_code:
        - enforce: return_codes
          rules:
              - negative_for_errors
              - zero_for_success
              - error_constants_defined
    go_code:
        - enforce: explicit_errors
          rules:
              - wrap_errors
              - custom_error_types
              - error_documentation

# Add missing common_rules section
common_rules:
    naming_conventions:
        - enforce: file_naming
          style: lowercase_with_underscores
        - enforce: constant_naming
          style: UPPERCASE_WITH_UNDERSCORES
    documentation:
        - enforce: changelog_updates
        - enforce: readme_maintenance
      
c
c++
cmake
go
golang
makefile
python
rich text format
+1 more

First Time Repository

Milano Water Project Refactor

C

Languages:

C: 339.2KB
C++: 261.3KB
CMake: 9.3KB
Go: 11.5KB
Makefile: 36.1KB
Python: 5.4KB
Rich Text Format: 22.1KB
Shell: 5.0KB
Created: 12/24/2021
Updated: 1/14/2025

All Repositories (1)

Milano Water Project Refactor