@sun-asterisk/sunlint 1.3.39 → 1.3.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (422) hide show
  1. package/config/rules/rules-registry-generated.json +134 -108
  2. package/docs/GENERATED_FILES_QUICK_REFERENCE.md +96 -0
  3. package/docs/GENERATED_FILE_HANDLING_SUMMARY.md +152 -0
  4. package/docs/skills/CREATE_NEW_DART_RULE.md +161 -14
  5. package/origin-rules/dart-en.md +151 -163
  6. package/package.json +2 -1
  7. package/rules/dart/D002_dispose_resources/config.json +25 -0
  8. package/rules/dart/D003_prefer_widgets_over_methods/config.json +14 -0
  9. package/rules/dart/D004_avoid_shrinkwrap_listview/config.json +13 -0
  10. package/rules/dart/D005_limit_widget_nesting/config.json +13 -0
  11. package/rules/dart/D006_prefer_extracting_large_callbacks/config.json +25 -0
  12. package/rules/dart/D007_prefer_init_first_dispose_last/config.json +10 -0
  13. package/rules/dart/D008_avoid_long_functions/config.json +12 -0
  14. package/rules/dart/D009_limit_function_parameters/config.json +13 -0
  15. package/rules/dart/D010_limit_cyclomatic_complexity/config.json +12 -0
  16. package/rules/dart/D011_prefer_named_parameters/config.json +12 -0
  17. package/rules/dart/D012_prefer_named_boolean_parameters/config.json +9 -0
  18. package/rules/dart/D013_single_public_class/config.json +10 -0
  19. package/rules/dart/D014_unsafe_collection_access/config.json +10 -0
  20. package/rules/dart/D015_copywith_all_parameters/config.json +9 -0
  21. package/rules/dart/D016_project_should_have_tests/config.json +24 -0
  22. package/rules/dart/D017_pubspec_dependencies_review/config.json +23 -0
  23. package/rules/dart/D018_remove_commented_code/config.json +13 -0
  24. package/rules/dart/D019_avoid_single_child_multi_child_widget/config.json +21 -0
  25. package/rules/dart/D020_limit_if_else_branches/config.json +12 -0
  26. package/rules/dart/D021_avoid_negated_boolean_checks/config.json +14 -0
  27. package/rules/dart/D022_use_setstate_correctly/config.json +14 -0
  28. package/rules/dart/D023_avoid_unnecessary_method_overrides/config.json +13 -0
  29. package/rules/dart/D024_avoid_unnecessary_stateful_widget/config.json +9 -0
  30. package/rules/dart/D025_avoid_nested_conditional_expressions/config.json +9 -0
  31. package/skill-assets/sunlint-code-quality/AGENTS.md +80 -0
  32. package/skill-assets/sunlint-code-quality/SKILL.md +176 -0
  33. package/skill-assets/sunlint-code-quality/rules/csharp/C006-verb-noun-functions.md +36 -0
  34. package/skill-assets/sunlint-code-quality/rules/csharp/C013-no-dead-code.md +38 -0
  35. package/skill-assets/sunlint-code-quality/rules/csharp/C014-dependency-injection.md +45 -0
  36. package/skill-assets/sunlint-code-quality/rules/csharp/C017-no-constructor-logic.md +46 -0
  37. package/skill-assets/sunlint-code-quality/rules/csharp/C018-generic-errors.md +38 -0
  38. package/skill-assets/sunlint-code-quality/rules/csharp/C019-error-log-level.md +29 -0
  39. package/skill-assets/sunlint-code-quality/rules/csharp/C020-no-unused-imports.md +30 -0
  40. package/skill-assets/sunlint-code-quality/rules/csharp/C022-no-unused-variables.md +33 -0
  41. package/skill-assets/sunlint-code-quality/rules/csharp/C023-no-duplicate-names.md +36 -0
  42. package/skill-assets/sunlint-code-quality/rules/csharp/C024-centralize-constants.md +33 -0
  43. package/skill-assets/sunlint-code-quality/rules/csharp/C029-catch-log-root-cause.md +40 -0
  44. package/skill-assets/sunlint-code-quality/rules/csharp/C030-custom-error-classes.md +38 -0
  45. package/skill-assets/sunlint-code-quality/rules/csharp/C033-separate-data-access.md +53 -0
  46. package/skill-assets/sunlint-code-quality/rules/csharp/C035-error-context-logging.md +31 -0
  47. package/skill-assets/sunlint-code-quality/rules/csharp/C041-no-hardcoded-secrets.md +25 -0
  48. package/skill-assets/sunlint-code-quality/rules/csharp/C042-boolean-naming.md +27 -0
  49. package/skill-assets/sunlint-code-quality/rules/csharp/C052-controller-parsing.md +41 -0
  50. package/skill-assets/sunlint-code-quality/rules/csharp/C060-superclass-logic.md +33 -0
  51. package/skill-assets/sunlint-code-quality/rules/csharp/C067-no-hardcoded-config.md +24 -0
  52. package/skill-assets/sunlint-code-quality/rules/csharp/S003-open-redirect.md +47 -0
  53. package/skill-assets/sunlint-code-quality/rules/csharp/S004-no-log-credentials.md +28 -0
  54. package/skill-assets/sunlint-code-quality/rules/csharp/S005-server-authorization.md +51 -0
  55. package/skill-assets/sunlint-code-quality/rules/csharp/S006-default-credentials.md +42 -0
  56. package/skill-assets/sunlint-code-quality/rules/csharp/S007-output-encoding.md +36 -0
  57. package/skill-assets/sunlint-code-quality/rules/csharp/S009-approved-crypto.md +37 -0
  58. package/skill-assets/sunlint-code-quality/rules/csharp/S010-csprng.md +32 -0
  59. package/skill-assets/sunlint-code-quality/rules/csharp/S011-encrypted-client-hello.md +36 -0
  60. package/skill-assets/sunlint-code-quality/rules/csharp/S012-secrets-management.md +35 -0
  61. package/skill-assets/sunlint-code-quality/rules/csharp/S013-tls-connections.md +36 -0
  62. package/skill-assets/sunlint-code-quality/rules/csharp/S016-no-sensitive-query-string.md +39 -0
  63. package/skill-assets/sunlint-code-quality/rules/csharp/S017-parameterized-queries.md +47 -0
  64. package/skill-assets/sunlint-code-quality/rules/csharp/S019-email-input-sanitization.md +35 -0
  65. package/skill-assets/sunlint-code-quality/rules/csharp/S020-eval-code-execution.md +56 -0
  66. package/skill-assets/sunlint-code-quality/rules/csharp/S022-context-escaping.md +50 -0
  67. package/skill-assets/sunlint-code-quality/rules/csharp/S023-dynamic-js-encoding.md +34 -0
  68. package/skill-assets/sunlint-code-quality/rules/csharp/S025-server-validation.md +56 -0
  69. package/skill-assets/sunlint-code-quality/rules/csharp/S026-tls-encryption.md +28 -0
  70. package/skill-assets/sunlint-code-quality/rules/csharp/S027-mtls-validation.md +40 -0
  71. package/skill-assets/sunlint-code-quality/rules/csharp/S028-upload-limits.md +50 -0
  72. package/skill-assets/sunlint-code-quality/rules/csharp/S029-csrf-protection.md +42 -0
  73. package/skill-assets/sunlint-code-quality/rules/csharp/S030-directory-browsing.md +26 -0
  74. package/skill-assets/sunlint-code-quality/rules/csharp/S031-secure-cookie-flag.md +35 -0
  75. package/skill-assets/sunlint-code-quality/rules/csharp/S032-httponly-cookie.md +31 -0
  76. package/skill-assets/sunlint-code-quality/rules/csharp/S033-samesite-cookie.md +36 -0
  77. package/skill-assets/sunlint-code-quality/rules/csharp/S034-host-prefix-cookie.md +31 -0
  78. package/skill-assets/sunlint-code-quality/rules/csharp/S035-app-hostnames.md +26 -0
  79. package/skill-assets/sunlint-code-quality/rules/csharp/S036-internal-file-paths.md +36 -0
  80. package/skill-assets/sunlint-code-quality/rules/csharp/S037-anti-cache-headers.md +33 -0
  81. package/skill-assets/sunlint-code-quality/rules/csharp/S039-tls-certificate-validation.md +41 -0
  82. package/skill-assets/sunlint-code-quality/rules/csharp/S041-logout-invalidation.md +36 -0
  83. package/skill-assets/sunlint-code-quality/rules/csharp/S042-long-lived-sessions.md +47 -0
  84. package/skill-assets/sunlint-code-quality/rules/csharp/S044-critical-changes-reauth.md +45 -0
  85. package/skill-assets/sunlint-code-quality/rules/csharp/S045-brute-force-protection.md +48 -0
  86. package/skill-assets/sunlint-code-quality/rules/csharp/S047-oauth-csrf-protection.md +53 -0
  87. package/skill-assets/sunlint-code-quality/rules/csharp/S048-oauth-redirect-validation.md +37 -0
  88. package/skill-assets/sunlint-code-quality/rules/csharp/S049-auth-code-expiry.md +33 -0
  89. package/skill-assets/sunlint-code-quality/rules/csharp/S050-token-entropy.md +33 -0
  90. package/skill-assets/sunlint-code-quality/rules/csharp/S051-password-length.md +35 -0
  91. package/skill-assets/sunlint-code-quality/rules/csharp/S052-otp-entropy.md +26 -0
  92. package/skill-assets/sunlint-code-quality/rules/csharp/S053-generic-error-messages.md +32 -0
  93. package/skill-assets/sunlint-code-quality/rules/csharp/S054-no-default-admin.md +31 -0
  94. package/skill-assets/sunlint-code-quality/rules/csharp/S055-content-type-validation.md +44 -0
  95. package/skill-assets/sunlint-code-quality/rules/csharp/S056-log-injection.md +33 -0
  96. package/skill-assets/sunlint-code-quality/rules/csharp/S057-synchronized-time.md +27 -0
  97. package/skill-assets/sunlint-code-quality/rules/csharp/S058-ssrf-protection.md +54 -0
  98. package/skill-assets/sunlint-code-quality/rules/java/C006-verb-noun-functions.md +36 -0
  99. package/skill-assets/sunlint-code-quality/rules/java/C013-no-dead-code.md +175 -0
  100. package/skill-assets/sunlint-code-quality/rules/java/C014-dependency-injection.md +42 -0
  101. package/skill-assets/sunlint-code-quality/rules/java/C017-no-constructor-logic.md +39 -0
  102. package/skill-assets/sunlint-code-quality/rules/java/C018-generic-errors.md +28 -0
  103. package/skill-assets/sunlint-code-quality/rules/java/C019-error-log-level.md +34 -0
  104. package/skill-assets/sunlint-code-quality/rules/java/C020-no-unused-imports.md +34 -0
  105. package/skill-assets/sunlint-code-quality/rules/java/C022-no-unused-variables.md +31 -0
  106. package/skill-assets/sunlint-code-quality/rules/java/C023-no-duplicate-names.md +37 -0
  107. package/skill-assets/sunlint-code-quality/rules/java/C024-centralize-constants.md +36 -0
  108. package/skill-assets/sunlint-code-quality/rules/java/C029-catch-log-root-cause.md +42 -0
  109. package/skill-assets/sunlint-code-quality/rules/java/C030-custom-error-classes.md +50 -0
  110. package/skill-assets/sunlint-code-quality/rules/java/C033-separate-data-access.md +46 -0
  111. package/skill-assets/sunlint-code-quality/rules/java/C035-error-context-logging.md +38 -0
  112. package/skill-assets/sunlint-code-quality/rules/java/C041-no-hardcoded-secrets.md +34 -0
  113. package/skill-assets/sunlint-code-quality/rules/java/C042-boolean-naming.md +27 -0
  114. package/skill-assets/sunlint-code-quality/rules/java/C052-controller-parsing.md +39 -0
  115. package/skill-assets/sunlint-code-quality/rules/java/C060-superclass-logic.md +32 -0
  116. package/skill-assets/sunlint-code-quality/rules/java/C067-no-hardcoded-config.md +31 -0
  117. package/skill-assets/sunlint-code-quality/rules/java/S003-open-redirect.md +38 -0
  118. package/skill-assets/sunlint-code-quality/rules/java/S004-no-log-credentials.md +36 -0
  119. package/skill-assets/sunlint-code-quality/rules/java/S005-server-authorization.md +53 -0
  120. package/skill-assets/sunlint-code-quality/rules/java/S006-default-credentials.md +39 -0
  121. package/skill-assets/sunlint-code-quality/rules/java/S007-output-encoding.md +49 -0
  122. package/skill-assets/sunlint-code-quality/rules/java/S009-approved-crypto.md +40 -0
  123. package/skill-assets/sunlint-code-quality/rules/java/S010-csprng.md +36 -0
  124. package/skill-assets/sunlint-code-quality/rules/java/S011-encrypted-client-hello.md +27 -0
  125. package/skill-assets/sunlint-code-quality/rules/java/S012-secrets-management.md +34 -0
  126. package/skill-assets/sunlint-code-quality/rules/java/S013-tls-connections.md +40 -0
  127. package/skill-assets/sunlint-code-quality/rules/java/S016-no-sensitive-query-string.md +36 -0
  128. package/skill-assets/sunlint-code-quality/rules/java/S017-parameterized-queries.md +47 -0
  129. package/skill-assets/sunlint-code-quality/rules/java/S019-email-input-sanitization.md +32 -0
  130. package/skill-assets/sunlint-code-quality/rules/java/S020-eval-code-execution.md +45 -0
  131. package/skill-assets/sunlint-code-quality/rules/java/S022-context-escaping.md +28 -0
  132. package/skill-assets/sunlint-code-quality/rules/java/S023-dynamic-js-encoding.md +28 -0
  133. package/skill-assets/sunlint-code-quality/rules/java/S025-server-validation.md +58 -0
  134. package/skill-assets/sunlint-code-quality/rules/java/S026-tls-encryption.md +57 -0
  135. package/skill-assets/sunlint-code-quality/rules/java/S027-mtls-validation.md +26 -0
  136. package/skill-assets/sunlint-code-quality/rules/java/S028-upload-limits.md +35 -0
  137. package/skill-assets/sunlint-code-quality/rules/java/S029-csrf-protection.md +35 -0
  138. package/skill-assets/sunlint-code-quality/rules/java/S030-directory-browsing.md +38 -0
  139. package/skill-assets/sunlint-code-quality/rules/java/S031-secure-cookie-flag.md +38 -0
  140. package/skill-assets/sunlint-code-quality/rules/java/S032-httponly-cookie.md +31 -0
  141. package/skill-assets/sunlint-code-quality/rules/java/S033-samesite-cookie.md +42 -0
  142. package/skill-assets/sunlint-code-quality/rules/java/S034-host-prefix-cookie.md +35 -0
  143. package/skill-assets/sunlint-code-quality/rules/java/S035-app-hostnames.md +23 -0
  144. package/skill-assets/sunlint-code-quality/rules/java/S036-internal-file-paths.md +39 -0
  145. package/skill-assets/sunlint-code-quality/rules/java/S037-anti-cache-headers.md +37 -0
  146. package/skill-assets/sunlint-code-quality/rules/java/S039-tls-certificate-validation.md +43 -0
  147. package/skill-assets/sunlint-code-quality/rules/java/S041-logout-invalidation.md +53 -0
  148. package/skill-assets/sunlint-code-quality/rules/java/S042-long-lived-sessions.md +36 -0
  149. package/skill-assets/sunlint-code-quality/rules/java/S044-critical-changes-reauth.md +28 -0
  150. package/skill-assets/sunlint-code-quality/rules/java/S045-brute-force-protection.md +38 -0
  151. package/skill-assets/sunlint-code-quality/rules/java/S047-oauth-csrf-protection.md +33 -0
  152. package/skill-assets/sunlint-code-quality/rules/java/S048-oauth-redirect-validation.md +25 -0
  153. package/skill-assets/sunlint-code-quality/rules/java/S049-auth-code-expiry.md +23 -0
  154. package/skill-assets/sunlint-code-quality/rules/java/S050-token-entropy.md +20 -0
  155. package/skill-assets/sunlint-code-quality/rules/java/S051-password-length.md +20 -0
  156. package/skill-assets/sunlint-code-quality/rules/java/S052-otp-entropy.md +23 -0
  157. package/skill-assets/sunlint-code-quality/rules/java/S053-generic-error-messages.md +21 -0
  158. package/skill-assets/sunlint-code-quality/rules/java/S054-no-default-admin.md +16 -0
  159. package/skill-assets/sunlint-code-quality/rules/java/S055-content-type-validation.md +36 -0
  160. package/skill-assets/sunlint-code-quality/rules/java/S056-log-injection.md +38 -0
  161. package/skill-assets/sunlint-code-quality/rules/java/S057-synchronized-time.md +35 -0
  162. package/skill-assets/sunlint-code-quality/rules/java/S058-ssrf-protection.md +56 -0
  163. package/skill-assets/sunlint-code-quality/rules/kotlin/C006-verb-noun-functions.md +45 -0
  164. package/skill-assets/sunlint-code-quality/rules/kotlin/C013-no-dead-code.md +49 -0
  165. package/skill-assets/sunlint-code-quality/rules/kotlin/C014-dependency-injection.md +64 -0
  166. package/skill-assets/sunlint-code-quality/rules/kotlin/C017-no-constructor-logic.md +68 -0
  167. package/skill-assets/sunlint-code-quality/rules/kotlin/C018-generic-errors.md +46 -0
  168. package/skill-assets/sunlint-code-quality/rules/kotlin/C019-error-log-level.md +50 -0
  169. package/skill-assets/sunlint-code-quality/rules/kotlin/C020-no-unused-imports.md +44 -0
  170. package/skill-assets/sunlint-code-quality/rules/kotlin/C022-no-unused-variables.md +39 -0
  171. package/skill-assets/sunlint-code-quality/rules/kotlin/C023-no-duplicate-names.md +47 -0
  172. package/skill-assets/sunlint-code-quality/rules/kotlin/C024-centralize-constants.md +58 -0
  173. package/skill-assets/sunlint-code-quality/rules/kotlin/C029-catch-log-root-cause.md +50 -0
  174. package/skill-assets/sunlint-code-quality/rules/kotlin/C030-custom-error-classes.md +72 -0
  175. package/skill-assets/sunlint-code-quality/rules/kotlin/C033-separate-data-access.md +69 -0
  176. package/skill-assets/sunlint-code-quality/rules/kotlin/C035-error-context-logging.md +47 -0
  177. package/skill-assets/sunlint-code-quality/rules/kotlin/C041-no-hardcoded-secrets.md +47 -0
  178. package/skill-assets/sunlint-code-quality/rules/kotlin/C042-boolean-naming.md +42 -0
  179. package/skill-assets/sunlint-code-quality/rules/kotlin/C052-controller-parsing.md +71 -0
  180. package/skill-assets/sunlint-code-quality/rules/kotlin/C060-superclass-logic.md +60 -0
  181. package/skill-assets/sunlint-code-quality/rules/kotlin/C067-no-hardcoded-config.md +51 -0
  182. package/skill-assets/sunlint-code-quality/rules/kotlin/S003-open-redirect.md +66 -0
  183. package/skill-assets/sunlint-code-quality/rules/kotlin/S004-no-log-credentials.md +59 -0
  184. package/skill-assets/sunlint-code-quality/rules/kotlin/S005-server-authorization.md +75 -0
  185. package/skill-assets/sunlint-code-quality/rules/kotlin/S006-default-credentials.md +49 -0
  186. package/skill-assets/sunlint-code-quality/rules/kotlin/S007-output-encoding.md +62 -0
  187. package/skill-assets/sunlint-code-quality/rules/kotlin/S009-approved-crypto.md +51 -0
  188. package/skill-assets/sunlint-code-quality/rules/kotlin/S010-csprng.md +61 -0
  189. package/skill-assets/sunlint-code-quality/rules/kotlin/S011-encrypted-client-hello.md +48 -0
  190. package/skill-assets/sunlint-code-quality/rules/kotlin/S012-secrets-management.md +53 -0
  191. package/skill-assets/sunlint-code-quality/rules/kotlin/S013-tls-connections.md +61 -0
  192. package/skill-assets/sunlint-code-quality/rules/kotlin/S016-no-sensitive-query-string.md +51 -0
  193. package/skill-assets/sunlint-code-quality/rules/kotlin/S017-parameterized-queries.md +41 -0
  194. package/skill-assets/sunlint-code-quality/rules/kotlin/S019-email-input-sanitization.md +50 -0
  195. package/skill-assets/sunlint-code-quality/rules/kotlin/S020-eval-code-execution.md +57 -0
  196. package/skill-assets/sunlint-code-quality/rules/kotlin/S022-context-escaping.md +58 -0
  197. package/skill-assets/sunlint-code-quality/rules/kotlin/S023-dynamic-js-encoding.md +57 -0
  198. package/skill-assets/sunlint-code-quality/rules/kotlin/S025-server-validation.md +59 -0
  199. package/skill-assets/sunlint-code-quality/rules/kotlin/S026-tls-encryption.md +50 -0
  200. package/skill-assets/sunlint-code-quality/rules/kotlin/S027-mtls-validation.md +60 -0
  201. package/skill-assets/sunlint-code-quality/rules/kotlin/S028-upload-limits.md +67 -0
  202. package/skill-assets/sunlint-code-quality/rules/kotlin/S029-csrf-protection.md +57 -0
  203. package/skill-assets/sunlint-code-quality/rules/kotlin/S030-directory-browsing.md +50 -0
  204. package/skill-assets/sunlint-code-quality/rules/kotlin/S031-secure-cookie-flag.md +51 -0
  205. package/skill-assets/sunlint-code-quality/rules/kotlin/S032-httponly-cookie.md +49 -0
  206. package/skill-assets/sunlint-code-quality/rules/kotlin/S033-samesite-cookie.md +54 -0
  207. package/skill-assets/sunlint-code-quality/rules/kotlin/S034-host-prefix-cookie.md +50 -0
  208. package/skill-assets/sunlint-code-quality/rules/kotlin/S035-app-hostnames.md +59 -0
  209. package/skill-assets/sunlint-code-quality/rules/kotlin/S036-internal-file-paths.md +61 -0
  210. package/skill-assets/sunlint-code-quality/rules/kotlin/S037-anti-cache-headers.md +58 -0
  211. package/skill-assets/sunlint-code-quality/rules/kotlin/S039-tls-certificate-validation.md +62 -0
  212. package/skill-assets/sunlint-code-quality/rules/kotlin/S041-logout-invalidation.md +71 -0
  213. package/skill-assets/sunlint-code-quality/rules/kotlin/S042-long-lived-sessions.md +57 -0
  214. package/skill-assets/sunlint-code-quality/rules/kotlin/S044-critical-changes-reauth.md +64 -0
  215. package/skill-assets/sunlint-code-quality/rules/kotlin/S045-brute-force-protection.md +64 -0
  216. package/skill-assets/sunlint-code-quality/rules/kotlin/S047-oauth-csrf-protection.md +74 -0
  217. package/skill-assets/sunlint-code-quality/rules/kotlin/S048-oauth-redirect-validation.md +61 -0
  218. package/skill-assets/sunlint-code-quality/rules/kotlin/S049-auth-code-expiry.md +70 -0
  219. package/skill-assets/sunlint-code-quality/rules/kotlin/S050-token-entropy.md +65 -0
  220. package/skill-assets/sunlint-code-quality/rules/kotlin/S051-password-length.md +52 -0
  221. package/skill-assets/sunlint-code-quality/rules/kotlin/S052-otp-entropy.md +55 -0
  222. package/skill-assets/sunlint-code-quality/rules/kotlin/S053-generic-error-messages.md +66 -0
  223. package/skill-assets/sunlint-code-quality/rules/kotlin/S054-no-default-admin.md +57 -0
  224. package/skill-assets/sunlint-code-quality/rules/kotlin/S055-content-type-validation.md +58 -0
  225. package/skill-assets/sunlint-code-quality/rules/kotlin/S056-log-injection.md +47 -0
  226. package/skill-assets/sunlint-code-quality/rules/kotlin/S057-synchronized-time.md +49 -0
  227. package/skill-assets/sunlint-code-quality/rules/kotlin/S058-ssrf-protection.md +69 -0
  228. package/skill-assets/sunlint-code-quality/rules/php/C006-verb-noun-functions.md +46 -0
  229. package/skill-assets/sunlint-code-quality/rules/php/C013-no-dead-code.md +53 -0
  230. package/skill-assets/sunlint-code-quality/rules/php/C014-dependency-injection.md +71 -0
  231. package/skill-assets/sunlint-code-quality/rules/php/C017-no-constructor-logic.md +68 -0
  232. package/skill-assets/sunlint-code-quality/rules/php/C018-generic-errors.md +50 -0
  233. package/skill-assets/sunlint-code-quality/rules/php/C019-error-log-level.md +54 -0
  234. package/skill-assets/sunlint-code-quality/rules/php/C020-no-unused-imports.md +55 -0
  235. package/skill-assets/sunlint-code-quality/rules/php/C022-no-unused-variables.md +51 -0
  236. package/skill-assets/sunlint-code-quality/rules/php/C023-no-duplicate-names.md +61 -0
  237. package/skill-assets/sunlint-code-quality/rules/php/C024-centralize-constants.md +60 -0
  238. package/skill-assets/sunlint-code-quality/rules/php/C029-catch-log-root-cause.md +57 -0
  239. package/skill-assets/sunlint-code-quality/rules/php/C030-custom-error-classes.md +62 -0
  240. package/skill-assets/sunlint-code-quality/rules/php/C033-separate-data-access.md +79 -0
  241. package/skill-assets/sunlint-code-quality/rules/php/C035-error-context-logging.md +54 -0
  242. package/skill-assets/sunlint-code-quality/rules/php/C041-no-hardcoded-secrets.md +59 -0
  243. package/skill-assets/sunlint-code-quality/rules/php/C042-boolean-naming.md +52 -0
  244. package/skill-assets/sunlint-code-quality/rules/php/C052-controller-parsing.md +66 -0
  245. package/skill-assets/sunlint-code-quality/rules/php/C060-superclass-logic.md +54 -0
  246. package/skill-assets/sunlint-code-quality/rules/php/C067-no-hardcoded-config.md +55 -0
  247. package/skill-assets/sunlint-code-quality/rules/php/S003-open-redirect.md +60 -0
  248. package/skill-assets/sunlint-code-quality/rules/php/S004-no-log-credentials.md +67 -0
  249. package/skill-assets/sunlint-code-quality/rules/php/S005-server-authorization.md +57 -0
  250. package/skill-assets/sunlint-code-quality/rules/php/S006-default-credentials.md +61 -0
  251. package/skill-assets/sunlint-code-quality/rules/php/S007-output-encoding.md +61 -0
  252. package/skill-assets/sunlint-code-quality/rules/php/S009-approved-crypto.md +53 -0
  253. package/skill-assets/sunlint-code-quality/rules/php/S010-csprng.md +47 -0
  254. package/skill-assets/sunlint-code-quality/rules/php/S011-encrypted-client-hello.md +41 -0
  255. package/skill-assets/sunlint-code-quality/rules/php/S012-secrets-management.md +60 -0
  256. package/skill-assets/sunlint-code-quality/rules/php/S013-tls-connections.md +67 -0
  257. package/skill-assets/sunlint-code-quality/rules/php/S016-no-sensitive-query-string.md +61 -0
  258. package/skill-assets/sunlint-code-quality/rules/php/S017-parameterized-queries.md +44 -0
  259. package/skill-assets/sunlint-code-quality/rules/php/S019-email-input-sanitization.md +54 -0
  260. package/skill-assets/sunlint-code-quality/rules/php/S020-eval-code-execution.md +57 -0
  261. package/skill-assets/sunlint-code-quality/rules/php/S022-context-escaping.md +58 -0
  262. package/skill-assets/sunlint-code-quality/rules/php/S023-dynamic-js-encoding.md +62 -0
  263. package/skill-assets/sunlint-code-quality/rules/php/S025-server-validation.md +63 -0
  264. package/skill-assets/sunlint-code-quality/rules/php/S026-tls-encryption.md +48 -0
  265. package/skill-assets/sunlint-code-quality/rules/php/S027-mtls-validation.md +62 -0
  266. package/skill-assets/sunlint-code-quality/rules/php/S028-upload-limits.md +60 -0
  267. package/skill-assets/sunlint-code-quality/rules/php/S029-csrf-protection.md +65 -0
  268. package/skill-assets/sunlint-code-quality/rules/php/S030-directory-browsing.md +40 -0
  269. package/skill-assets/sunlint-code-quality/rules/php/S031-secure-cookie-flag.md +55 -0
  270. package/skill-assets/sunlint-code-quality/rules/php/S032-httponly-cookie.md +54 -0
  271. package/skill-assets/sunlint-code-quality/rules/php/S033-samesite-cookie.md +52 -0
  272. package/skill-assets/sunlint-code-quality/rules/php/S034-host-prefix-cookie.md +49 -0
  273. package/skill-assets/sunlint-code-quality/rules/php/S035-app-hostnames.md +49 -0
  274. package/skill-assets/sunlint-code-quality/rules/php/S036-internal-file-paths.md +56 -0
  275. package/skill-assets/sunlint-code-quality/rules/php/S037-anti-cache-headers.md +56 -0
  276. package/skill-assets/sunlint-code-quality/rules/php/S039-tls-certificate-validation.md +54 -0
  277. package/skill-assets/sunlint-code-quality/rules/php/S041-logout-invalidation.md +63 -0
  278. package/skill-assets/sunlint-code-quality/rules/php/S042-long-lived-sessions.md +57 -0
  279. package/skill-assets/sunlint-code-quality/rules/php/S044-critical-changes-reauth.md +71 -0
  280. package/skill-assets/sunlint-code-quality/rules/php/S045-brute-force-protection.md +67 -0
  281. package/skill-assets/sunlint-code-quality/rules/php/S047-oauth-csrf-protection.md +72 -0
  282. package/skill-assets/sunlint-code-quality/rules/php/S048-oauth-redirect-validation.md +54 -0
  283. package/skill-assets/sunlint-code-quality/rules/php/S049-auth-code-expiry.md +71 -0
  284. package/skill-assets/sunlint-code-quality/rules/php/S050-token-entropy.md +58 -0
  285. package/skill-assets/sunlint-code-quality/rules/php/S051-password-length.md +59 -0
  286. package/skill-assets/sunlint-code-quality/rules/php/S052-otp-entropy.md +45 -0
  287. package/skill-assets/sunlint-code-quality/rules/php/S053-generic-error-messages.md +59 -0
  288. package/skill-assets/sunlint-code-quality/rules/php/S054-no-default-admin.md +62 -0
  289. package/skill-assets/sunlint-code-quality/rules/php/S055-content-type-validation.md +58 -0
  290. package/skill-assets/sunlint-code-quality/rules/php/S056-log-injection.md +48 -0
  291. package/skill-assets/sunlint-code-quality/rules/php/S057-synchronized-time.md +52 -0
  292. package/skill-assets/sunlint-code-quality/rules/php/S058-ssrf-protection.md +65 -0
  293. package/skill-assets/sunlint-code-quality/rules/python/C006-verb-noun-functions.md +30 -0
  294. package/skill-assets/sunlint-code-quality/rules/python/C013-no-dead-code.md +24 -0
  295. package/skill-assets/sunlint-code-quality/rules/python/C014-dependency-injection.md +68 -0
  296. package/skill-assets/sunlint-code-quality/rules/python/C017-no-constructor-logic.md +30 -0
  297. package/skill-assets/sunlint-code-quality/rules/python/C018-generic-errors.md +25 -0
  298. package/skill-assets/sunlint-code-quality/rules/python/C019-error-log-level.md +26 -0
  299. package/skill-assets/sunlint-code-quality/rules/python/C020-no-unused-imports.md +28 -0
  300. package/skill-assets/sunlint-code-quality/rules/python/C022-no-unused-variables.md +24 -0
  301. package/skill-assets/sunlint-code-quality/rules/python/C023-no-duplicate-names.md +27 -0
  302. package/skill-assets/sunlint-code-quality/rules/python/C024-centralize-constants.md +27 -0
  303. package/skill-assets/sunlint-code-quality/rules/python/C029-catch-log-root-cause.md +61 -0
  304. package/skill-assets/sunlint-code-quality/rules/python/C030-custom-error-classes.md +28 -0
  305. package/skill-assets/sunlint-code-quality/rules/python/C033-separate-data-access.md +53 -0
  306. package/skill-assets/sunlint-code-quality/rules/python/C035-error-context-logging.md +26 -0
  307. package/skill-assets/sunlint-code-quality/rules/python/C041-no-hardcoded-secrets.md +23 -0
  308. package/skill-assets/sunlint-code-quality/rules/python/C042-boolean-naming.md +24 -0
  309. package/skill-assets/sunlint-code-quality/rules/python/C052-controller-parsing.md +34 -0
  310. package/skill-assets/sunlint-code-quality/rules/python/C060-superclass-logic.md +26 -0
  311. package/skill-assets/sunlint-code-quality/rules/python/C067-no-hardcoded-config.md +22 -0
  312. package/skill-assets/sunlint-code-quality/rules/python/S003-open-redirect.md +16 -0
  313. package/skill-assets/sunlint-code-quality/rules/python/S004-no-log-credentials.md +16 -0
  314. package/skill-assets/sunlint-code-quality/rules/python/S005-server-authorization.md +16 -0
  315. package/skill-assets/sunlint-code-quality/rules/python/S006-default-credentials.md +16 -0
  316. package/skill-assets/sunlint-code-quality/rules/python/S007-output-encoding.md +16 -0
  317. package/skill-assets/sunlint-code-quality/rules/python/S009-approved-crypto.md +16 -0
  318. package/skill-assets/sunlint-code-quality/rules/python/S010-csprng.md +16 -0
  319. package/skill-assets/sunlint-code-quality/rules/python/S011-encrypted-client-hello.md +16 -0
  320. package/skill-assets/sunlint-code-quality/rules/python/S012-secrets-management.md +16 -0
  321. package/skill-assets/sunlint-code-quality/rules/python/S013-tls-connections.md +16 -0
  322. package/skill-assets/sunlint-code-quality/rules/python/S016-no-sensitive-query-string.md +16 -0
  323. package/skill-assets/sunlint-code-quality/rules/python/S017-parameterized-queries.md +51 -0
  324. package/skill-assets/sunlint-code-quality/rules/python/S019-email-input-sanitization.md +16 -0
  325. package/skill-assets/sunlint-code-quality/rules/python/S020-eval-code-execution.md +51 -0
  326. package/skill-assets/sunlint-code-quality/rules/python/S022-context-escaping.md +16 -0
  327. package/skill-assets/sunlint-code-quality/rules/python/S023-dynamic-js-encoding.md +16 -0
  328. package/skill-assets/sunlint-code-quality/rules/python/S025-server-validation.md +16 -0
  329. package/skill-assets/sunlint-code-quality/rules/python/S026-tls-encryption.md +16 -0
  330. package/skill-assets/sunlint-code-quality/rules/python/S027-mtls-validation.md +16 -0
  331. package/skill-assets/sunlint-code-quality/rules/python/S028-upload-limits.md +16 -0
  332. package/skill-assets/sunlint-code-quality/rules/python/S029-csrf-protection.md +16 -0
  333. package/skill-assets/sunlint-code-quality/rules/python/S030-directory-browsing.md +16 -0
  334. package/skill-assets/sunlint-code-quality/rules/python/S031-secure-cookie-flag.md +16 -0
  335. package/skill-assets/sunlint-code-quality/rules/python/S032-httponly-cookie.md +16 -0
  336. package/skill-assets/sunlint-code-quality/rules/python/S033-samesite-cookie.md +16 -0
  337. package/skill-assets/sunlint-code-quality/rules/python/S034-host-prefix-cookie.md +16 -0
  338. package/skill-assets/sunlint-code-quality/rules/python/S035-app-hostnames.md +16 -0
  339. package/skill-assets/sunlint-code-quality/rules/python/S036-internal-file-paths.md +50 -0
  340. package/skill-assets/sunlint-code-quality/rules/python/S037-anti-cache-headers.md +16 -0
  341. package/skill-assets/sunlint-code-quality/rules/python/S039-tls-certificate-validation.md +16 -0
  342. package/skill-assets/sunlint-code-quality/rules/python/S041-logout-invalidation.md +16 -0
  343. package/skill-assets/sunlint-code-quality/rules/python/S042-long-lived-sessions.md +16 -0
  344. package/skill-assets/sunlint-code-quality/rules/python/S044-critical-changes-reauth.md +16 -0
  345. package/skill-assets/sunlint-code-quality/rules/python/S045-brute-force-protection.md +16 -0
  346. package/skill-assets/sunlint-code-quality/rules/python/S047-oauth-csrf-protection.md +16 -0
  347. package/skill-assets/sunlint-code-quality/rules/python/S048-oauth-redirect-validation.md +16 -0
  348. package/skill-assets/sunlint-code-quality/rules/python/S049-auth-code-expiry.md +16 -0
  349. package/skill-assets/sunlint-code-quality/rules/python/S050-token-entropy.md +16 -0
  350. package/skill-assets/sunlint-code-quality/rules/python/S051-password-length.md +16 -0
  351. package/skill-assets/sunlint-code-quality/rules/python/S052-otp-entropy.md +16 -0
  352. package/skill-assets/sunlint-code-quality/rules/python/S053-generic-error-messages.md +16 -0
  353. package/skill-assets/sunlint-code-quality/rules/python/S054-no-default-admin.md +16 -0
  354. package/skill-assets/sunlint-code-quality/rules/python/S055-content-type-validation.md +16 -0
  355. package/skill-assets/sunlint-code-quality/rules/python/S056-log-injection.md +16 -0
  356. package/skill-assets/sunlint-code-quality/rules/python/S057-synchronized-time.md +16 -0
  357. package/skill-assets/sunlint-code-quality/rules/python/S058-ssrf-protection.md +57 -0
  358. package/skill-assets/sunlint-code-quality/rules/typescript/C006-verb-noun-functions.md +45 -0
  359. package/skill-assets/sunlint-code-quality/rules/typescript/C013-no-dead-code.md +51 -0
  360. package/skill-assets/sunlint-code-quality/rules/typescript/C014-dependency-injection.md +69 -0
  361. package/skill-assets/sunlint-code-quality/rules/typescript/C017-no-constructor-logic.md +60 -0
  362. package/skill-assets/sunlint-code-quality/rules/typescript/C018-generic-errors.md +47 -0
  363. package/skill-assets/sunlint-code-quality/rules/typescript/C019-error-log-level.md +50 -0
  364. package/skill-assets/sunlint-code-quality/rules/typescript/C020-no-unused-imports.md +55 -0
  365. package/skill-assets/sunlint-code-quality/rules/typescript/C022-no-unused-variables.md +59 -0
  366. package/skill-assets/sunlint-code-quality/rules/typescript/C023-no-duplicate-names.md +58 -0
  367. package/skill-assets/sunlint-code-quality/rules/typescript/C024-centralize-constants.md +56 -0
  368. package/skill-assets/sunlint-code-quality/rules/typescript/C029-catch-log-root-cause.md +53 -0
  369. package/skill-assets/sunlint-code-quality/rules/typescript/C030-custom-error-classes.md +60 -0
  370. package/skill-assets/sunlint-code-quality/rules/typescript/C033-separate-data-access.md +69 -0
  371. package/skill-assets/sunlint-code-quality/rules/typescript/C035-error-context-logging.md +50 -0
  372. package/skill-assets/sunlint-code-quality/rules/typescript/C041-no-hardcoded-secrets.md +47 -0
  373. package/skill-assets/sunlint-code-quality/rules/typescript/C042-boolean-naming.md +42 -0
  374. package/skill-assets/sunlint-code-quality/rules/typescript/C052-controller-parsing.md +64 -0
  375. package/skill-assets/sunlint-code-quality/rules/typescript/C060-superclass-logic.md +67 -0
  376. package/skill-assets/sunlint-code-quality/rules/typescript/C067-no-hardcoded-config.md +52 -0
  377. package/skill-assets/sunlint-code-quality/rules/typescript/S003-open-redirect.md +76 -0
  378. package/skill-assets/sunlint-code-quality/rules/typescript/S004-no-log-credentials.md +71 -0
  379. package/skill-assets/sunlint-code-quality/rules/typescript/S005-server-authorization.md +68 -0
  380. package/skill-assets/sunlint-code-quality/rules/typescript/S006-default-credentials.md +69 -0
  381. package/skill-assets/sunlint-code-quality/rules/typescript/S007-output-encoding.md +60 -0
  382. package/skill-assets/sunlint-code-quality/rules/typescript/S009-approved-crypto.md +53 -0
  383. package/skill-assets/sunlint-code-quality/rules/typescript/S010-csprng.md +53 -0
  384. package/skill-assets/sunlint-code-quality/rules/typescript/S011-encrypted-client-hello.md +45 -0
  385. package/skill-assets/sunlint-code-quality/rules/typescript/S012-secrets-management.md +47 -0
  386. package/skill-assets/sunlint-code-quality/rules/typescript/S013-tls-connections.md +70 -0
  387. package/skill-assets/sunlint-code-quality/rules/typescript/S016-no-sensitive-query-string.md +53 -0
  388. package/skill-assets/sunlint-code-quality/rules/typescript/S017-parameterized-queries.md +55 -0
  389. package/skill-assets/sunlint-code-quality/rules/typescript/S019-email-input-sanitization.md +56 -0
  390. package/skill-assets/sunlint-code-quality/rules/typescript/S020-eval-code-execution.md +58 -0
  391. package/skill-assets/sunlint-code-quality/rules/typescript/S022-context-escaping.md +48 -0
  392. package/skill-assets/sunlint-code-quality/rules/typescript/S023-dynamic-js-encoding.md +52 -0
  393. package/skill-assets/sunlint-code-quality/rules/typescript/S025-server-validation.md +62 -0
  394. package/skill-assets/sunlint-code-quality/rules/typescript/S026-tls-encryption.md +47 -0
  395. package/skill-assets/sunlint-code-quality/rules/typescript/S027-mtls-validation.md +50 -0
  396. package/skill-assets/sunlint-code-quality/rules/typescript/S028-upload-limits.md +65 -0
  397. package/skill-assets/sunlint-code-quality/rules/typescript/S029-csrf-protection.md +62 -0
  398. package/skill-assets/sunlint-code-quality/rules/typescript/S030-directory-browsing.md +52 -0
  399. package/skill-assets/sunlint-code-quality/rules/typescript/S031-secure-cookie-flag.md +48 -0
  400. package/skill-assets/sunlint-code-quality/rules/typescript/S032-httponly-cookie.md +36 -0
  401. package/skill-assets/sunlint-code-quality/rules/typescript/S033-samesite-cookie.md +46 -0
  402. package/skill-assets/sunlint-code-quality/rules/typescript/S034-host-prefix-cookie.md +50 -0
  403. package/skill-assets/sunlint-code-quality/rules/typescript/S035-app-hostnames.md +49 -0
  404. package/skill-assets/sunlint-code-quality/rules/typescript/S036-internal-file-paths.md +53 -0
  405. package/skill-assets/sunlint-code-quality/rules/typescript/S037-anti-cache-headers.md +52 -0
  406. package/skill-assets/sunlint-code-quality/rules/typescript/S039-tls-certificate-validation.md +51 -0
  407. package/skill-assets/sunlint-code-quality/rules/typescript/S041-logout-invalidation.md +58 -0
  408. package/skill-assets/sunlint-code-quality/rules/typescript/S042-long-lived-sessions.md +55 -0
  409. package/skill-assets/sunlint-code-quality/rules/typescript/S044-critical-changes-reauth.md +69 -0
  410. package/skill-assets/sunlint-code-quality/rules/typescript/S045-brute-force-protection.md +59 -0
  411. package/skill-assets/sunlint-code-quality/rules/typescript/S047-oauth-csrf-protection.md +60 -0
  412. package/skill-assets/sunlint-code-quality/rules/typescript/S048-oauth-redirect-validation.md +59 -0
  413. package/skill-assets/sunlint-code-quality/rules/typescript/S049-auth-code-expiry.md +73 -0
  414. package/skill-assets/sunlint-code-quality/rules/typescript/S050-token-entropy.md +48 -0
  415. package/skill-assets/sunlint-code-quality/rules/typescript/S051-password-length.md +60 -0
  416. package/skill-assets/sunlint-code-quality/rules/typescript/S052-otp-entropy.md +49 -0
  417. package/skill-assets/sunlint-code-quality/rules/typescript/S053-generic-error-messages.md +61 -0
  418. package/skill-assets/sunlint-code-quality/rules/typescript/S054-no-default-admin.md +64 -0
  419. package/skill-assets/sunlint-code-quality/rules/typescript/S055-content-type-validation.md +64 -0
  420. package/skill-assets/sunlint-code-quality/rules/typescript/S056-log-injection.md +48 -0
  421. package/skill-assets/sunlint-code-quality/rules/typescript/S057-synchronized-time.md +57 -0
  422. package/skill-assets/sunlint-code-quality/rules/typescript/S058-ssrf-protection.md +63 -0
