@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.
- package/config/rules/rules-registry-generated.json +134 -108
- package/docs/GENERATED_FILES_QUICK_REFERENCE.md +96 -0
- package/docs/GENERATED_FILE_HANDLING_SUMMARY.md +152 -0
- package/docs/skills/CREATE_NEW_DART_RULE.md +161 -14
- package/origin-rules/dart-en.md +151 -163
- package/package.json +2 -1
- package/rules/dart/D002_dispose_resources/config.json +25 -0
- package/rules/dart/D003_prefer_widgets_over_methods/config.json +14 -0
- package/rules/dart/D004_avoid_shrinkwrap_listview/config.json +13 -0
- package/rules/dart/D005_limit_widget_nesting/config.json +13 -0
- package/rules/dart/D006_prefer_extracting_large_callbacks/config.json +25 -0
- package/rules/dart/D007_prefer_init_first_dispose_last/config.json +10 -0
- package/rules/dart/D008_avoid_long_functions/config.json +12 -0
- package/rules/dart/D009_limit_function_parameters/config.json +13 -0
- package/rules/dart/D010_limit_cyclomatic_complexity/config.json +12 -0
- package/rules/dart/D011_prefer_named_parameters/config.json +12 -0
- package/rules/dart/D012_prefer_named_boolean_parameters/config.json +9 -0
- package/rules/dart/D013_single_public_class/config.json +10 -0
- package/rules/dart/D014_unsafe_collection_access/config.json +10 -0
- package/rules/dart/D015_copywith_all_parameters/config.json +9 -0
- package/rules/dart/D016_project_should_have_tests/config.json +24 -0
- package/rules/dart/D017_pubspec_dependencies_review/config.json +23 -0
- package/rules/dart/D018_remove_commented_code/config.json +13 -0
- package/rules/dart/D019_avoid_single_child_multi_child_widget/config.json +21 -0
- package/rules/dart/D020_limit_if_else_branches/config.json +12 -0
- package/rules/dart/D021_avoid_negated_boolean_checks/config.json +14 -0
- package/rules/dart/D022_use_setstate_correctly/config.json +14 -0
- package/rules/dart/D023_avoid_unnecessary_method_overrides/config.json +13 -0
- package/rules/dart/D024_avoid_unnecessary_stateful_widget/config.json +9 -0
- package/rules/dart/D025_avoid_nested_conditional_expressions/config.json +9 -0
- package/skill-assets/sunlint-code-quality/AGENTS.md +80 -0
- package/skill-assets/sunlint-code-quality/SKILL.md +176 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C006-verb-noun-functions.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C013-no-dead-code.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C014-dependency-injection.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C017-no-constructor-logic.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C018-generic-errors.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C019-error-log-level.md +29 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C020-no-unused-imports.md +30 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C022-no-unused-variables.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C023-no-duplicate-names.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C024-centralize-constants.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C029-catch-log-root-cause.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C030-custom-error-classes.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C033-separate-data-access.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C035-error-context-logging.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C041-no-hardcoded-secrets.md +25 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C042-boolean-naming.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C052-controller-parsing.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C060-superclass-logic.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/C067-no-hardcoded-config.md +24 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S003-open-redirect.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S004-no-log-credentials.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S005-server-authorization.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S006-default-credentials.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S007-output-encoding.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S009-approved-crypto.md +37 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S010-csprng.md +32 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S011-encrypted-client-hello.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S012-secrets-management.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S013-tls-connections.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S016-no-sensitive-query-string.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S017-parameterized-queries.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S019-email-input-sanitization.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S020-eval-code-execution.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S022-context-escaping.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S023-dynamic-js-encoding.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S025-server-validation.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S026-tls-encryption.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S027-mtls-validation.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S028-upload-limits.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S029-csrf-protection.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S030-directory-browsing.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S031-secure-cookie-flag.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S032-httponly-cookie.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S033-samesite-cookie.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S034-host-prefix-cookie.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S035-app-hostnames.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S036-internal-file-paths.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S037-anti-cache-headers.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S039-tls-certificate-validation.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S041-logout-invalidation.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S042-long-lived-sessions.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S044-critical-changes-reauth.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S045-brute-force-protection.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S047-oauth-csrf-protection.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S048-oauth-redirect-validation.md +37 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S049-auth-code-expiry.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S050-token-entropy.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S051-password-length.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S052-otp-entropy.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S053-generic-error-messages.md +32 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S054-no-default-admin.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S055-content-type-validation.md +44 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S056-log-injection.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S057-synchronized-time.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/csharp/S058-ssrf-protection.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/java/C006-verb-noun-functions.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/C013-no-dead-code.md +175 -0
- package/skill-assets/sunlint-code-quality/rules/java/C014-dependency-injection.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/java/C017-no-constructor-logic.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/java/C018-generic-errors.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/java/C019-error-log-level.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/java/C020-no-unused-imports.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/java/C022-no-unused-variables.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/java/C023-no-duplicate-names.md +37 -0
- package/skill-assets/sunlint-code-quality/rules/java/C024-centralize-constants.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/C029-catch-log-root-cause.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/java/C030-custom-error-classes.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/java/C033-separate-data-access.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/java/C035-error-context-logging.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/C041-no-hardcoded-secrets.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/java/C042-boolean-naming.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/java/C052-controller-parsing.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/java/C060-superclass-logic.md +32 -0
- package/skill-assets/sunlint-code-quality/rules/java/C067-no-hardcoded-config.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/java/S003-open-redirect.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S004-no-log-credentials.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S005-server-authorization.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/java/S006-default-credentials.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/java/S007-output-encoding.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/java/S009-approved-crypto.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/java/S010-csprng.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S011-encrypted-client-hello.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/java/S012-secrets-management.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/java/S013-tls-connections.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/java/S016-no-sensitive-query-string.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S017-parameterized-queries.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/java/S019-email-input-sanitization.md +32 -0
- package/skill-assets/sunlint-code-quality/rules/java/S020-eval-code-execution.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/java/S022-context-escaping.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/java/S023-dynamic-js-encoding.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/java/S025-server-validation.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/java/S026-tls-encryption.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/java/S027-mtls-validation.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/java/S028-upload-limits.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/java/S029-csrf-protection.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/java/S030-directory-browsing.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S031-secure-cookie-flag.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S032-httponly-cookie.md +31 -0
- package/skill-assets/sunlint-code-quality/rules/java/S033-samesite-cookie.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/java/S034-host-prefix-cookie.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/java/S035-app-hostnames.md +23 -0
- package/skill-assets/sunlint-code-quality/rules/java/S036-internal-file-paths.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/java/S037-anti-cache-headers.md +37 -0
- package/skill-assets/sunlint-code-quality/rules/java/S039-tls-certificate-validation.md +43 -0
- package/skill-assets/sunlint-code-quality/rules/java/S041-logout-invalidation.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/java/S042-long-lived-sessions.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S044-critical-changes-reauth.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/java/S045-brute-force-protection.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S047-oauth-csrf-protection.md +33 -0
- package/skill-assets/sunlint-code-quality/rules/java/S048-oauth-redirect-validation.md +25 -0
- package/skill-assets/sunlint-code-quality/rules/java/S049-auth-code-expiry.md +23 -0
- package/skill-assets/sunlint-code-quality/rules/java/S050-token-entropy.md +20 -0
- package/skill-assets/sunlint-code-quality/rules/java/S051-password-length.md +20 -0
- package/skill-assets/sunlint-code-quality/rules/java/S052-otp-entropy.md +23 -0
- package/skill-assets/sunlint-code-quality/rules/java/S053-generic-error-messages.md +21 -0
- package/skill-assets/sunlint-code-quality/rules/java/S054-no-default-admin.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/java/S055-content-type-validation.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/java/S056-log-injection.md +38 -0
- package/skill-assets/sunlint-code-quality/rules/java/S057-synchronized-time.md +35 -0
- package/skill-assets/sunlint-code-quality/rules/java/S058-ssrf-protection.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C006-verb-noun-functions.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C013-no-dead-code.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C014-dependency-injection.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C017-no-constructor-logic.md +68 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C018-generic-errors.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C019-error-log-level.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C020-no-unused-imports.md +44 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C022-no-unused-variables.md +39 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C023-no-duplicate-names.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C024-centralize-constants.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C029-catch-log-root-cause.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C030-custom-error-classes.md +72 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C033-separate-data-access.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C035-error-context-logging.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C041-no-hardcoded-secrets.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C042-boolean-naming.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C052-controller-parsing.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C060-superclass-logic.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/C067-no-hardcoded-config.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S003-open-redirect.md +66 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S004-no-log-credentials.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S005-server-authorization.md +75 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S006-default-credentials.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S007-output-encoding.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S009-approved-crypto.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S010-csprng.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S011-encrypted-client-hello.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S012-secrets-management.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S013-tls-connections.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S016-no-sensitive-query-string.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S017-parameterized-queries.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S019-email-input-sanitization.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S020-eval-code-execution.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S022-context-escaping.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S023-dynamic-js-encoding.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S025-server-validation.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S026-tls-encryption.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S027-mtls-validation.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S028-upload-limits.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S029-csrf-protection.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S030-directory-browsing.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S031-secure-cookie-flag.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S032-httponly-cookie.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S033-samesite-cookie.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S034-host-prefix-cookie.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S035-app-hostnames.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S036-internal-file-paths.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S037-anti-cache-headers.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S039-tls-certificate-validation.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S041-logout-invalidation.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S042-long-lived-sessions.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S044-critical-changes-reauth.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S045-brute-force-protection.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S047-oauth-csrf-protection.md +74 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S048-oauth-redirect-validation.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S049-auth-code-expiry.md +70 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S050-token-entropy.md +65 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S051-password-length.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S052-otp-entropy.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S053-generic-error-messages.md +66 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S054-no-default-admin.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S055-content-type-validation.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S056-log-injection.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S057-synchronized-time.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/kotlin/S058-ssrf-protection.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/php/C006-verb-noun-functions.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/php/C013-no-dead-code.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/php/C014-dependency-injection.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/php/C017-no-constructor-logic.md +68 -0
- package/skill-assets/sunlint-code-quality/rules/php/C018-generic-errors.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/php/C019-error-log-level.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/C020-no-unused-imports.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/php/C022-no-unused-variables.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/php/C023-no-duplicate-names.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/php/C024-centralize-constants.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/php/C029-catch-log-root-cause.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/php/C030-custom-error-classes.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/php/C033-separate-data-access.md +79 -0
- package/skill-assets/sunlint-code-quality/rules/php/C035-error-context-logging.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/C041-no-hardcoded-secrets.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/php/C042-boolean-naming.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/php/C052-controller-parsing.md +66 -0
- package/skill-assets/sunlint-code-quality/rules/php/C060-superclass-logic.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/C067-no-hardcoded-config.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/php/S003-open-redirect.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/php/S004-no-log-credentials.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/php/S005-server-authorization.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/php/S006-default-credentials.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/php/S007-output-encoding.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/php/S009-approved-crypto.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/php/S010-csprng.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/php/S011-encrypted-client-hello.md +41 -0
- package/skill-assets/sunlint-code-quality/rules/php/S012-secrets-management.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/php/S013-tls-connections.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/php/S016-no-sensitive-query-string.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/php/S017-parameterized-queries.md +44 -0
- package/skill-assets/sunlint-code-quality/rules/php/S019-email-input-sanitization.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/S020-eval-code-execution.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/php/S022-context-escaping.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/php/S023-dynamic-js-encoding.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/php/S025-server-validation.md +63 -0
- package/skill-assets/sunlint-code-quality/rules/php/S026-tls-encryption.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/php/S027-mtls-validation.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/php/S028-upload-limits.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/php/S029-csrf-protection.md +65 -0
- package/skill-assets/sunlint-code-quality/rules/php/S030-directory-browsing.md +40 -0
- package/skill-assets/sunlint-code-quality/rules/php/S031-secure-cookie-flag.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/php/S032-httponly-cookie.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/S033-samesite-cookie.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/php/S034-host-prefix-cookie.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/php/S035-app-hostnames.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/php/S036-internal-file-paths.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/php/S037-anti-cache-headers.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/php/S039-tls-certificate-validation.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/S041-logout-invalidation.md +63 -0
- package/skill-assets/sunlint-code-quality/rules/php/S042-long-lived-sessions.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/php/S044-critical-changes-reauth.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/php/S045-brute-force-protection.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/php/S047-oauth-csrf-protection.md +72 -0
- package/skill-assets/sunlint-code-quality/rules/php/S048-oauth-redirect-validation.md +54 -0
- package/skill-assets/sunlint-code-quality/rules/php/S049-auth-code-expiry.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/php/S050-token-entropy.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/php/S051-password-length.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/php/S052-otp-entropy.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/php/S053-generic-error-messages.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/php/S054-no-default-admin.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/php/S055-content-type-validation.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/php/S056-log-injection.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/php/S057-synchronized-time.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/php/S058-ssrf-protection.md +65 -0
- package/skill-assets/sunlint-code-quality/rules/python/C006-verb-noun-functions.md +30 -0
- package/skill-assets/sunlint-code-quality/rules/python/C013-no-dead-code.md +24 -0
- package/skill-assets/sunlint-code-quality/rules/python/C014-dependency-injection.md +68 -0
- package/skill-assets/sunlint-code-quality/rules/python/C017-no-constructor-logic.md +30 -0
- package/skill-assets/sunlint-code-quality/rules/python/C018-generic-errors.md +25 -0
- package/skill-assets/sunlint-code-quality/rules/python/C019-error-log-level.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/python/C020-no-unused-imports.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/python/C022-no-unused-variables.md +24 -0
- package/skill-assets/sunlint-code-quality/rules/python/C023-no-duplicate-names.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/python/C024-centralize-constants.md +27 -0
- package/skill-assets/sunlint-code-quality/rules/python/C029-catch-log-root-cause.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/python/C030-custom-error-classes.md +28 -0
- package/skill-assets/sunlint-code-quality/rules/python/C033-separate-data-access.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/python/C035-error-context-logging.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/python/C041-no-hardcoded-secrets.md +23 -0
- package/skill-assets/sunlint-code-quality/rules/python/C042-boolean-naming.md +24 -0
- package/skill-assets/sunlint-code-quality/rules/python/C052-controller-parsing.md +34 -0
- package/skill-assets/sunlint-code-quality/rules/python/C060-superclass-logic.md +26 -0
- package/skill-assets/sunlint-code-quality/rules/python/C067-no-hardcoded-config.md +22 -0
- package/skill-assets/sunlint-code-quality/rules/python/S003-open-redirect.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S004-no-log-credentials.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S005-server-authorization.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S006-default-credentials.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S007-output-encoding.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S009-approved-crypto.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S010-csprng.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S011-encrypted-client-hello.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S012-secrets-management.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S013-tls-connections.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S016-no-sensitive-query-string.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S017-parameterized-queries.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/python/S019-email-input-sanitization.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S020-eval-code-execution.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/python/S022-context-escaping.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S023-dynamic-js-encoding.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S025-server-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S026-tls-encryption.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S027-mtls-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S028-upload-limits.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S029-csrf-protection.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S030-directory-browsing.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S031-secure-cookie-flag.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S032-httponly-cookie.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S033-samesite-cookie.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S034-host-prefix-cookie.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S035-app-hostnames.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S036-internal-file-paths.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/python/S037-anti-cache-headers.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S039-tls-certificate-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S041-logout-invalidation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S042-long-lived-sessions.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S044-critical-changes-reauth.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S045-brute-force-protection.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S047-oauth-csrf-protection.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S048-oauth-redirect-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S049-auth-code-expiry.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S050-token-entropy.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S051-password-length.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S052-otp-entropy.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S053-generic-error-messages.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S054-no-default-admin.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S055-content-type-validation.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S056-log-injection.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S057-synchronized-time.md +16 -0
- package/skill-assets/sunlint-code-quality/rules/python/S058-ssrf-protection.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C006-verb-noun-functions.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C013-no-dead-code.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C014-dependency-injection.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C017-no-constructor-logic.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C018-generic-errors.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C019-error-log-level.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C020-no-unused-imports.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C022-no-unused-variables.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C023-no-duplicate-names.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C024-centralize-constants.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C029-catch-log-root-cause.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C030-custom-error-classes.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C033-separate-data-access.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C035-error-context-logging.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C041-no-hardcoded-secrets.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C042-boolean-naming.md +42 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C052-controller-parsing.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C060-superclass-logic.md +67 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/C067-no-hardcoded-config.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S003-open-redirect.md +76 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S004-no-log-credentials.md +71 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S005-server-authorization.md +68 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S006-default-credentials.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S007-output-encoding.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S009-approved-crypto.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S010-csprng.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S011-encrypted-client-hello.md +45 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S012-secrets-management.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S013-tls-connections.md +70 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S016-no-sensitive-query-string.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S017-parameterized-queries.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S019-email-input-sanitization.md +56 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S020-eval-code-execution.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S022-context-escaping.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S023-dynamic-js-encoding.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S025-server-validation.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S026-tls-encryption.md +47 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S027-mtls-validation.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S028-upload-limits.md +65 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S029-csrf-protection.md +62 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S030-directory-browsing.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S031-secure-cookie-flag.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S032-httponly-cookie.md +36 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S033-samesite-cookie.md +46 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S034-host-prefix-cookie.md +50 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S035-app-hostnames.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S036-internal-file-paths.md +53 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S037-anti-cache-headers.md +52 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S039-tls-certificate-validation.md +51 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S041-logout-invalidation.md +58 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S042-long-lived-sessions.md +55 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S044-critical-changes-reauth.md +69 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S045-brute-force-protection.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S047-oauth-csrf-protection.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S048-oauth-redirect-validation.md +59 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S049-auth-code-expiry.md +73 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S050-token-entropy.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S051-password-length.md +60 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S052-otp-entropy.md +49 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S053-generic-error-messages.md +61 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S054-no-default-admin.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S055-content-type-validation.md +64 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S056-log-injection.md +48 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S057-synchronized-time.md +57 -0
- package/skill-assets/sunlint-code-quality/rules/typescript/S058-ssrf-protection.md +63 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Generated File Handling - Implementation Summary
|
|
2
|
+
|
|
3
|
+
## What Was Improved
|
|
4
|
+
|
|
5
|
+
Enhanced the Dart analyzer to skip a comprehensive list of generated files automatically.
|
|
6
|
+
|
|
7
|
+
## Changes Made
|
|
8
|
+
|
|
9
|
+
### 1. Updated analyzer_service.dart
|
|
10
|
+
|
|
11
|
+
**File:** `dart_analyzer/lib/analyzer_service.dart`
|
|
12
|
+
|
|
13
|
+
**What changed:** Expanded `_generatedFilePatterns` from 7 patterns to 29 comprehensive patterns covering all major Dart/Flutter code generation tools.
|
|
14
|
+
|
|
15
|
+
**New patterns added:**
|
|
16
|
+
- `.gen.dart` - flutter_gen (assets, localization)
|
|
17
|
+
- `.graphql.dart` - GraphQL (alternative)
|
|
18
|
+
- `.pb.dart`, `.pbenum.dart`, `.pbserver.dart`, `.pbjson.dart` - Protocol buffers
|
|
19
|
+
- `.config.dart`, `.iconfig.dart` - Injectable dependency injection
|
|
20
|
+
- `.mapper.dart` - dart_mappable
|
|
21
|
+
- `.drift.dart` - Drift database ORM
|
|
22
|
+
- `.chopper.dart` - Chopper HTTP client
|
|
23
|
+
- `.reflectable.dart` - Reflectable code generation
|
|
24
|
+
- `pigeon.dart` - Pigeon platform channels
|
|
25
|
+
- `l10n.dart`, `_l10n.dart` - Flutter internationalization
|
|
26
|
+
- `/generated/` directory pattern
|
|
27
|
+
- `.generated.` filename pattern
|
|
28
|
+
|
|
29
|
+
### 2. Updated Documentation
|
|
30
|
+
|
|
31
|
+
**File:** `docs/skills/CREATE_NEW_DART_RULE.md`
|
|
32
|
+
|
|
33
|
+
**What changed:** Added new section "8. Generated File Handling" with:
|
|
34
|
+
- Complete list of all 29 skipped file patterns
|
|
35
|
+
- Explanation that the check is centralized and automatic
|
|
36
|
+
- Guidance on when NOT to add file checks in individual rules
|
|
37
|
+
- Example of rule-specific file path checks (for test files, config files, etc.)
|
|
38
|
+
- Updated all subsequent section numbers (9-15)
|
|
39
|
+
- Added changelog entry for v1.2.0
|
|
40
|
+
|
|
41
|
+
## How It Works
|
|
42
|
+
|
|
43
|
+
### Centralized Skip Logic
|
|
44
|
+
|
|
45
|
+
The `analyzeFile` method in `analyzer_service.dart` performs the check:
|
|
46
|
+
|
|
47
|
+
```dart
|
|
48
|
+
if (_isGeneratedFile(absolutePath)) {
|
|
49
|
+
_log('Skipping generated file: $absolutePath');
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This happens **before** any rule analysis, so:
|
|
55
|
+
- ✅ All Dart rules (D001-D025) automatically skip generated files
|
|
56
|
+
- ✅ All Common rules (C-series) automatically skip generated files in Dart
|
|
57
|
+
- ✅ All Security rules (S-series) automatically skip generated files in Dart
|
|
58
|
+
- ✅ Consistent behavior across all rules
|
|
59
|
+
- ✅ Single point of maintenance
|
|
60
|
+
|
|
61
|
+
### Pattern Matching
|
|
62
|
+
|
|
63
|
+
The method checks both:
|
|
64
|
+
1. **Full file path** (lowercase): `lib/models/user.g.dart`
|
|
65
|
+
2. **File name only**: `user.g.dart`
|
|
66
|
+
|
|
67
|
+
This ensures patterns like `__generated__` (directory) and `.g.dart` (extension) both work correctly.
|
|
68
|
+
|
|
69
|
+
## Testing
|
|
70
|
+
|
|
71
|
+
Created `test_generated_files.dart` to verify all patterns work correctly.
|
|
72
|
+
|
|
73
|
+
**Test results:** ✅ All 27 test cases passed
|
|
74
|
+
- 23 generated files correctly identified for skipping
|
|
75
|
+
- 4 regular files correctly identified for analysis
|
|
76
|
+
|
|
77
|
+
## Benefits
|
|
78
|
+
|
|
79
|
+
1. **No Code Changes Needed in Rules**: All existing rules (D001-D025) automatically benefit from this improvement
|
|
80
|
+
2. **Better Performance**: Skip expensive AST parsing for files we don't care about
|
|
81
|
+
3. **Reduced Noise**: No false positives from generated code
|
|
82
|
+
4. **Easy Maintenance**: Add new patterns in one place when new generators emerge
|
|
83
|
+
5. **Clear Documentation**: Developers know what files are skipped without checking code
|
|
84
|
+
|
|
85
|
+
## Common Generated Files in Flutter Projects
|
|
86
|
+
|
|
87
|
+
| Generator | Pattern | Example |
|
|
88
|
+
|-----------|---------|---------|
|
|
89
|
+
| json_serializable | `.g.dart` | `user.g.dart` |
|
|
90
|
+
| built_value | `.g.dart` | `serializers.g.dart` |
|
|
91
|
+
| flutter_gen | `.gen.dart` | `assets.gen.dart` |
|
|
92
|
+
| freezed | `.freezed.dart` | `state.freezed.dart` |
|
|
93
|
+
| injectable | `.config.dart` | `injection.config.dart` |
|
|
94
|
+
| dart_mappable | `.mapper.dart` | `user.mapper.dart` |
|
|
95
|
+
| drift | `.drift.dart` | `database.drift.dart` |
|
|
96
|
+
| GraphQL | `.gql.dart` | `schema.gql.dart` |
|
|
97
|
+
| gRPC | `.gr.dart` | `service.gr.dart` |
|
|
98
|
+
| Protocol Buffers | `.pb.dart` | `message.pb.dart` |
|
|
99
|
+
| Mockito | `.mocks.dart` | `service.mocks.dart` |
|
|
100
|
+
| Pigeon | `pigeon.dart` | `pigeon.dart` |
|
|
101
|
+
| Intl | `l10n.dart` | `app_localizations.dart` |
|
|
102
|
+
|
|
103
|
+
## When to Add File Checks in Rules
|
|
104
|
+
|
|
105
|
+
**DON'T** add generated file checks in individual rules - it's already handled centrally.
|
|
106
|
+
|
|
107
|
+
**DO** add file-specific checks for:
|
|
108
|
+
- Test files (`_test.dart`) - if rule behavior differs for tests
|
|
109
|
+
- Config files - if hardcoded values are acceptable in configs
|
|
110
|
+
- Example/fixture files - if rule should skip demonstration code
|
|
111
|
+
- Platform-specific code - if rule only applies to certain platforms
|
|
112
|
+
|
|
113
|
+
**Example:**
|
|
114
|
+
|
|
115
|
+
```dart
|
|
116
|
+
// Good: Rule-specific business logic
|
|
117
|
+
if (filePath.contains('_test.dart')) {
|
|
118
|
+
return []; // Allow print() in test files
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Bad: Don't duplicate generated file check
|
|
122
|
+
if (filePath.endsWith('.g.dart')) { // ❌ Already handled centrally
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Next Steps
|
|
128
|
+
|
|
129
|
+
1. ✅ Patterns updated in analyzer_service.dart
|
|
130
|
+
2. ✅ Documentation updated with new section
|
|
131
|
+
3. ✅ Test script created and verified
|
|
132
|
+
4. 🔄 Need to rebuild Dart binary: `dart compile exe bin/sunlint_dart_analyzer.dart`
|
|
133
|
+
5. 🔄 Copy binary to sunlint root: `cp bin/sunlint-dart-macos ../sunlint-dart-macos`
|
|
134
|
+
6. ✅ No changes needed in existing rules - they automatically benefit
|
|
135
|
+
|
|
136
|
+
## Migration Guide
|
|
137
|
+
|
|
138
|
+
**For Existing Rules:**
|
|
139
|
+
No migration needed! All rules automatically use the centralized check.
|
|
140
|
+
|
|
141
|
+
**For New Rules:**
|
|
142
|
+
Follow the updated CREATE_NEW_DART_RULE.md guide which now documents the automatic skip behavior.
|
|
143
|
+
|
|
144
|
+
**For Rule Reviewers:**
|
|
145
|
+
If you see generated file checks in rule implementations, they can be removed as redundant.
|
|
146
|
+
|
|
147
|
+
## Notes
|
|
148
|
+
|
|
149
|
+
- The original implementation already had 7 patterns - this extends it to 29
|
|
150
|
+
- The check uses regex for flexibility (e.g., case-insensitive matching)
|
|
151
|
+
- The logging statement helps debug which files are being skipped
|
|
152
|
+
- Pattern matching checks both full path and filename for maximum coverage
|
|
@@ -687,9 +687,147 @@ void visitImportDirective(ImportDirective node) {
|
|
|
687
687
|
}
|
|
688
688
|
```
|
|
689
689
|
|
|
690
|
+
### Pattern 6: Follow Include Chains in YAML Files
|
|
691
|
+
|
|
692
|
+
When analyzing configuration files like `analysis_options.yaml`, you may need to follow `include:` chains to find the actual configuration:
|
|
693
|
+
|
|
694
|
+
```dart
|
|
695
|
+
bool _checkForRecommendedPackage(
|
|
696
|
+
YamlMap yaml,
|
|
697
|
+
String content,
|
|
698
|
+
String projectRoot,
|
|
699
|
+
String currentFilePath,
|
|
700
|
+
) {
|
|
701
|
+
// Prevent infinite loops in circular includes
|
|
702
|
+
if (_visitedFiles.contains(currentFilePath)) {
|
|
703
|
+
return false;
|
|
704
|
+
}
|
|
705
|
+
_visitedFiles.add(currentFilePath);
|
|
706
|
+
|
|
707
|
+
// Check direct include statement
|
|
708
|
+
final include = yaml['include'];
|
|
709
|
+
if (include != null && include is String) {
|
|
710
|
+
// Check if it's a package include
|
|
711
|
+
if (include.startsWith('package:')) {
|
|
712
|
+
// Check package name
|
|
713
|
+
return true;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// Follow local file includes recursively
|
|
717
|
+
if (!include.startsWith('package:')) {
|
|
718
|
+
final includedFile = _resolveIncludePath(include, projectRoot, currentFilePath);
|
|
719
|
+
if (includedFile != null && includedFile.existsSync()) {
|
|
720
|
+
try {
|
|
721
|
+
final includedContent = includedFile.readAsStringSync();
|
|
722
|
+
final includedYaml = loadYaml(includedContent);
|
|
723
|
+
|
|
724
|
+
if (includedYaml is YamlMap) {
|
|
725
|
+
// Recursively check the included file
|
|
726
|
+
return _checkForRecommendedPackage(
|
|
727
|
+
includedYaml,
|
|
728
|
+
includedContent,
|
|
729
|
+
projectRoot,
|
|
730
|
+
includedFile.path,
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
} catch (e) {
|
|
734
|
+
// Failed to parse included file
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
File? _resolveIncludePath(String includePath, String projectRoot, String currentFilePath) {
|
|
744
|
+
if (path.isAbsolute(includePath)) {
|
|
745
|
+
return File(includePath);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// Relative to current file's directory
|
|
749
|
+
final currentDir = path.dirname(currentFilePath);
|
|
750
|
+
final resolvedPath = path.normalize(path.join(currentDir, includePath));
|
|
751
|
+
|
|
752
|
+
return File(resolvedPath);
|
|
753
|
+
}
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
**Example use case:** D001 rule follows include chains like:
|
|
757
|
+
```yaml
|
|
758
|
+
# analysis_options.yaml
|
|
759
|
+
include: base_options.yaml
|
|
760
|
+
|
|
761
|
+
# base_options.yaml
|
|
762
|
+
include: company_standards.yaml
|
|
763
|
+
|
|
764
|
+
# company_standards.yaml
|
|
765
|
+
include: package:flutter_lints/flutter.yaml
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
The rule detects `flutter_lints` even through a 3-level include chain.
|
|
769
|
+
|
|
690
770
|
---
|
|
691
771
|
|
|
692
|
-
## 8.
|
|
772
|
+
## 8. Generated File Handling
|
|
773
|
+
|
|
774
|
+
### 8.1. Automatic Skip for Generated Files
|
|
775
|
+
|
|
776
|
+
**All Dart rules automatically skip generated files.** The analyzer service has a centralized check in `analyzer_service.dart` that filters out generated files before analysis.
|
|
777
|
+
|
|
778
|
+
**Skipped patterns:**
|
|
779
|
+
- `.g.dart` - json_serializable, built_value
|
|
780
|
+
- `.gen.dart` - flutter_gen (assets, localization)
|
|
781
|
+
- `.gql.dart`, `.graphql.dart` - GraphQL code generation
|
|
782
|
+
- `.freezed.dart` - freezed unions/sealed classes
|
|
783
|
+
- `.gr.dart` - gRPC code generation
|
|
784
|
+
- `.pb.dart`, `.pbenum.dart`, `.pbserver.dart`, `.pbjson.dart` - Protocol buffers
|
|
785
|
+
- `.mocks.dart` - Mockito generated mocks
|
|
786
|
+
- `.config.dart`, `.iconfig.dart` - Injectable configs
|
|
787
|
+
- `.mapper.dart` - Mapper generators (dart_mappable)
|
|
788
|
+
- `.drift.dart` - Drift database
|
|
789
|
+
- `.chopper.dart` - Chopper HTTP client
|
|
790
|
+
- `.reflectable.dart` - Reflectable code generation
|
|
791
|
+
- `pigeon.dart` - Pigeon platform channels
|
|
792
|
+
- `l10n.dart`, `_l10n.dart` - Flutter intl localization
|
|
793
|
+
- Files in `__generated__` or `/generated/` directories
|
|
794
|
+
- Files with `.generated.` in their name
|
|
795
|
+
|
|
796
|
+
### 8.2. When to Add File Checks in Rules
|
|
797
|
+
|
|
798
|
+
**You should NOT add generated file checks in individual rule implementations** because:
|
|
799
|
+
- ✅ The check is already done centrally in `analyzer_service.dart`
|
|
800
|
+
- ✅ Consistent across all rules automatically
|
|
801
|
+
- ✅ Easy to maintain and update patterns in one place
|
|
802
|
+
|
|
803
|
+
**Exception:** Only add file path checks for rule-specific logic, such as:
|
|
804
|
+
- Skipping test files for certain rules (e.g., `C043_no_console_or_print.dart`)
|
|
805
|
+
- Skipping config files for hardcoded value rules (e.g., `C067_no_hardcoded_config.dart`)
|
|
806
|
+
- Special behavior based on file location (e.g., test vs. production code)
|
|
807
|
+
|
|
808
|
+
**Example of rule-specific file check (when needed):**
|
|
809
|
+
|
|
810
|
+
```dart
|
|
811
|
+
@override
|
|
812
|
+
List<Violation> analyze({
|
|
813
|
+
required CompilationUnit unit,
|
|
814
|
+
required String filePath,
|
|
815
|
+
required Rule rule,
|
|
816
|
+
required LineInfo lineInfo,
|
|
817
|
+
}) {
|
|
818
|
+
// Rule-specific file path check (not for generated files)
|
|
819
|
+
if (filePath.contains('_test.dart')) {
|
|
820
|
+
// Allow console.log/print in test files
|
|
821
|
+
return [];
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// Regular analysis continues...
|
|
825
|
+
}
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
---
|
|
829
|
+
|
|
830
|
+
## 9. Existing and Suggested Dart-Only Rules (Dxxx)
|
|
693
831
|
|
|
694
832
|
### Existing Rules
|
|
695
833
|
|
|
@@ -714,9 +852,9 @@ void visitImportDirective(ImportDirective node) {
|
|
|
714
852
|
|
|
715
853
|
---
|
|
716
854
|
|
|
717
|
-
##
|
|
855
|
+
## 10. Error Handling
|
|
718
856
|
|
|
719
|
-
###
|
|
857
|
+
### 10.1. Dart Compile Error
|
|
720
858
|
|
|
721
859
|
```bash
|
|
722
860
|
# Check for errors
|
|
@@ -728,7 +866,7 @@ dart analyze dart_analyzer/lib/
|
|
|
728
866
|
# - Add missing dependencies to pubspec.yaml
|
|
729
867
|
```
|
|
730
868
|
|
|
731
|
-
###
|
|
869
|
+
### 10.2. Rule Not Detected
|
|
732
870
|
|
|
733
871
|
```bash
|
|
734
872
|
# Verify config exists
|
|
@@ -738,7 +876,7 @@ ls rules/dart/${RULE_ID}_*/config.json
|
|
|
738
876
|
grep ${RULE_ID} config/rules/enhanced-rules-registry.json
|
|
739
877
|
```
|
|
740
878
|
|
|
741
|
-
###
|
|
879
|
+
### 10.3. No Violations Found
|
|
742
880
|
|
|
743
881
|
```bash
|
|
744
882
|
# Check DartAnalyzer is running
|
|
@@ -748,7 +886,7 @@ node cli.js --rule=${RULE_ID} --input=... --languages=dart --verbose
|
|
|
748
886
|
grep ${RULE_ID} dart_analyzer/lib/analyzer_service.dart
|
|
749
887
|
```
|
|
750
888
|
|
|
751
|
-
###
|
|
889
|
+
### 10.4. Rule Name Mismatch
|
|
752
890
|
|
|
753
891
|
**Problem:** Rule name displays incorrectly or doesn't match the definition.
|
|
754
892
|
|
|
@@ -774,7 +912,7 @@ grep ${RULE_ID} dart_analyzer/lib/analyzer_service.dart
|
|
|
774
912
|
|
|
775
913
|
---
|
|
776
914
|
|
|
777
|
-
##
|
|
915
|
+
## 11. Files Created/Modified by This Skill
|
|
778
916
|
|
|
779
917
|
### Files Created:
|
|
780
918
|
|
|
@@ -804,9 +942,9 @@ grep ${RULE_ID} dart_analyzer/lib/analyzer_service.dart
|
|
|
804
942
|
|
|
805
943
|
---
|
|
806
944
|
|
|
807
|
-
##
|
|
945
|
+
## 12. Best Practices & Important Notes
|
|
808
946
|
|
|
809
|
-
###
|
|
947
|
+
### 12.1. Rule Name Synchronization
|
|
810
948
|
|
|
811
949
|
**CRITICAL:** Rule name must be consistent across 3 locations:
|
|
812
950
|
|
|
@@ -822,7 +960,7 @@ grep ${RULE_ID} dart_analyzer/lib/analyzer_service.dart
|
|
|
822
960
|
3. Update Dart code comment to match
|
|
823
961
|
4. Never edit registry JSON files manually
|
|
824
962
|
|
|
825
|
-
###
|
|
963
|
+
### 12.2. Registry Generation Flow
|
|
826
964
|
|
|
827
965
|
```
|
|
828
966
|
../../../rules/dart-en.md
|
|
@@ -837,7 +975,7 @@ config/rules/rules-registry-generated.json
|
|
|
837
975
|
- Registry is **auto-generated**
|
|
838
976
|
- `config.json` is only used for rule detection, not for display name
|
|
839
977
|
|
|
840
|
-
###
|
|
978
|
+
### 12.3. Common Mistakes to Avoid
|
|
841
979
|
|
|
842
980
|
| Mistake | Why It's Wrong | Correct Approach |
|
|
843
981
|
|---------|----------------|------------------|
|
|
@@ -848,7 +986,7 @@ config/rules/rules-registry-generated.json
|
|
|
848
986
|
|
|
849
987
|
---
|
|
850
988
|
|
|
851
|
-
##
|
|
989
|
+
## 13. Related Documentation
|
|
852
990
|
|
|
853
991
|
- **[REGISTRY_GENERATION_FLOW.md](../REGISTRY_GENERATION_FLOW.md)** - ⭐ Detailed registry generation flow from markdown
|
|
854
992
|
- [CREATE_DART_RULE.md](./CREATE_DART_RULE.md) - Add Dart support for existing TypeScript rule
|
|
@@ -857,7 +995,7 @@ config/rules/rules-registry-generated.json
|
|
|
857
995
|
|
|
858
996
|
---
|
|
859
997
|
|
|
860
|
-
##
|
|
998
|
+
## 14. Complete Example: D001 Implementation
|
|
861
999
|
|
|
862
1000
|
Below is a real-world example of rule D001 implementation:
|
|
863
1001
|
|
|
@@ -913,7 +1051,16 @@ analysis_options.yaml
|
|
|
913
1051
|
|
|
914
1052
|
---
|
|
915
1053
|
|
|
916
|
-
##
|
|
1054
|
+
## 15. Changelog
|
|
1055
|
+
|
|
1056
|
+
### v1.2.0 (2025-02-02)
|
|
1057
|
+
- **FEATURE:** Enhanced generated file detection patterns
|
|
1058
|
+
- Added comprehensive list of generated file patterns (20+ patterns)
|
|
1059
|
+
- Added new section "Generated File Handling" with complete documentation
|
|
1060
|
+
- Documented automatic skip behavior for all Dart rules
|
|
1061
|
+
- Added guidance on when NOT to add file checks in rules
|
|
1062
|
+
- Updated patterns include: .gen.dart, .pb.dart, .config.dart, .mapper.dart, .drift.dart, etc.
|
|
1063
|
+
- Clarified centralized vs. rule-specific file path checks
|
|
917
1064
|
|
|
918
1065
|
### v1.1.0 (2025-01-23)
|
|
919
1066
|
- **BREAKING:** Added mandatory markdown update steps for rule definitions
|