|
| 1 | +# CodeRabbit Configuration |
| 2 | +# Configuration for code quality, security, and linting |
| 3 | + |
| 4 | +# Linting configuration |
| 5 | +lint: |
| 6 | + # Dockerfile linting |
| 7 | + dockerfile: |
| 8 | + enabled: true |
| 9 | + config: |
| 10 | + rules: |
| 11 | + hadolint: |
| 12 | + DL3008: warning # Pin versions in apt-get install |
| 13 | + DL3013: warning # Pin versions in pip install |
| 14 | + DL4000: error # MAINTAINER is deprecated |
| 15 | + DL3003: error # Use WORKDIR instead of cd |
| 16 | + DL3007: warning # Using latest is discouraged |
| 17 | + DL3015: error # Avoid additional packages |
| 18 | + DL3018: warning # Pin versions in apk add |
| 19 | + DL3020: error # Use COPY instead of ADD |
| 20 | + DL3045: warning # COPY with more than 2 arguments |
| 21 | + DL3059: error # Multiple consecutive RUN commands |
| 22 | + |
| 23 | + # HTML linting (using HTMLHint) |
| 24 | + html: |
| 25 | + enabled: true |
| 26 | + config: |
| 27 | + rules: |
| 28 | + 'tagname-lowercase': true |
| 29 | + 'attr-lowercase': true |
| 30 | + 'attr-value-double-quotes': true |
| 31 | + 'spec-char-escape': true |
| 32 | + 'id-unique': true |
| 33 | + 'src-not-empty': true |
| 34 | + 'alt-require': true |
| 35 | + 'title-require': true |
| 36 | + 'doctype-first': true |
| 37 | + 'id-class-value': 'dash' |
| 38 | + 'inline-style-disabled': true |
| 39 | + 'inline-script-disabled': true |
| 40 | + 'space-tab-mixed-disabled': 'space' |
| 41 | + 'id-class-ad-disabled': true |
| 42 | + 'href-abs-or-rel': false |
| 43 | + 'attr-unsafe-chars': true |
| 44 | + |
| 45 | + # CSS/SCSS linting (using Stylelint) |
| 46 | + css: |
| 47 | + enabled: true |
| 48 | + config: |
| 49 | + extends: 'stylelint-config-standard' |
| 50 | + rules: |
| 51 | + 'at-rule-no-unknown': [true, { |
| 52 | + ignoreAtRules: ['tailwind', 'apply', 'layer', 'variants', 'responsive', 'screen'] |
| 53 | + }] |
| 54 | + 'declaration-block-trailing-semicolon': 'always' |
| 55 | + 'no-descending-specificity': null |
| 56 | + 'selector-class-pattern': '^[a-z][a-zA-Z0-9]+$' |
| 57 | + 'selector-pseudo-class-no-unknown': [true, { |
| 58 | + ignorePseudoClasses: ['global'] |
| 59 | + }] |
| 60 | + 'property-no-unknown': [true, { |
| 61 | + ignoreProperties: ['composes'] |
| 62 | + }] |
| 63 | + |
| 64 | + # Shell script linting (using ShellCheck) |
| 65 | + shell: |
| 66 | + enabled: true |
| 67 | + config: |
| 68 | + exclude: |
| 69 | + - SC1090 # Can't follow non-constant source |
| 70 | + - SC1091 # Not following |
| 71 | + - SC2155 # Declare and assign separately |
| 72 | + warning: |
| 73 | + - SC2086 # Double quote to prevent globbing |
| 74 | + - SC2006 # Use $(...) notation |
| 75 | + - SC2016 # Expressions don't expand in single quotes |
| 76 | + error: |
| 77 | + - SC2181 # Check exit code directly |
| 78 | + - SC2317 # Command appears to be unreachable |
| 79 | + |
| 80 | + # Markdown linting |
| 81 | + markdown: |
| 82 | + enabled: true |
| 83 | + config: |
| 84 | + MD013: # Line length |
| 85 | + line_length: 120 |
| 86 | + code_blocks: false |
| 87 | + tables: false |
| 88 | + MD033: # Inline HTML |
| 89 | + allowed_elements: ['br', 'img', 'a', 'div', 'h1', 'h2', 'h3', 'p', 'b', 'i', 'u'] |
| 90 | + MD041: # First line should be a top-level heading |
| 91 | + level: 1 |
| 92 | + MD047: # Files should end with a single newline |
| 93 | + require: true |
| 94 | + |
| 95 | + # Python linting (using Pylint) |
| 96 | + python: |
| 97 | + enabled: true |
| 98 | + config: |
| 99 | + master: |
| 100 | + disable: 'C0114,C0115,C0116' # Disable docstring requirements |
| 101 | + messages_control: |
| 102 | + disable: |
| 103 | + - 'C0103' # Invalid name |
| 104 | + - 'R0903' # Too few public methods |
| 105 | + - 'R0913' # Too many arguments |
| 106 | + basic: |
| 107 | + max-line-length: 120 |
| 108 | + format: |
| 109 | + max-line-length: 120 |
| 110 | + design: |
| 111 | + max-args: 6 |
| 112 | + max-locals: 15 |
| 113 | + max-returns: 6 |
| 114 | + max-statements: 50 |
| 115 | + similarity: |
| 116 | + min-similarity-lines: 4 |
| 117 | + |
| 118 | + # JavaScript/TypeScript linting (ESLint) |
| 119 | + javascript: |
| 120 | + enabled: true |
| 121 | + config: |
| 122 | + extends: |
| 123 | + - 'eslint:recommended' |
| 124 | + - 'plugin:@typescript-eslint/recommended' |
| 125 | + - 'plugin:react/recommended' |
| 126 | + - 'plugin:react-hooks/recommended' |
| 127 | + parser: '@typescript-eslint/parser' |
| 128 | + parserOptions: |
| 129 | + ecmaVersion: 2021, |
| 130 | + sourceType: 'module', |
| 131 | + ecmaFeatures: |
| 132 | + jsx: true |
| 133 | + settings: |
| 134 | + react: |
| 135 | + version: 'detect' |
| 136 | + rules: |
| 137 | + # Core rules |
| 138 | + 'no-console': 'warn', |
| 139 | + 'no-debugger': 'error', |
| 140 | + 'no-unused-vars': ['warn', { 'argsIgnorePattern': '^_', 'varsIgnorePattern': '^_' }], |
| 141 | + 'prefer-const': 'warn', |
| 142 | + 'eqeqeq': ['error', 'always'], |
| 143 | + 'no-eval': 'error', |
| 144 | + 'no-var': 'error', |
| 145 | + 'prefer-template': 'warn', |
| 146 | + 'template-curly-spacing': 'error', |
| 147 | + 'no-duplicate-imports': 'error', |
| 148 | + 'no-useless-constructor': 'warn', |
| 149 | + 'no-useless-rename': 'warn', |
| 150 | + 'rest-spread-spacing': 'error', |
| 151 | + 'semi': ['error', 'always'], |
| 152 | + 'quotes': ['error', 'single', { 'avoidEscape': true }], |
| 153 | + 'indent': ['error', 2, { 'SwitchCase': 1 }], |
| 154 | + 'comma-dangle': ['error', 'always-multiline'], |
| 155 | + 'object-curly-spacing': ['error', 'always'], |
| 156 | + 'array-bracket-spacing': ['error', 'never'], |
| 157 | + 'keyword-spacing': 'error', |
| 158 | + 'space-before-blocks': 'error', |
| 159 | + 'space-before-function-paren': ['error', 'never'], |
| 160 | + 'space-in-parens': ['error', 'never'], |
| 161 | + 'space-infix-ops': 'error', |
| 162 | + 'space-unary-ops': 'error', |
| 163 | + 'spaced-comment': 'warn', |
| 164 | + 'arrow-spacing': 'error', |
| 165 | + 'no-implied-eval': 'error', |
| 166 | + 'no-multi-spaces': 'error', |
| 167 | + 'no-multi-str': 'error', |
| 168 | + 'no-new-wrappers': 'error', |
| 169 | + 'no-self-compare': 'error', |
| 170 | + 'no-sequences': 'error', |
| 171 | + 'no-throw-literal': 'error', |
| 172 | + 'no-unused-expressions': 'warn', |
| 173 | + 'no-useless-call': 'error', |
| 174 | + 'no-void': 'error', |
| 175 | + 'prefer-promise-reject-errors': 'error', |
| 176 | + 'radix': 'error', |
| 177 | + 'yoda': 'error', |
| 178 | + |
| 179 | + # TypeScript specific |
| 180 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 181 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 182 | + '@typescript-eslint/no-explicit-any': 'warn', |
| 183 | + '@typescript-eslint/no-unused-vars': ['warn', { 'argsIgnorePattern': '^_', 'varsIgnorePattern': '^_' }], |
| 184 | + |
| 185 | + # React specific |
| 186 | + 'react/react-in-jsx-scope': 'off', |
| 187 | + 'react/prop-types': 'off', |
| 188 | + 'react/jsx-uses-react': 'off', |
| 189 | + 'react/jsx-uses-vars': 'error', |
| 190 | + 'react-hooks/rules-of-hooks': 'error', |
| 191 | + 'react-hooks/exhaustive-deps': 'warn' |
| 192 | + |
| 193 | +review: |
| 194 | + enabled: true |
| 195 | + auto_submit: true |
| 196 | + update_comment: true |
| 197 | + |
| 198 | +comments: |
| 199 | + show_code_suggestions: true |
| 200 | + show_security_issues: true |
| 201 | + show_performance_improvements: true |
| 202 | + |
| 203 | +# Focus on source and test files only |
| 204 | +files: |
| 205 | + include: |
| 206 | + - "src/**/*" |
| 207 | + - "tests/**/*" |
| 208 | + - "*.{js,ts,json,md}" |
| 209 | + |
| 210 | + # Exclude common directories and files |
| 211 | + exclude: |
| 212 | + - "**/node_modules" |
| 213 | + - "**/dist" |
| 214 | + - "**/build" |
| 215 | + - "**/*.min.*" |
| 216 | + - "**/.git" |
| 217 | + - "**/package-lock.json" |
| 218 | + - "**/yarn.lock" |
| 219 | + - "**/__pycache__/**" |
| 220 | + |
| 221 | +# Security scanning |
| 222 | +security: |
| 223 | + enabled: true |
| 224 | + dependency_check: true # Checks package.json for known vulnerabilities |
| 225 | + secret_scanning: true # Looks for exposed secrets |
| 226 | + |
| 227 | +# Basic PR quality checks |
| 228 | +pr_size: |
| 229 | + large_threshold: 500 # Warn if PR > 500 lines |
| 230 | + xlarge_threshold: 1000 # Block if PR > 1000 lines |
| 231 | + |
| 232 | +# Documentation checks |
| 233 | +documentation: |
| 234 | + require_updates: true |
| 235 | + check_readme: true |
| 236 | + |
| 237 | +# Simple custom rules |
| 238 | +custom_rules: |
| 239 | + - name: "Avoid console.log in production" |
| 240 | + pattern: "console\\.(log|warn|error|info)" |
| 241 | + message: "Consider using a proper logging library in production" |
| 242 | + level: "warning" |
| 243 | + |
| 244 | +# Ignore common directories |
| 245 | +global_ignore: |
| 246 | + - "**/node_modules" |
| 247 | + - "**/dist" |
| 248 | + - "**/build" |
| 249 | + - "**/.git" |
| 250 | + - "**/*.min.*" |
| 251 | + - "**/__pycache__/**" |
| 252 | + |
| 253 | +# Basic PR requirements |
| 254 | +pr_description: |
| 255 | + required: true |
| 256 | + min_length: 200 |
| 257 | + require_issue_reference: true |
0 commit comments