@@ -7,283 +7,271 @@
7
7
  - **Objective**: Ensure code quality through standard lint configurations
8
8
  - **Details**: The `analysis_options.yaml` file should include recommended lint packages (flutter_lints, very_good_analysis, or lints) and critical lint rules should not be disabled. This ensures consistent code quality standards across the project.
9
9
  - **Applies to**: Flutter/Dart
10
- - **Tools**: `dart lint` (flutter_lints, very_good_analysis, lints)
10
+ - **Tools**: Custom analyzer (D001)
11
11
  - **Principles**: CODE_QUALITY
12
12
  - **Version**: 1.0
13
13
  - **Status**: activated
14
14
  - **Severity**: major
15
15
 
16
- ### 📘 Rule D002 – Avoid using single cascade (..) operators
16
+ ### 📘 Rule D002 – Always Dispose Resources and Remove Listeners
17
17
 
18
- - **Objective**: Write clear, readable code
19
- - **Details**: Only use cascade (`..`) when performing multiple consecutive operations on the same object. Avoid using it for single operations.
18
+ - **Objective**: Prevent memory leaks by ensuring proper resource disposal
19
+ - **Details**: All disposable resources (Controllers, StreamSubscriptions, FocusNodes, Listeners) must be properly disposed in the `dispose()` method. This includes TextEditingController, AnimationController, ScrollController, StreamSubscription, FocusNode, and other resources that implement Disposable. Failing to dispose these resources leads to memory leaks.
20
20
  - **Applies to**: Flutter/Dart
