-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.codacy.yml
More file actions
107 lines (96 loc) · 3.93 KB
/
.codacy.yml
File metadata and controls
107 lines (96 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
# Codacy Configuration for EngineScript
# Excludes API endpoint patterns that are intentional by design
exclude_paths:
# Documentation files with intentional long lines
- 'config/var/www/admin/control-panel/external-services/README.md'
- '.codacy-review-notes.md'
# WordPress core files - not under our control
- 'config/var/www/wordpress/wp-config.php'
- 'config/var/www/wordpress/**'
engines:
# PHP Code Sniffer Configuration
phpcs:
enabled: true
exclude_patterns:
# API endpoint files use intentional patterns for HTTP responses
- 'config/var/www/admin/control-panel/external-services/external-services-api.php'
- 'config/var/www/admin/control-panel/api.php'
configuration:
# Use PSR-12 standard but allow API endpoint patterns
standard: PSR12
# Markdown Linting Configuration
markdownlint:
enabled: true
exclude_patterns:
# Documentation with URLs and technical content needs flexible line length
- '**/README.md'
configuration:
# Disable line length rules for documentation
MD013: false # Line length
MD033: false # Inline HTML allowed
MD041: false # First line heading level
# PHP Mess Detector Configuration
phpmd:
enabled: true
exclude_patterns:
# API files have intentional patterns
- 'config/var/www/admin/control-panel/external-services/external-services-api.php'
- 'config/var/www/admin/control-panel/api.php'
configuration:
rulesets:
- cleancode
- codesize
- design
- naming
# Ignore specific rules for API files
exclude:
- ExitExpression # API endpoints must exit after JSON output
- ElseExpression # Necessary for feed parsing logic
- LongMethod # Feed parsers are inherently complex
# Security Analysis Configuration
codacy-security-patterns:
enabled: true
exclude_patterns:
# API endpoint files require $_GET, header(), echo for functionality
- 'config/var/www/admin/control-panel/external-services/external-services-api.php'
- 'config/var/www/admin/control-panel/api.php'
# Pattern-Specific Suppressions
patterns:
# Suppress WordPress-specific rules for non-WordPress code
- pattern_id: CSRF_NonceMissing
enabled: false
reason: "Not a WordPress project - CSRF protection via CORS and input validation"
- pattern_id: WordPress_InputNotUnslashed
enabled: false
reason: "Not a WordPress environment - wp_unslash() function doesn't exist"
# Suppress discouraged function warnings for legitimate API endpoint use
- pattern_id: PHP_DiscouragedFunctions
parameters:
exclude_functions:
- header # Required for Content-Type in API responses
- echo # Required for JSON output in API endpoints
- exit # Required to terminate after API response
- die # Required for security (forbidden access)
- file_get_contents # Used for outbound HTTP requests with timeout
- stream_context_create # Required for HTTP timeout configuration
reason: "API endpoints require these functions for proper HTTP response handling"
# Suppress direct superglobal access when properly validated
- pattern_id: PHP_DirectSuperglobalAccess
exclude_paths:
- 'config/var/www/admin/control-panel/external-services/external-services-api.php'
- 'config/var/www/admin/control-panel/api.php'
reason: "Input validated against strict whitelists and sanitized before use"
# Allow require_once for module inclusion with __DIR__ constant
- pattern_id: PHP_FileManipulation
parameters:
allow_constants:
- __DIR__
- __FILE__
reason: "Module inclusion with hardcoded paths is safe and necessary"
# Custom Ignore Comments
# Codacy recognizes these formats in code:
# - @codacy ignore <rule_name>
# - @codacy [<rule_description>] <explanation>
# - codacy-disable
# - codacy-enable