# Long Parameter List
# Detects functions with 6+ parameters
id: long-parameter-list
name: Long Parameter List
severity: warning
category: complexity
defect_class: safety
inline_tier: review
language: typescript

message: "Function has {{PARAM_COUNT}} parameters — use object pattern"

description: |
  Functions with many parameters are hard to use and maintain.
  Use an options object instead.
  
  ✅ FIX: Convert to options object pattern

query: |
  (function_declaration
    name: (identifier) @NAME
    parameters: (formal_parameters) @PARAMS
    body: (statement_block) @BODY)

metavars:
  - NAME
  - PARAMS
  - BODY

# Post-filter: count parameters
post_filter: count_params
post_filter_params:
  min_params: 6

tags:
  - complexity
  - refactoring
  - maintainability

examples:
  bad: |
    function createUser(
      firstName, lastName, email, 
      password, age, role, status
    ) {
      // ...
    }
  
  good: |
    interface CreateUserOptions {
      firstName: string;
      lastName: string;
      email: string;
      password: string;
      age: number;
      role: string;
      status: string;
    }
    
    function createUser(options: CreateUserOptions) {
      // ...
    }

has_fix: false