21
- - **Tools**: `dart lint` (`avoid_single_cascade_in_expression_statements`)
22
- - **Principles**: CODE_QUALITY
21
+ - **Tools**: Custom analyzer (D002)
22
+ - **Principles**: CODE_QUALITY, PERFORMANCE
23
23
  - **Version**: 1.0
24
24
  - **Status**: activated
25
- - **Severity**: major
25
+ - **Severity**: error
26
26
 
27
- ### 📘 Rule D003 – Avoid calling methods/accessing properties on dynamic types
27
+ ### 📘 Rule D003 – Prefer Widgets Over Methods Returning Widgets
28
28
 
29
- - **Objective**: Prevent runtime errors due to lack of type checking
30
- - **Details**: Avoid using `dynamic.foo()` or `dynamic.bar` without proper checking
29
+ - **Objective**: Improve performance and maintainability by extracting widget-returning methods into widget classes
30
+ - **Details**: Methods that return widgets should be extracted into separate StatelessWidget or StatefulWidget classes. This improves performance as Flutter can optimize widget rebuilds, makes code more reusable, and follows Flutter best practices. Only the build() method and lifecycle methods are exempt from this rule.
31
31
  - **Applies to**: Flutter/Dart
32
- - **Tools**: `dart lint` (`avoid_dynamic_calls`)
33
- - **Principles**: CODE_QUALITY, SECURITY
32
+ - **Tools**: Custom analyzer (D003)
33
+ - **Principles**: CODE_QUALITY, PERFORMANCE
34
34
  - **Version**: 1.0
