mago.toml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. version = "1"
  2. php-version = "8.2"
  3. [source]
  4. paths = ["src", "tests"]
  5. includes = ["vendor"]
  6. [formatter]
  7. empty-line-after-opening-tag = false
  8. [linter.rules]
  9. # 库需兼容 PHP >= 7.2,禁用依赖高版本语法的规则
  10. # 数字字面量下划线分隔符需 PHP 7.4+,库不可用
  11. readable-literal = { enabled = false }
  12. # 文件系统尽力操作(清理、锁竞争兜底)有意使用 @ 抑制警告
  13. no-error-control-operator = { enabled = false }
  14. too-many-methods = { threshold = 30 }
  15. too-many-properties = { threshold = 15 }
  16. cyclomatic-complexity = { threshold = 100 }
  17. literal-named-argument = { enabled = false }
  18. prefer-arrow-function = { enabled = false }
  19. strict-types = { enabled = false }
  20. # 遗留代码风格,不做强制
  21. no-empty = { enabled = false }
  22. no-isset = { enabled = false }
  23. no-shorthand-ternary = { enabled = false }
  24. # 示例配置中的占位密钥、测试中的 fake 凭证均为误报
  25. no-literal-password = { exclude = ["src/config", "tests"] }
  26. # 阈值放宽(AdapterAbstract 承担分片上传公共能力后方法/复杂度上升)
  27. kan-defect = { threshold = 4.0 }
  28. halstead = { effort-threshold = 20000 }
  29. [analyzer]
  30. find-unused-expressions = true
  31. analyze-dead-code = true
  32. # 遗留代码缺少类型标注,mixed 类检查噪音过大
  33. ignore = [
  34. "invalid-destructuring-source", # 七牛 SDK 返回 [ret, err] 无类型标注
  35. "invalid-member-selector", # Storage::__callStatic 动态方法转发
  36. "mismatched-array-index", # 七牛 SDK putFile docblock 标注有误
  37. "mixed-argument",
  38. "mixed-array-access",
  39. "mixed-assignment",
  40. "mixed-method-access",
  41. "mixed-operand",
  42. "mixed-property-type-coercion",
  43. "mixed-return-statement",
  44. "possible-method-access-on-null", # webman request() 等 helper 无返回类型标注
  45. "possibly-false-argument",
  46. "too-many-arguments", # OSS SDK 构造函数使用 func_get_args
  47. "unknown-class-instantiation", # Storage::disk 按配置动态实例化适配器
  48. ]