35
35
  - **Status**: activated
36
- - **Severity**: critical
36
+ - **Severity**: warning
37
37
 
38
- ### 📘 Rule D004 – Use standard `package:` imports
38
+ ### 📘 Rule D004 – Avoid shrinkWrap in ListView
39
39
 
40
- - **Objective**: Reduce confusion in imports
41
- - **Details**: Avoid mixing relative and package imports which can cause circular errors or alias errors when a file is imported in two different ways.
40
+ - **Objective**: Prevent performance issues caused by shrinkWrap in scrollable widgets
41
+ - **Details**: Using `shrinkWrap: true` in ListView or GridView disables lazy loading and forces all items to render at once, causing severe performance degradation. Instead, use Expanded or Flexible widgets to constrain the ListView size, or use SliverList within a CustomScrollView for better performance. The shrinkWrap parameter should only be used in rare cases where the list is guaranteed to be small.
42
42
  - **Applies to**: Flutter/Dart
43
- - **Tools**: `dart lint` (`always_use_package_imports`)
44
- - **Principles**: CODE_QUALITY
43
+ - **Tools**: Custom analyzer (D004)
44
+ - **Principles**: CODE_QUALITY, PERFORMANCE
45
45
  - **Version**: 1.0
46
46
  - **Status**: activated
47
- - **Severity**: major
47
+ - **Severity**: warning
48
48
 
49
- ### 📘 Rule D005 – Always declare function return types
49
+ ### 📘 Rule D005 – Limit Widget Nesting Depth to 6
50
50
 
51
- - **Objective**: Clarify logic and increase reliability in type checking
52
- - **Details**:
53
- - Avoid `dynamic` returns or unclear type inference
54
- - Helps analyzer perform more complete code analysis to find potential runtime errors
51
+ - **Objective**: Maintain code readability and prevent performance issues caused by deeply nested widgets
52
+ - **Details**: Widget nesting should not exceed 6 levels in the build method. Deeply nested widgets make code harder to understand, maintain, and can impact performance. When nesting exceeds this limit, extract nested widgets into separate StatelessWidget or StatefulWidget classes. This improves code organization, reusability, and allows Flutter to optimize widget rebuilds more effectively.
55
53
  - **Applies to**: Flutter/Dart
56
- - **Tools**: `dart lint` (`always_declare_return_types`)
57
- - **Principles**: CODE_QUALITY
54
+ - **Tools**: Custom analyzer (D005)
55
+ - **Principles**: CODE_QUALITY, MAINTAINABILITY, PERFORMANCE
58
56
  - **Version**: 1.0
59
57
  - **Status**: activated
60
- - **Severity**: major
58
+ - **Severity**: warning
61
59
 
62
- ### 📘 Rule D006 – Do not override `==` and `hashCode` in mutable classes
60
+ ### 📘 Rule D006 – Prefer Extracting Large Callbacks from Build
63
61
 
64
- - **Objective**: Prevent logic errors when using mutable objects in collections.
65
- - **Details**: Equality should be based on immutable values
62
+ - **Objective**: Improve code readability and testability by extracting large callback functions
63
+ - **Details**: Callback functions (onTap, onPressed, onChanged, etc.) in widget builders should not exceed 5 lines. Large inline callbacks make the build method harder to read and maintain. Extract callbacks that exceed this limit to separate methods or functions. This improves code organization, makes the build method more readable, and allows callbacks to be tested independently. Common callback properties include onTap, onPressed, onChanged, onSubmitted, onLongPress, builder, and itemBuilder.
66
64
  - **Applies to**: Flutter/Dart
67
- - **Tools**: `dart lint` (`avoid_equals_and_hash_code_on_mutable_classes`)
68
- - **Principles**: CODE_QUALITY
65
+ - **Tools**: Custom analyzer (D006)
66
+ - **Principles**: CODE_QUALITY, MAINTAINABILITY, TESTABILITY
69
67
  - **Version**: 1.0
70
68
  - **Status**: activated
71
- - **Severity**: critical
69
+ - **Severity**: warning
72
70
 
73
- ### 📘 Rule D007 – Do not pass default values when calling functions
71
+ ### 📘 Rule D007 – Prefer Init First, Dispose Last
74
72
 
75
- - **Objective**: Avoid redundancy and clarify intent
76
- - **Details**: If a function has default parameters, no need to pass the same value again
73
+ - **Objective**: Ensure proper lifecycle method ordering in StatefulWidget
74
+ - **Details**: In StatefulWidget lifecycle methods, super.initState() should be called first before any initialization code, and super.dispose() should be called last after all cleanup code. This ensures that the framework's internal state management is properly initialized before your code runs and is the last to clean up. Calling super.initState() first allows the framework to set up necessary internal state before your initialization logic. Calling super.dispose() last ensures all your cleanup code executes before the framework's cleanup, preventing potential null pointer exceptions or resource leaks.
77
75
  - **Applies to**: Flutter/Dart
78
- - **Tools**: `dart lint` (`avoid_redundant_argument_values`)
79
- - **Principles**: CODE_QUALITY, PERFORMANCE
76
+ - **Tools**: Custom analyzer (D007)
77
+ - **Principles**: CODE_QUALITY, MAINTAINABILITY, LIFECYCLE_MANAGEMENT
80
78
  - **Version**: 1.0
81
79
  - **Status**: activated
82
- - **Severity**: major
80
+ - **Severity**: warning
83
81
 
84
- ### 📘 Rule D008 – Avoid slow async functions in `dart:io`
85
-
86
- - **Objective**: Optimize I/O performance
87
- - **Details**: Avoid the following slow async functions:
88
- - `Directory.exists`
89
- - `Directory.stat`
90
- - `File.lastModified`
91
- - `File.exists`
92
- - `File.stat`
93
- - `FileSystemEntity.isDirectory`
94
- - `FileSystemEntity.isFile`
95
- - `FileSystemEntity.isLink`
96
- - `FileSystemEntity.type`
82
+ ### 📘 Rule D008 – Avoid Long Functions
83
+
84
+ - **Objective**: Improve code readability and maintainability by limiting function length
85
+ - **Details**: Functions should not exceed 60 lines of effective code (excluding comments and opening/closing braces). Long functions are harder to understand, test, and maintain. They often indicate that the function is doing too much and should be broken down into smaller, more focused functions. The line count excludes blank lines, comments (both single-line // and multi-line /* */), and the opening { and closing } braces. The maximum line limit is configurable.
97
86
  - **Applies to**: Flutter/Dart
98
- - **Tools**: `dart lint` (`avoid_slow_async_io`)
99
- - **Principles**: CODE_QUALITY, PERFORMANCE
87
+ - **Tools**: Custom analyzer (D008)
88
+ - **Principles**: CODE_QUALITY, MAINTAINABILITY, READABILITY
100
89
  - **Version**: 1.0
101
90
  - **Status**: activated
102
- - **Severity**: major
91
+ - **Severity**: warning
103
92
 
104
- ### 📘 Rule D009 – Do not use throw or control flow in `finally`
93
+ ### 📘 Rule D009 – Limit Function Parameters
105
94
 
106
- - **Objective**: Avoid unexpected behavior
107
- - **Details**: Do not use `return`, `break`, `throw` in `finally` blocks
95
+ - **Objective**: Improve code readability by limiting the number of function parameters
96
+ - **Details**: Functions, methods, and constructors should not have more than 5 parameters (configurable). Too many parameters make code harder to read, understand, and maintain. When a function needs many parameters, consider grouping related parameters into a data class or using named parameters with a configuration object.
108
97
  - **Applies to**: Flutter/Dart
109
- - **Tools**: `dart lint` (`control_flow_in_finally`, `throw_in_finally`)
110
- - **Principles**: CODE_QUALITY
98
+ - **Tools**: Custom analyzer (D009)
99
+ - **Principles**: CODE_QUALITY, MAINTAINABILITY, READABILITY
111
100
  - **Version**: 1.0
112
101
  - **Status**: activated
113
- - **Severity**: critical
102
+ - **Severity**: warning
114
103
 
115
- ### 📘 Rule D010 – Handle all cases when using `switch` with enums or enum-like classes
104
+ ### 📘 Rule D010 – Limit Cyclomatic Complexity
116
105
 
117
- - **Objective**: Avoid missing cases
118
- - **Details**: When using `switch` with `enum`, always handle all cases completely.
106
+ - **Objective**: Improve code readability and maintainability by limiting cyclomatic complexity
107
+ - **Details**: Functions, methods, and constructors should not have cyclomatic complexity exceeding 10 (configurable). High cyclomatic complexity indicates that the code has too many independent paths, making it harder to understand, test, and maintain. The metric counts: if statements, catch blocks, loops (for, while, do), conditional expressions (? :), switch cases (except default/last), null-aware operators (?., ?[], ...?, ??), logical operators (&& and ||), and null coalescing operators (?? and ??=).
119
108
  - **Applies to**: Flutter/Dart
120
- - **Tools**: `dart lint` (`exhaustive_cases`)
121
- - **Principles**: CODE_QUALITY
109
+ - **Tools**: Custom analyzer (D010)
110
+ - **Principles**: CODE_QUALITY, MAINTAINABILITY, READABILITY
122
111
  - **Version**: 1.0
123
112
  - **Status**: activated
124
- - **Severity**: major
113
+ - **Severity**: warning
125
114
 
126
- ### 📘 Rule D011 – Avoid importing `.dart` files from `lib/src` of other packages
115
+ ### 📘 Rule D011 – Prefer Named Parameters
127
116
 
128
- - **Objective**: Avoid unstable dependencies that cause breaking changes.
129
- - **Details**: Only import from public API (`lib/src`) within the same package, not from other packages.
117
+ - **Objective**: Improve code readability and prevent parameter confusion
118
+ - **Details**: Functions, methods, and constructors with more than 3 parameters that have 2 or more adjacent parameters of the same type should use named parameters. This improves code clarity by making it explicit which value corresponds to which parameter, reducing the risk of accidentally swapping arguments of the same type. Named parameters make function calls self-documenting and easier to maintain.
130
119
  - **Applies to**: Flutter/Dart
131
- - **Tools**: `dart lint` (`implementation_imports`)
132
- - **Principles**: CODE_QUALITY, SECURITY
120
+ - **Tools**: Custom analyzer (D011)
121
+ - **Principles**: CODE_QUALITY, READABILITY, MAINTAINABILITY
133
122
  - **Version**: 1.0
134
123
  - **Status**: activated
135
- - **Severity**: major
124
+ - **Severity**: warning
136
125
 
137
- ### 📘 Rule D012 – Avoid passing null to closure parameters
126
+ ### 📘 Rule D012 – Prefer Named Boolean Parameters
138
127
 
139
- - **Objective**: Prevent runtime exceptions
140
- - **Details**: Typically, a closure passed to a method will only be called conditionally, using `null` will lead to exceptions or unexpected logic.
128
+ - **Objective**: Improve code readability by avoiding unclear boolean parameters
129
+ - **Details**: Boolean parameters in functions make code harder to understand at call sites. When a function has 1-2 parameters with a boolean, consider creating separate functions (e.g., `enableUser`/`disableUser` instead of `setUser(userId, true)`). For functions with multiple parameters including booleans, use named parameters to make the intent explicit (e.g., `createUser(name: 'John', isActive: true)` instead of `createUser('John', true)`).
141
130
  - **Applies to**: Flutter/Dart
142
- - **Tools**: `dart lint` (`null_closures`)
143
- - **Principles**: CODE_QUALITY, SECURITY
131
+ - **Tools**: Custom analyzer (D012)
132
+ - **Principles**: CODE_QUALITY, READABILITY, MAINTAINABILITY
144
133
  - **Version**: 1.0
145
134
  - **Status**: activated
146
- - **Severity**: major
135
+ - **Severity**: warning
147
136
 
148
- ### 📘 Rule D013 – Use adjacent strings or interpolation to create strings
137
+ ### 📘 Rule D013 – Prefer a Single Public Class Per File
149
138
 
150
- - **Objective**: Easier to read and more efficient
151
- - **Details**: Use adjacent strings or interpolation to create strings
139
+ - **Objective**: Improve code organization and maintainability
140
+ - **Details**: Each Dart file should contain only one public class (class names not starting with underscore). Multiple public classes in a single file make code harder to navigate, test, and maintain. Private classes (names starting with `_`) can coexist with a single public class as they are implementation details. This rule encourages better file organization and follows Dart's convention of one public declaration per file.
152
141
  - **Applies to**: Flutter/Dart
153
- - **Tools**: `dart lint` (`prefer_adjacent_string_concatenation`, `prefer_interpolation_to_compose_strings`)
154
- - **Principles**: CODE_QUALITY, PERFORMANCE
142
+ - **Tools**: Custom analyzer (D013)
143
+ - **Principles**: CODE_QUALITY, ORGANIZATION, MAINTAINABILITY
155
144
  - **Version**: 1.0
156
145
  - **Status**: activated
157
- - **Severity**: major
146
+ - **Severity**: warning
158
147
 
159
- ### 📘 Rule D014 – Use conditional assignment `??=` instead of `if-null-then-assign`
148
+ ### 📘 Rule D014 – Avoid Unsafe Collection Access
160
149
 
161
- - **Objective**: More concise and clear meaning
162
- - **Details**: Use `a ??= b` instead of `if (a == null) a = b;`
150
+ - **Objective**: Prevent runtime errors from accessing empty collections
151
+ - **Details**: Using `.first`, `.last`, `.single`, or `.elementAt()` on collections without checking if they're empty or have sufficient length can cause runtime exceptions. Always check `isEmpty`, `isNotEmpty`, or `length` before accessing, or use safe alternatives like `firstOrNull`, `lastOrNull`, `singleOrNull`. These methods throw `StateError` when the collection is empty or doesn't meet the required conditions, leading to crashes in production.
163
152
  - **Applies to**: Flutter/Dart
164
- - **Tools**: `dart lint` (`prefer_conditional_assignment`)
165
- - **Principles**: CODE_QUALITY, MAINTAINABILITY
153
+ - **Tools**: Custom analyzer (D014)
154
+ - **Principles**: CODE_QUALITY, SAFETY, ERROR_PREVENTION
166
155
  - **Version**: 1.0
167
156
  - **Status**: activated
168
- - **Severity**: major
157
+ - **Severity**: warning
169
158
 
170
- ### 📘 Rule D015 – Use `final`, `const` for immutable variables
159
+ ### 📘 Rule D015 – Ensure copyWith includes all constructor parameters
171
160
 
172
- - **Objective**: Prevent bugs from unintended value changes
173
- - **Details**: Use `final` or `const` for variables that don't change throughout their lifetime
161
+ - **Objective**: Maintain data integrity and completeness in immutable objects
162
+ - **Details**: When a class implements a `copyWith` method for creating modified copies, it should include all constructor parameters. Missing parameters in `copyWith` can lead to unintended data loss or inability to update certain fields. This is especially important for data classes, models, and immutable state objects.
174
163
  - **Applies to**: Flutter/Dart
175
- - **Tools**: `dart lint` (`prefer_final_fields`, `prefer_const_declarations`, `prefer_const_constructors`)
176
- - **Principles**: CODE_QUALITY
164
+ - **Tools**: Custom analyzer (D015)
165
+ - **Principles**: CODE_QUALITY, IMMUTABILITY, DATA_INTEGRITY
177
166
  - **Version**: 1.0
178
167
  - **Status**: activated
179
- - **Severity**: major
168
+ - **Severity**: warning
180
169
 
181
- ### 📘 Rule D016 – Use explicit definitions for function types in parameters
170
+ ### 📘 Rule D016 – Project should have tests
182
171
 
183
- - **Objective**: Increase clarity and accurate type checking
184
- - **Details**: Use `generic function type syntax` for parameters.
172
+ - **Objective**: Ensure code quality and prevent regressions through automated testing
173
+ - **Details**: Every Dart/Flutter project should have a `test` directory containing test files (files ending with `_test.dart`). Tests are essential for maintaining code quality, catching bugs early, and enabling safe refactoring. Without tests, code changes become risky and technical debt accumulates. Projects should have at least one test file to demonstrate testing infrastructure is in place.
185
174
  - **Applies to**: Flutter/Dart
186
- - **Tools**: `dart lint` (`use_function_type_syntax_for_parameters`)
187
- - **Principles**: CODE_QUALITY
175
+ - **Tools**: Custom analyzer (D016)
176
+ - **Principles**: CODE_QUALITY, TESTING, MAINTAINABILITY
188
177
  - **Version**: 1.0
189
178
  - **Status**: activated
190
- - **Severity**: major
179
+ - **Severity**: warning
191
180
 
192
- ### 📘 Rule D017 – Ensure simple and correct Regex syntax
181
+ ### 📘 Rule D017 – Pubspec dependencies should be reviewed regularly
193
182
 
194
- - **Objective**: Prevent logic errors from invalid expressions
195
- - **Details**: Use clear, simple Regex patterns. Avoid incorrect or overly complex expressions
183
+ - **Objective**: Ensure dependencies are kept up-to-date for security and stability
184
+ - **Details**: Dependencies in `pubspec.yaml` should be reviewed and updated regularly (default: every 4 months). Outdated dependencies may contain security vulnerabilities, bugs, or miss performance improvements. Regular reviews help maintain project health and reduce technical debt. The rule checks the last modification time of `pubspec.lock` (or `pubspec.yaml` if lock file is not available) and warns if it exceeds the configured threshold. This encourages teams to regularly audit dependencies, update to newer versions, and test for compatibility issues.
196
185
  - **Applies to**: Flutter/Dart
197
- - **Tools**: `dart lint` (`valid_regexps`)
198
- - **Principles**: CODE_QUALITY
186
+ - **Tools**: Custom analyzer (D017)
187
+ - **Principles**: SECURITY, MAINTAINABILITY, CODE_QUALITY
199
188
  - **Version**: 1.0
200
189
  - **Status**: activated
201
- - **Severity**: major
190
+ - **Severity**: warning
202
191
 
203
- ### 📘 Rule D018 – Use `rethrow` instead of `throw` when re-throwing errors
192
+ ### 📘 Rule D018 – Remove Commented-Out Code
204
193
 
205
- - **Objective**: Preserve original error stack trace
206
- - **Details**: In catch blocks, use `rethrow` to re-throw the same caught error
194
+ - **Objective**: Keep codebase clean by removing commented-out code
195
+ - **Details**: Commented-out code should be removed instead of being left in the source files. Dead code comments create clutter, make the codebase harder to read, and cause confusion about what code is actually active. If you need to reference old code, use version control systems (Git) to track history. The rule detects blocks of 2 or more consecutive lines that appear to be commented-out code (containing keywords like var, if, class, function calls, operators, etc.) and suggests removing them. Documentation comments (///, /**) are excluded from this check.
207
196
  - **Applies to**: Flutter/Dart
208
- - **Tools**: `dart lint` (`use_rethrow_when_possible`)
209
- - **Principles**: CODE_QUALITY
197
+ - **Tools**: Custom analyzer (D018)
198
+ - **Principles**: CODE_QUALITY, MAINTAINABILITY, READABILITY
210
199
  - **Version**: 1.0
211
200
  - **Status**: activated
212
- - **Severity**: major
201
+ - **Severity**: warning
213
202
 
214
- ### 📘 Rule D019 – Use `isEmpty` / `isNotEmpty` for String, Iterable and Map
203
+ ### 📘 Rule D019 – Avoid Single Child in Multi-Child Widget
215
204
 
216
- - **Objective**: Clear meaning and better performance
217
- - **Details**: Instead of `list.length == 0`, use `list.isEmpty`
205
+ - **Objective**: Use appropriate widget types for the number of children
206
+ - **Details**: Multi-child widgets like Column, Row, Wrap, Stack, Flex, ListView, GridView, and CustomScrollView are designed to handle multiple children (via `children` or `slivers` parameters). Using these widgets with only a single child or sliver is inefficient and indicates poor widget choice. Instead, use single-child widgets like Container, SizedBox, Padding, or Center which are optimized for single children. This improves performance and makes the code intent clearer.
218
207
  - **Applies to**: Flutter/Dart
219
- - **Tools**: `dart lint` (`prefer_is_empty`, `prefer_is_not_empty`)
220
- - **Principles**: CODE_QUALITY
208
+ - **Tools**: Custom analyzer (D019)
209
+ - **Principles**: CODE_QUALITY, PERFORMANCE, MAINTAINABILITY
221
210
  - **Version**: 1.0
222
211
  - **Status**: activated
223
- - **Severity**: major
224
-
225
- ### 📘 Rule D020 – Ensure valid URLs in `pubspec.yaml`
226
-
227
- - **Objective**: Avoid metadata errors and poor security
228
- - **Details**: Do not use `http://` or placeholder URLs like `example.com`
229
- - **Applies to**: Flutter/Dart
230
- - **Tools**: `dart lint` (`secure_pubspec_urls`)
231
- - **Principles**: SECURITY
212
+ - **Severity**: warning
213
+ ### 📘 Rule D020 – Limit If/Else Branches
214
+
215
+ - **Objective**: Reduce complexity by limiting the number of if/else branches
216
+ - **Details**: Complex if/else chains with more than 3 branches reduce code readability and increase cyclomatic complexity. When facing multiple branches, consider using switch statements, lookup tables (Maps), polymorphism, or strategy pattern. This makes code easier to understand, test, and maintain. The default limit is 3 branches (e.g., if + else if + else).
217
+ - **Applies to**: Dart/Flutter
218
+ - **Tools**: Custom analyzer (D020)
219
+ - **Principles**: CODE_QUALITY, MAINTAINABILITY, READABILITY
232
220
  - **Version**: 1.0
233
221
  - **Status**: activated
234
- - **Severity**: major
222
+ - **Severity**: warning
235
223
 
236
- ### 📘 Rule D021 – Use `BuildContext` synchronously
224
+ ### 📘 Rule D021 – Avoid Negated Boolean Checks
237
225
 
238
- - **Objective**: Prevent errors when `context` changes after `await`
239
- - **Details**: Use `BuildContext` carefully in asynchronous functions
240
- - **Applies to**: Flutter/Dart
241
- - **Tools**: `flutter_lints` (`use_build_context_synchronously`)
242
- - **Principles**: CODE_QUALITY
226
+ - **Objective**: Improve code readability by avoiding inverted or negated boolean conditions
227
+ - **Details**: Negated boolean checks (using `!` operator) make code harder to read and understand. Replace negative conditions with positive ones: use `if (isSuccess)` instead of `if (!isError)`, use `a != b` instead of `!(a == b)`, avoid double negation like `!(!isValid)`. For boolean variables frequently used with negation, consider renaming them to express the positive state (e.g., `isEnabled` instead of using `!isDisabled`). Apply De Morgan's law for compound conditions: `!(a && b)` becomes `!a || !b`.
228
+ - **Applies to**: Dart/Flutter
229
+ - **Tools**: Custom analyzer (D021)
230
+ - **Principles**: CODE_QUALITY, READABILITY
243
231
  - **Version**: 1.0
244
232
  - **Status**: activated
245
- - **Severity**: critical
233
+ - **Severity**: warning
246
234
 
247
- ### 📘 Rule D022 – Place `child:` at the end when constructing widgets
235
+ ### 📘 Rule D022 – Use setState Correctly
248
236
 
249
- - **Objective**: Help readability of widget tree and UI structure
250
- - **Details**: Parameters like `child`, `children` should be placed last in widget constructors
237
+ - **Objective**: Ensure setState is used correctly in StatefulWidget to avoid performance issues and bugs
238
+ - **Details**: Common setState anti-patterns include: calling setState inside the build() method (causes infinite rebuild loops), nesting setState calls (unnecessary rebuilds), making multiple setState calls in the same method (should be combined for performance), using async callbacks in setState (state updates should be synchronous). Always perform async operations outside setState and combine multiple state changes into a single setState call.
251
239
  - **Applies to**: Flutter/Dart
252
- - **Tools**: `flutter_lints` (`sort_child_properties_last`)
253
- - **Principles**: CODE_QUALITY
240
+ - **Tools**: Custom analyzer (D022)
241
+ - **Principles**: CODE_QUALITY, PERFORMANCE, BEST_PRACTICES
254
242
  - **Version**: 1.0
255
243
  - **Status**: activated
256
- - **Severity**: major
244
+ - **Severity**: warning
257
245
 
258
- ### 📘 Rule D023 – Prefer using `contains` for `List` and `String`
246
+ ### 📘 Rule D023 – Avoid Unnecessary Method Overrides
259
247
 
260
- - **Objective**: Easier to read and more efficient
261
- - **Details**: Use `contains` instead of `indexOf` to check for element existence in `List` or `String`.
262
- - **Applies to**: Flutter/Dart
263
- - **Tools**: `dart lint` (`prefer_contains`)
264
- - **Principles**: CODE_QUALITY, SECURITY
248
+ - **Objective**: Remove methods that only call super with the same parameters as they add no value
249
+ - **Details**: Methods that override a parent method but only call `super.methodName()` with the same parameters are unnecessary and should be removed. These empty overrides add no functionality and create unnecessary code clutter. Common examples include lifecycle methods like `initState()`, `dispose()`, or `didUpdateWidget()` that only call their super implementation. Removing these unnecessary overrides improves code readability and reduces maintenance burden.
250
+ - **Applies to**: Dart/Flutter
251
+ - **Tools**: Custom analyzer (D023)
252
+ - **Principles**: CODE_QUALITY, MAINTAINABILITY, READABILITY
265
253
  - **Version**: 1.0
266
254
  - **Status**: activated
267
- - **Severity**: major
255
+ - **Severity**: warning
268
256
 
269
- ### 📘 Rule D024 – Use `??` to convert `null` to `bool`
257
+ ### 📘 Rule D024 – Avoid Unnecessary StatefulWidget
270
258
 
271
- - **Objective**: Write concisely and avoid null exceptions
272
- - **Details**: Use `flag ?? false` instead of `flag == null ? false : flag`
259
+ - **Objective**: Use StatelessWidget when no state management is needed to improve performance
260
+ - **Details**: StatefulWidget should only be used when the widget needs to maintain mutable state that changes over time. If a widget extends StatefulWidget but its State class has no mutable fields, never calls setState(), and doesn't use lifecycle methods beyond build(), it should be converted to StatelessWidget. StatelessWidget is more efficient as it doesn't maintain state and has less overhead. This rule detects StatefulWidget classes where the State has no mutable fields, no setState() calls, and no state-related lifecycle methods.
273
261
  - **Applies to**: Flutter/Dart
274
- - **Tools**: `dart lint` (`use_if_null_to_convert_nulls_to_bools`)
275
- - **Principles**: CODE_QUALITY, SECURITY
262
+ - **Tools**: Custom analyzer (D024)
263
+ - **Principles**: CODE_QUALITY, PERFORMANCE, BEST_PRACTICES
276
264
  - **Version**: 1.0
277
265
  - **Status**: activated
278
- - **Severity**: major
266
+ - **Severity**: warning
279
267
 
280
- ### 📘 Rule D025 – Include `Key` in Widget constructors
268
+ ### 📘 Rule D025 – Avoid Nested Conditional Expressions
281
269
 
282
- - **Objective**: Help Flutter identify widgets, ensure efficient rebuilds and prevent errors when reordering widgets.
283
- - **Details**: Use `key` in all public widget constructors
284
- - **Applies to**: Flutter/Dart
285
- - **Tools**: `flutter_lints` (`use_key_in_widget_constructors`)
286
- - **Principles**: CODE_QUALITY, USABILITY, PERFORMANCE
270
+ - **Objective**: Improve code readability by avoiding nested ternary operators
271
+ - **Details**: Nested conditional expressions (ternary operators like `condition ? value1 : value2`) reduce code readability and make logic harder to understand. When ternary operators are nested within the then or else branches of another ternary, the code becomes difficult to follow. Instead, use if-else statements for complex conditional logic, or extract the logic into a well-named function. Simple, non-nested ternary operators are acceptable for straightforward cases, but nesting should always be avoided.
272
+ - **Applies to**: Dart/Flutter
273
+ - **Tools**: Custom analyzer (D025)
274
+ - **Principles**: CODE_QUALITY, READABILITY, MAINTAINABILITY
287
275
  - **Version**: 1.0
288
276
  - **Status**: activated
289
- - **Severity**: major
277
+ - **Severity**: warning
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sun-asterisk/sunlint",
3
- "version": "1.3.39",
3
+ "version": "1.3.40",
4
4
  "description": "☀️ SunLint - Multi-language static analysis tool for code quality and security | Sun* Engineering Standards",
5
5
  "main": "cli.js",
6
6
  "bin": {
@@ -41,6 +41,7 @@
41
41
  "scripts/",
42
42
  "templates/",
43
43
  "docs/",
44
+ "skill-assets/",
44
45
  ".sunlint.json",
45
46
  "README.md",
46
47
  "LICENSE",
@@ -0,0 +1,25 @@
1
+ {
2
+ "id": "D002",
3
+ "name": "Always Dispose Resources and Remove Listeners",
4
+ "description": "Ensure all resources (Controllers, StreamSubscriptions, FocusNodes, Listeners) are properly disposed in the dispose() method to prevent memory leaks",
5
+ "category": "dart",
6
+ "severity": "error",
7
+ "languages": ["dart"],
8
+ "tags": ["flutter", "memory-leak", "resource-management", "dispose"],
9
+ "config": {
10
+ "disposableTypes": [
11
+ "Controller",
12
+ "StreamSubscription",
13
+ "FocusNode",
14
+ "AnimationController",
15
+ "TextEditingController",
16
+ "ScrollController",
17
+ "TabController",
18
+ "PageController",
19
+ "VideoPlayerController",
20
+ "CameraController"
21
+ ],
22
+ "checkListeners": true,
23
+ "checkSubscriptions": true
24
+ }
25
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "id": "D003",
3
+ "name": "Prefer Widgets Over Methods Returning Widgets",
4
+ "description": "Extract methods returning widgets into separate widget classes for better performance and maintainability",
5
+ "category": "dart",
6
+ "severity": "warning",
7
+ "languages": ["dart"],
8
+ "tags": ["flutter", "widget", "performance", "best-practice"],
9
+ "config": {
10
+ "excludePrivateMethods": false,
11
+ "excludeBuildHelpers": false,
12
+ "minMethodLength": 3
13
+ }
14
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "D004",
3
+ "name": "Avoid shrinkWrap in ListView",
4
+ "description": "ListView with shrinkWrap: true causes performance issues. Use Expanded/Flexible or SliverList instead",
5
+ "category": "dart",
6
+ "severity": "warning",
7
+ "languages": ["dart"],
8
+ "tags": ["flutter", "performance", "listview", "best-practice"],
9
+ "config": {
10
+ "checkTypes": ["ListView", "GridView"],
11
+ "message": "Avoid using shrinkWrap: true as it disables lazy loading and forces the ListView to render all items at once, causing performance issues"
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "D005",
3
+ "name": "Limit Widget Nesting Depth to 6",
4
+ "description": "Widget nesting should not exceed 6 levels to maintain code readability and performance",
5
+ "category": "dart",
6
+ "severity": "warning",
7
+ "languages": ["dart"],
8
+ "tags": ["flutter", "widget", "complexity", "readability", "nesting"],
9
+ "config": {
10
+ "maxDepth": 6,
11
+ "excludePatterns": ["_State", "Mixin"]
12
+ }
13
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "id": "D006",
3
+ "name": "Prefer Extracting Large Callbacks from Build",
4
+ "description": "Large callback functions in widget builders should be extracted to separate methods for better readability and maintainability",
5
+ "category": "dart",
6
+ "severity": "warning",
7
+ "languages": ["dart"],
8
+ "tags": ["flutter", "widget", "callback", "readability"],
9
+ "config": {
10
+ "maxLines": 5,
11
+ "callbackProperties": [
12
+ "onTap",
13
+ "onPressed",
14
+ "onChanged",
15
+ "onSubmitted",
16
+ "onSaved",
17
+ "onLongPress",
18
+ "onDoubleTap",
19
+ "builder",
20
+ "itemBuilder",
21
+ "onRefresh",
22
+ "onPageChanged"
23
+ ]
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "D007",
3
+ "name": "Prefer Init First, Dispose Last",
4
+ "description": "Code should be called after super.initState() and before super.dispose()",
5
+ "category": "dart",
6
+ "severity": "warning",
7
+ "languages": ["dart"],
8
+ "tags": ["flutter", "lifecycle", "state-management"],
9
+ "config": {}
10
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": "D008",
3
+ "name": "Avoid Long Functions",
4
+ "description": "Functions should not exceed the maximum line limit",
5
+ "category": "dart",
6
+ "severity": "warning",
7
+ "languages": ["dart"],
8
+ "tags": ["readability", "maintainability", "complexity"],
9
+ "config": {
10
+ "maxLines": 60
11
+ }
12
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": "D009",
3
+ "name": "Limit Function Parameters",
4
+ "description": "Functions should not have too many parameters to maintain readability. By default, nullable named parameters are not counted as they have implicit null defaults.",
5
+ "category": "dart",
6
+ "severity": "warning",
7
+ "languages": ["dart"],
8
+ "tags": ["readability", "maintainability", "complexity"],
9
+ "config": {
10
+ "maxParameters": 5,
11
+ "skipNullableNamedParameters": true
12
+ }
13
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": "D010",
3
+ "name": "Limit Cyclomatic Complexity",
4
+ "description": "Functions should not have high cyclomatic complexity",
5
+ "category": "dart",
6
+ "severity": "warning",
7
+ "languages": ["dart"],
8
+ "tags": ["complexity", "maintainability", "readability"],
9
+ "config": {
10
+ "maxComplexity": 10
11
+ }
12
+ }