@sun-asterisk/sunlint 1.3.33 → 1.3.35
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/released-rules.json +62 -0
- package/config/rules/enhanced-rules-registry.json +2315 -1354
- package/core/adapters/dart-analyzer.js +658 -0
- package/core/adapters/index.js +102 -0
- package/core/adapters/sunlint-rule-adapter.js +0 -2
- package/core/adapters/typescript-analyzer.js +277 -0
- package/core/analysis-orchestrator.js +168 -40
- package/core/architecture-integration.js +16 -7
- package/core/auto-performance-manager.js +1 -1
- package/core/cli-action-handler.js +98 -21
- package/core/cli-program.js +96 -138
- package/core/config-merger.js +24 -14
- package/core/constants/defaults.js +1 -2
- package/core/file-targeting-service.js +62 -4
- package/core/git-utils.js +19 -12
- package/core/github-annotate-service.js +456 -89
- package/core/github-step-summary-generator.js +8 -8
- package/core/html-report-generator.js +326 -731
- package/core/impact-integration.js +433 -0
- package/core/interfaces/language-analyzer.interface.js +393 -0
- package/core/output-service.js +308 -35
- package/core/rule-selection-service.js +77 -27
- package/core/scoring-service.js +3 -2
- package/core/semantic-engine-manager.js +375 -0
- package/core/semantic-engine.js +4 -57
- package/core/unified-rule-registry.js +52 -11
- package/docs/DART_RULE_EXECUTION_FLOW.md +745 -0
- package/docs/DART_SUPPORT_IMPLEMENTATION.md +245 -0
- package/docs/SUNLINT_ARCHITECTURE.md +692 -0
- package/docs/skills/CREATE_DART_RULE.md +909 -0
- package/engines/arch-detect/core/analyzer.js +413 -0
- package/engines/arch-detect/core/index.js +22 -0
- package/engines/arch-detect/engine/hybrid-detector.js +176 -0
- package/engines/arch-detect/engine/index.js +24 -0
- package/engines/arch-detect/engine/rule-executor.js +228 -0
- package/engines/arch-detect/engine/score-calculator.js +214 -0
- package/engines/arch-detect/engine/violation-detector.js +616 -0
- package/engines/arch-detect/index.js +50 -0
- package/engines/arch-detect/rules/base-rule.js +187 -0
- package/engines/arch-detect/rules/index.js +35 -0
- package/engines/arch-detect/rules/layered/index.js +28 -0
- package/engines/arch-detect/rules/layered/l001-presentation-layer.js +237 -0
- package/engines/arch-detect/rules/layered/l002-business-layer.js +215 -0
- package/engines/arch-detect/rules/layered/l003-data-layer.js +229 -0
- package/engines/arch-detect/rules/layered/l004-model-layer.js +204 -0
- package/engines/arch-detect/rules/layered/l005-layer-separation.js +215 -0
- package/engines/arch-detect/rules/layered/l006-dependency-direction.js +221 -0
- package/engines/arch-detect/rules/layered/layered-rules-collection.js +445 -0
- package/engines/arch-detect/rules/modular/index.js +27 -0
- package/engines/arch-detect/rules/modular/m001-feature-modules.js +238 -0
- package/engines/arch-detect/rules/modular/m002-core-module.js +169 -0
- package/engines/arch-detect/rules/modular/m003-module-declaration.js +186 -0
- package/engines/arch-detect/rules/modular/m004-public-api.js +171 -0
- package/engines/arch-detect/rules/modular/m005-no-deep-imports.js +220 -0
- package/engines/arch-detect/rules/modular/modular-rules-collection.js +357 -0
- package/engines/arch-detect/rules/presentation/index.js +27 -0
- package/engines/arch-detect/rules/presentation/pr001-view-layer.js +221 -0
- package/engines/arch-detect/rules/presentation/pr002-presentation-logic.js +192 -0
- package/engines/arch-detect/rules/presentation/pr004-data-binding.js +187 -0
- package/engines/arch-detect/rules/presentation/pr006-router-layer.js +185 -0
- package/engines/arch-detect/rules/presentation/pr007-interactor-layer.js +181 -0
- package/engines/arch-detect/rules/presentation/presentation-rules-collection.js +507 -0
- package/engines/arch-detect/rules/project-scanner/index.js +31 -0
- package/engines/arch-detect/rules/project-scanner/ps001-project-root.js +213 -0
- package/engines/arch-detect/rules/project-scanner/ps002-language-detection.js +192 -0
- package/engines/arch-detect/rules/project-scanner/ps003-framework-detection.js +339 -0
- package/engines/arch-detect/rules/project-scanner/ps004-build-system.js +171 -0
- package/engines/arch-detect/rules/project-scanner/ps005-source-directory.js +163 -0
- package/engines/arch-detect/rules/project-scanner/ps006-test-directory.js +184 -0
- package/engines/arch-detect/rules/project-scanner/ps007-documentation.js +149 -0
- package/engines/arch-detect/rules/project-scanner/ps008-cicd-detection.js +163 -0
- package/engines/arch-detect/rules/project-scanner/ps009-code-quality.js +152 -0
- package/engines/arch-detect/rules/project-scanner/ps010-statistics.js +180 -0
- package/engines/arch-detect/rules/rule-registry.js +111 -0
- package/engines/arch-detect/types/context.types.js +60 -0
- package/engines/arch-detect/types/enums.js +161 -0
- package/engines/arch-detect/types/index.js +25 -0
- package/engines/arch-detect/types/result.types.js +7 -0
- package/engines/arch-detect/types/rule.types.js +7 -0
- package/engines/arch-detect/utils/file-scanner.js +411 -0
- package/engines/arch-detect/utils/index.js +23 -0
- package/engines/arch-detect/utils/pattern-matcher.js +328 -0
- package/engines/eslint-engine.js +2 -8
- package/engines/heuristic-engine.js +234 -38
- package/engines/impact/cli.js +106 -0
- package/engines/impact/config/default-config.js +54 -0
- package/engines/impact/core/change-detector.js +258 -0
- package/engines/impact/core/detectors/database-detector.js +1317 -0
- package/engines/impact/core/detectors/endpoint-detector.js +55 -0
- package/engines/impact/core/impact-analyzer.js +124 -0
- package/engines/impact/core/report-generator.js +462 -0
- package/engines/impact/core/utils/ast-parser.js +241 -0
- package/engines/impact/core/utils/dependency-graph.js +159 -0
- package/engines/impact/core/utils/file-utils.js +116 -0
- package/engines/impact/core/utils/git-utils.js +203 -0
- package/engines/impact/core/utils/logger.js +13 -0
- package/engines/impact/core/utils/method-call-graph.js +1192 -0
- package/engines/impact/index.js +135 -0
- package/engines/impact/package.json +29 -0
- package/package.json +18 -43
- package/rules/common/C002_no_duplicate_code/config.json +12 -20
- package/rules/common/C002_no_duplicate_code/dart/analyzer.js +53 -0
- package/rules/common/C002_no_duplicate_code/index.js +93 -0
- package/rules/common/C003_no_vague_abbreviations/config.json +1 -1
- package/rules/common/C003_no_vague_abbreviations/dart/analyzer.js +54 -0
- package/rules/common/C003_no_vague_abbreviations/index.js +93 -0
- package/rules/common/C006_function_naming/dart/analyzer.js +40 -0
- package/rules/common/C006_function_naming/index.js +86 -0
- package/rules/common/C008_variable_declaration_locality/dart/analyzer.js +32 -0
- package/rules/common/C008_variable_declaration_locality/index.js +86 -0
- package/rules/common/C010_limit_block_nesting/dart/analyzer.js +32 -0
- package/rules/common/C010_limit_block_nesting/index.js +86 -0
- package/rules/common/C012_command_query_separation/config.json +61 -0
- package/rules/common/C012_command_query_separation/dart/analyzer.js +32 -0
- package/rules/common/C012_command_query_separation/index.js +86 -0
- package/rules/common/C013_no_dead_code/dart/analyzer.js +32 -0
- package/rules/common/C013_no_dead_code/index.js +86 -0
- package/rules/common/C014_dependency_injection/dart/analyzer.js +32 -0
- package/rules/common/C014_dependency_injection/index.js +86 -0
- package/rules/common/C017_constructor_logic/dart/analyzer.js +32 -0
- package/rules/common/C017_constructor_logic/index.js +86 -0
- package/rules/common/C018_no_throw_generic_error/dart/analyzer.js +32 -0
- package/rules/common/C018_no_throw_generic_error/index.js +86 -0
- package/rules/common/C019_log_level_usage/dart/analyzer.js +32 -0
- package/rules/common/C019_log_level_usage/index.js +86 -0
- package/rules/common/C019_log_level_usage/{ts-morph-analyzer.js → typescript/ts-morph-analyzer.js} +0 -1
- package/rules/common/C020_unused_imports/dart/analyzer.js +32 -0
- package/rules/common/C020_unused_imports/index.js +86 -0
- package/rules/common/C020_unused_imports/{ts-morph-analyzer.js → typescript/ts-morph-analyzer.js} +0 -1
- package/rules/common/C021_import_organization/config.json +29 -9
- package/rules/common/C021_import_organization/dart/analyzer.js +40 -0
- package/rules/common/C021_import_organization/index.js +83 -0
- package/rules/common/C021_import_organization/{ts-morph-analyzer.js → typescript/ts-morph-analyzer.js} +0 -1
- package/rules/common/C023_no_duplicate_variable/config.json +7 -2
- package/rules/common/C023_no_duplicate_variable/dart/analyzer.js +40 -0
- package/rules/common/C023_no_duplicate_variable/index.js +83 -0
- package/rules/common/C024_no_scatter_hardcoded_constants/config.json +7 -2
- package/rules/common/C024_no_scatter_hardcoded_constants/dart/analyzer.js +40 -0
- package/rules/common/C024_no_scatter_hardcoded_constants/index.js +83 -0
- package/rules/common/C024_no_scatter_hardcoded_constants/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -1
- package/rules/common/C029_catch_block_logging/config.json +15 -5
- package/rules/common/C029_catch_block_logging/dart/analyzer.js +40 -0
- package/rules/common/C029_catch_block_logging/index.js +83 -0
- package/rules/common/C030_use_custom_error_classes/config.json +28 -0
- package/rules/common/C030_use_custom_error_classes/dart/analyzer.js +40 -0
- package/rules/common/C030_use_custom_error_classes/index.js +83 -0
- package/rules/common/C031_validation_separation/config.json +28 -0
- package/rules/common/C031_validation_separation/dart/analyzer.js +40 -0
- package/rules/common/C031_validation_separation/index.js +83 -0
- package/rules/common/C033_separate_service_repository/config.json +8 -3
- package/rules/common/C033_separate_service_repository/dart/analyzer.js +40 -0
- package/rules/common/C033_separate_service_repository/index.js +83 -0
- package/rules/common/C035_error_logging_context/config.json +34 -12
- package/rules/common/C035_error_logging_context/dart/analyzer.js +40 -0
- package/rules/common/C035_error_logging_context/index.js +83 -0
- package/rules/common/C040_centralized_validation/config.json +37 -8
- package/rules/common/C040_centralized_validation/dart/analyzer.js +40 -0
- package/rules/common/C040_centralized_validation/index.js +83 -0
- package/rules/common/C041_no_sensitive_hardcode/config.json +7 -2
- package/rules/common/C041_no_sensitive_hardcode/dart/analyzer.js +40 -0
- package/rules/common/C041_no_sensitive_hardcode/index.js +83 -0
- package/rules/common/C042_boolean_name_prefix/config.json +28 -0
- package/rules/common/C042_boolean_name_prefix/dart/analyzer.js +40 -0
- package/rules/common/C042_boolean_name_prefix/index.js +83 -0
- package/rules/common/C043_no_console_or_print/config.json +28 -0
- package/rules/common/C043_no_console_or_print/dart/analyzer.js +40 -0
- package/rules/common/C043_no_console_or_print/index.js +83 -0
- package/rules/common/C047_no_duplicate_retry_logic/config.json +28 -0
- package/rules/common/C047_no_duplicate_retry_logic/dart/analyzer.js +40 -0
- package/rules/common/C047_no_duplicate_retry_logic/index.js +83 -0
- package/rules/common/C048_no_bypass_architectural_layers/config.json +7 -2
- package/rules/common/C048_no_bypass_architectural_layers/dart/analyzer.js +40 -0
- package/rules/common/C048_no_bypass_architectural_layers/index.js +83 -0
- package/rules/common/C052_parsing_or_data_transformation/config.json +7 -2
- package/rules/common/C052_parsing_or_data_transformation/dart/analyzer.js +40 -0
- package/rules/common/C052_parsing_or_data_transformation/index.js +83 -0
- package/rules/common/C060_no_override_superclass/config.json +7 -2
- package/rules/common/C060_no_override_superclass/dart/analyzer.js +40 -0
- package/rules/common/C060_no_override_superclass/index.js +83 -0
- package/rules/common/C065_one_behavior_per_test/config.json +187 -28
- package/rules/common/C065_one_behavior_per_test/dart/analyzer.js +40 -0
- package/rules/common/C065_one_behavior_per_test/index.js +83 -0
- package/rules/common/C067_no_hardcoded_config/config.json +18 -4
- package/rules/common/C067_no_hardcoded_config/dart/analyzer.js +40 -0
- package/rules/common/C067_no_hardcoded_config/index.js +83 -0
- package/rules/common/C070_no_real_time_tests/config.json +41 -12
- package/rules/common/C070_no_real_time_tests/dart/analyzer.js +40 -0
- package/rules/common/C070_no_real_time_tests/index.js +83 -0
- package/rules/common/C072_single_test_behavior/config.json +28 -0
- package/rules/common/C072_single_test_behavior/dart/analyzer.js +40 -0
- package/rules/common/C072_single_test_behavior/index.js +83 -0
- package/rules/common/C073_validate_required_config_on_startup/config.json +93 -18
- package/rules/common/C073_validate_required_config_on_startup/dart/analyzer.js +40 -0
- package/rules/common/C073_validate_required_config_on_startup/index.js +83 -0
- package/rules/common/C073_validate_required_config_on_startup/{analyzer.js → typescript/analyzer.js} +0 -1
- package/rules/common/C075_explicit_return_types/config.json +28 -0
- package/rules/common/C075_explicit_return_types/dart/analyzer.js +40 -0
- package/rules/common/C075_explicit_return_types/index.js +83 -0
- package/rules/common/C076_explicit_function_types/config.json +18 -4
- package/rules/common/C076_explicit_function_types/dart/analyzer.js +40 -0
- package/rules/common/C076_explicit_function_types/index.js +83 -0
- package/rules/index.js +26 -6
- package/rules/security/S003_open_redirect_protection/config.json +11 -53
- package/rules/security/S003_open_redirect_protection/dart/analyzer.js +43 -0
- package/rules/security/S003_open_redirect_protection/index.js +94 -0
- package/rules/security/S003_open_redirect_protection/typescript/analyzer.js +105 -0
- package/rules/security/S003_open_redirect_protection/{symbol-based-analyzer.js → typescript/semantic-analyzer.js} +1 -1
- package/rules/security/S004_sensitive_data_logging/config.json +1 -1
- package/rules/security/S004_sensitive_data_logging/dart/analyzer.js +58 -0
- package/rules/security/S004_sensitive_data_logging/index.js +93 -0
- package/rules/security/S005_no_origin_auth/dart/analyzer.js +30 -0
- package/rules/security/S005_no_origin_auth/index.js +83 -0
- package/rules/security/S005_no_origin_auth/{analyzer.js → typescript/analyzer.js} +1 -0
- package/rules/security/S006_no_plaintext_recovery_codes/dart/analyzer.js +30 -0
- package/rules/security/S006_no_plaintext_recovery_codes/index.js +83 -0
- package/rules/security/S007_no_plaintext_otp/dart/analyzer.js +30 -0
- package/rules/security/S007_no_plaintext_otp/index.js +83 -0
- package/rules/security/S009_no_insecure_encryption/dart/analyzer.js +30 -0
- package/rules/security/S009_no_insecure_encryption/index.js +83 -0
- package/rules/security/S010_no_insecure_encryption/dart/analyzer.js +30 -0
- package/rules/security/S010_no_insecure_encryption/index.js +83 -0
- package/rules/security/S011_secure_guid_generation/dart/analyzer.js +30 -0
- package/rules/security/S011_secure_guid_generation/index.js +83 -0
- package/rules/security/S012_hardcoded_secrets/dart/analyzer.js +30 -0
- package/rules/security/S012_hardcoded_secrets/index.js +83 -0
- package/rules/security/S012_hardcoded_secrets/typescript/config.json +75 -0
- package/rules/security/S013_tls_enforcement/dart/analyzer.js +30 -0
- package/rules/security/S013_tls_enforcement/index.js +83 -0
- package/rules/security/S014_tls_version_enforcement/dart/analyzer.js +30 -0
- package/rules/security/S014_tls_version_enforcement/index.js +83 -0
- package/rules/security/S015_insecure_tls_certificate/config.json +41 -0
- package/rules/security/S015_insecure_tls_certificate/dart/analyzer.js +19 -0
- package/rules/security/S015_insecure_tls_certificate/index.js +83 -0
- package/rules/security/S016_no_sensitive_querystring/dart/analyzer.js +30 -0
- package/rules/security/S016_no_sensitive_querystring/index.js +83 -0
- package/rules/security/S017_use_parameterized_queries/dart/analyzer.js +30 -0
- package/rules/security/S017_use_parameterized_queries/index.js +83 -0
- package/rules/security/S019_smtp_injection_protection/dart/analyzer.js +30 -0
- package/rules/security/S019_smtp_injection_protection/index.js +83 -0
- package/rules/security/S020_no_eval_dynamic_code/dart/analyzer.js +30 -0
- package/rules/security/S020_no_eval_dynamic_code/index.js +83 -0
- package/rules/security/S022_escape_output_context/dart/analyzer.js +30 -0
- package/rules/security/S022_escape_output_context/index.js +83 -0
- package/rules/security/S023_no_json_injection/dart/analyzer.js +30 -0
- package/rules/security/S023_no_json_injection/index.js +83 -0
- package/rules/security/S024_xpath_xxe_protection/dart/analyzer.js +30 -0
- package/rules/security/S024_xpath_xxe_protection/index.js +83 -0
- package/rules/security/S025_server_side_validation/dart/analyzer.js +30 -0
- package/rules/security/S025_server_side_validation/index.js +83 -0
- package/rules/security/S026_json_schema_validation/dart/analyzer.js +30 -0
- package/rules/security/S026_json_schema_validation/index.js +83 -0
- package/rules/security/S027_no_hardcoded_secrets/dart/analyzer.js +30 -0
- package/rules/security/S027_no_hardcoded_secrets/index.js +83 -0
- package/rules/security/S028_file_upload_size_limits/dart/analyzer.js +30 -0
- package/rules/security/S028_file_upload_size_limits/index.js +83 -0
- package/rules/security/S029_csrf_protection/dart/analyzer.js +30 -0
- package/rules/security/S029_csrf_protection/index.js +83 -0
- package/rules/security/S030_directory_browsing_protection/dart/analyzer.js +30 -0
- package/rules/security/S030_directory_browsing_protection/index.js +83 -0
- package/rules/security/S031_secure_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S031_secure_session_cookies/index.js +83 -0
- package/rules/security/S032_httponly_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S032_httponly_session_cookies/index.js +83 -0
- package/rules/security/S033_samesite_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S033_samesite_session_cookies/index.js +83 -0
- package/rules/security/S034_host_prefix_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S034_host_prefix_session_cookies/index.js +83 -0
- package/rules/security/S035_path_session_cookies/dart/analyzer.js +30 -0
- package/rules/security/S035_path_session_cookies/index.js +83 -0
- package/rules/security/S036_lfi_rfi_protection/dart/analyzer.js +30 -0
- package/rules/security/S036_lfi_rfi_protection/index.js +83 -0
- package/rules/security/S037_cache_headers/dart/analyzer.js +30 -0
- package/rules/security/S037_cache_headers/index.js +83 -0
- package/rules/security/S038_no_version_headers/dart/analyzer.js +30 -0
- package/rules/security/S038_no_version_headers/index.js +83 -0
- package/rules/security/S039_no_session_tokens_in_url/dart/analyzer.js +30 -0
- package/rules/security/S039_no_session_tokens_in_url/index.js +83 -0
- package/rules/security/S040_session_fixation_protection/dart/analyzer.js +30 -0
- package/rules/security/S040_session_fixation_protection/index.js +83 -0
- package/rules/security/S041_session_token_invalidation/dart/analyzer.js +30 -0
- package/rules/security/S041_session_token_invalidation/index.js +83 -0
- package/rules/security/S042_require_re_authentication_for_long_lived/dart/analyzer.js +30 -0
- package/rules/security/S042_require_re_authentication_for_long_lived/index.js +83 -0
- package/rules/security/S043_password_changes_invalidate_all_sessions/dart/analyzer.js +30 -0
- package/rules/security/S043_password_changes_invalidate_all_sessions/index.js +83 -0
- package/rules/security/S044_re_authentication_required/dart/analyzer.js +30 -0
- package/rules/security/S044_re_authentication_required/index.js +83 -0
- package/rules/security/S045_brute_force_protection/dart/analyzer.js +30 -0
- package/rules/security/S045_brute_force_protection/index.js +83 -0
- package/rules/security/S048_no_current_password_in_reset/dart/analyzer.js +30 -0
- package/rules/security/S048_no_current_password_in_reset/index.js +83 -0
- package/rules/security/S049_short_validity_tokens/dart/analyzer.js +30 -0
- package/rules/security/S049_short_validity_tokens/index.js +83 -0
- package/rules/security/S049_short_validity_tokens/typescript/config.json +124 -0
- package/rules/security/S051_password_length_policy/dart/analyzer.js +30 -0
- package/rules/security/S051_password_length_policy/index.js +83 -0
- package/rules/security/S051_password_length_policy/typescript/config.json +83 -0
- package/rules/security/S052_weak_otp_entropy/dart/analyzer.js +30 -0
- package/rules/security/S052_weak_otp_entropy/index.js +83 -0
- package/rules/security/S052_weak_otp_entropy/typescript/config.json +57 -0
- package/rules/security/S054_no_default_accounts/dart/analyzer.js +30 -0
- package/rules/security/S054_no_default_accounts/index.js +83 -0
- package/rules/security/S054_no_default_accounts/typescript/config.json +101 -0
- package/rules/security/S055_content_type_validation/dart/analyzer.js +30 -0
- package/rules/security/S055_content_type_validation/index.js +83 -0
- package/rules/security/S056_log_injection_protection/dart/analyzer.js +30 -0
- package/rules/security/S056_log_injection_protection/index.js +83 -0
- package/rules/security/S057_utc_logging/dart/analyzer.js +30 -0
- package/rules/security/S057_utc_logging/index.js +83 -0
- package/rules/security/S057_utc_logging/typescript/config.json +105 -0
- package/rules/security/S058_no_ssrf/dart/analyzer.js +30 -0
- package/rules/security/S058_no_ssrf/index.js +83 -0
- package/rules/security/S058_no_ssrf/{analyzer.js → typescript/analyzer.js} +0 -1
- package/rules/security/S058_no_ssrf/typescript/config.json +125 -0
- package/scripts/build-release.sh +12 -0
- package/scripts/copy-impact-analyzer.js +135 -0
- package/scripts/install.sh +0 -0
- package/scripts/manual-release.sh +0 -0
- package/scripts/pre-release-test.sh +0 -0
- package/scripts/prepare-release.sh +0 -0
- package/scripts/quick-performance-test.js +0 -0
- package/scripts/setup-github-registry.sh +0 -0
- package/scripts/trigger-release.sh +0 -0
- package/scripts/verify-install.sh +0 -0
- package/templates/combined-report.html +1418 -0
- package/rules/common/C002_no_duplicate_code/test-cases/api-handlers.ts +0 -64
- package/rules/common/C002_no_duplicate_code/test-cases/data-processor.ts +0 -46
- package/rules/common/C002_no_duplicate_code/test-cases/good-example.tsx +0 -40
- package/rules/common/C002_no_duplicate_code/test-cases/product-service.ts +0 -57
- package/rules/common/C002_no_duplicate_code/test-cases/user-service.ts +0 -49
- package/rules/common/C067_no_hardcoded_config/symbol-based-analyzer.js.backup +0 -3853
- package/rules/security/S003_open_redirect_protection/analyzer.js +0 -135
- /package/rules/common/C002_no_duplicate_code/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C003_no_vague_abbreviations/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C006_function_naming/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/{C008 → C008_variable_declaration_locality}/config.json +0 -0
- /package/rules/common/{C008 → C008_variable_declaration_locality/typescript}/analyzer.js +0 -0
- /package/rules/common/{C008 → C008_variable_declaration_locality/typescript}/ts-morph-analyzer.js +0 -0
- /package/rules/common/C010_limit_block_nesting/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C010_limit_block_nesting/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C010_limit_block_nesting/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C012_command_query_separation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C012_command_query_separation/{ast-analyzer.js → typescript/ast-analyzer.js} +0 -0
- /package/rules/common/C013_no_dead_code/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C013_no_dead_code/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C013_no_dead_code/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C014_dependency_injection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C014_dependency_injection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C017_constructor_logic/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C017_constructor_logic/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C018_no_throw_generic_error/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C018_no_throw_generic_error/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C018_no_throw_generic_error/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C019_log_level_usage/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C019_log_level_usage/{pattern-analyzer.js → typescript/pattern-analyzer.js} +0 -0
- /package/rules/common/C019_log_level_usage/{system-log-analyzer.js → typescript/system-log-analyzer.js} +0 -0
- /package/rules/common/C020_unused_imports/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C021_import_organization/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C023_no_duplicate_variable/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C023_no_duplicate_variable/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C024_no_scatter_hardcoded_constants/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C029_catch_block_logging/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C030_use_custom_error_classes/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C031_validation_separation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C033_separate_service_repository/{README.md → typescript/README.md} +0 -0
- /package/rules/common/C033_separate_service_repository/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C033_separate_service_repository/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C033_separate_service_repository/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C035_error_logging_context/{STRATEGY.md → typescript/STRATEGY.md} +0 -0
- /package/rules/common/C035_error_logging_context/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C035_error_logging_context/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C035_error_logging_context/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C040_centralized_validation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C040_centralized_validation/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/common/C040_centralized_validation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C041_no_sensitive_hardcode/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C041_no_sensitive_hardcode/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C042_boolean_name_prefix/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C043_no_console_or_print/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C047_no_duplicate_retry_logic/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C047_no_duplicate_retry_logic/{c047-semantic-rule.js → typescript/c047-semantic-rule.js} +0 -0
- /package/rules/common/C047_no_duplicate_retry_logic/{symbol-analyzer-enhanced.js → typescript/symbol-analyzer-enhanced.js} +0 -0
- /package/rules/common/C047_no_duplicate_retry_logic/{symbol-config.json → typescript/symbol-config.json} +0 -0
- /package/rules/common/C048_no_bypass_architectural_layers/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C048_no_bypass_architectural_layers/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C052_parsing_or_data_transformation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C052_parsing_or_data_transformation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C060_no_override_superclass/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C060_no_override_superclass/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C065_one_behavior_per_test/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C067_no_hardcoded_config/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C067_no_hardcoded_config/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C070_no_real_time_tests/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C070_no_real_time_tests/{regex-analyzer.js → typescript/regex-analyzer.js} +0 -0
- /package/rules/common/C072_single_test_behavior/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C073_validate_required_config_on_startup/{README.md → typescript/README.md} +0 -0
- /package/rules/common/C073_validate_required_config_on_startup/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/common/C075_explicit_return_types/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C076_explicit_function_types/{README.md → typescript/README.md} +0 -0
- /package/rules/common/C076_explicit_function_types/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/common/C076_explicit_function_types/{semantic-analyzer.js → typescript/semantic-analyzer.js} +0 -0
- /package/rules/security/S003_open_redirect_protection/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S004_sensitive_data_logging/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S004_sensitive_data_logging/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S005_no_origin_auth/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S005_no_origin_auth/{ast-analyzer.js → typescript/ast-analyzer.js} +0 -0
- /package/rules/security/S005_no_origin_auth/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S006_no_plaintext_recovery_codes/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S006_no_plaintext_recovery_codes/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S006_no_plaintext_recovery_codes/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{semantic-analyzer.js → typescript/semantic-analyzer.js} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{semantic-config.json → typescript/semantic-config.json} +0 -0
- /package/rules/security/S007_no_plaintext_otp/{semantic-wrapper.js → typescript/semantic-wrapper.js} +0 -0
- /package/rules/security/S009_no_insecure_encryption/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S009_no_insecure_encryption/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S010_no_insecure_encryption/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S010_no_insecure_encryption/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S011_secure_guid_generation/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S011_secure_guid_generation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S011_secure_guid_generation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S012_hardcoded_secrets/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S012_hardcoded_secrets/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S013_tls_enforcement/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S013_tls_enforcement/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S013_tls_enforcement/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S014_tls_version_enforcement/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S014_tls_version_enforcement/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S014_tls_version_enforcement/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S015_insecure_tls_certificate/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S015_insecure_tls_certificate/{ast-analyzer.js → typescript/ast-analyzer.js} +0 -0
- /package/rules/security/S016_no_sensitive_querystring/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S016_no_sensitive_querystring/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S016_no_sensitive_querystring/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S017_use_parameterized_queries/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S017_use_parameterized_queries/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S017_use_parameterized_queries/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S019_smtp_injection_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S019_smtp_injection_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S020_no_eval_dynamic_code/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S020_no_eval_dynamic_code/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S020_no_eval_dynamic_code/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S022_escape_output_context/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S022_escape_output_context/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S023_no_json_injection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S023_no_json_injection/{ast-analyzer.js → typescript/ast-analyzer.js} +0 -0
- /package/rules/security/S024_xpath_xxe_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S024_xpath_xxe_protection/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S024_xpath_xxe_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S025_server_side_validation/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S025_server_side_validation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S025_server_side_validation/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S025_server_side_validation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S026_json_schema_validation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S027_no_hardcoded_secrets/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S027_no_hardcoded_secrets/{categories.json → typescript/categories.json} +0 -0
- /package/rules/security/S027_no_hardcoded_secrets/{categorized-analyzer.js → typescript/categorized-analyzer.js} +0 -0
- /package/rules/security/S028_file_upload_size_limits/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S028_file_upload_size_limits/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S028_file_upload_size_limits/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S029_csrf_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S030_directory_browsing_protection/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S030_directory_browsing_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S030_directory_browsing_protection/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S030_directory_browsing_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S031_secure_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S031_secure_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S031_secure_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{FRAMEWORK_SUPPORT.md → typescript/FRAMEWORK_SUPPORT.md} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S032_httponly_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S033_samesite_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S033_samesite_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S033_samesite_session_cookies/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S033_samesite_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S034_host_prefix_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S034_host_prefix_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S034_host_prefix_session_cookies/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S034_host_prefix_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S035_path_session_cookies/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S035_path_session_cookies/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S035_path_session_cookies/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S035_path_session_cookies/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S036_lfi_rfi_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S037_cache_headers/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S037_cache_headers/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S037_cache_headers/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S037_cache_headers/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S038_no_version_headers/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S038_no_version_headers/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S038_no_version_headers/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S038_no_version_headers/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S039_no_session_tokens_in_url/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S039_no_session_tokens_in_url/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S039_no_session_tokens_in_url/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S039_no_session_tokens_in_url/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S040_session_fixation_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S041_session_token_invalidation/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S041_session_token_invalidation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S041_session_token_invalidation/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S041_session_token_invalidation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S042_require_re_authentication_for_long_lived/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S042_require_re_authentication_for_long_lived/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S042_require_re_authentication_for_long_lived/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S043_password_changes_invalidate_all_sessions/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S043_password_changes_invalidate_all_sessions/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S043_password_changes_invalidate_all_sessions/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S044_re_authentication_required/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S044_re_authentication_required/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S044_re_authentication_required/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S044_re_authentication_required/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S045_brute_force_protection/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S045_brute_force_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S045_brute_force_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S048_no_current_password_in_reset/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S048_no_current_password_in_reset/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S049_short_validity_tokens/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S049_short_validity_tokens/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S049_short_validity_tokens/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S051_password_length_policy/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S052_weak_otp_entropy/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S054_no_default_accounts/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S054_no_default_accounts/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S055_content_type_validation/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S055_content_type_validation/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S055_content_type_validation/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S056_log_injection_protection/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S056_log_injection_protection/{regex-based-analyzer.js → typescript/regex-based-analyzer.js} +0 -0
- /package/rules/security/S056_log_injection_protection/{symbol-based-analyzer.js → typescript/symbol-based-analyzer.js} +0 -0
- /package/rules/security/S057_utc_logging/{README.md → typescript/README.md} +0 -0
- /package/rules/security/S057_utc_logging/{analyzer.js → typescript/analyzer.js} +0 -0
- /package/rules/security/S058_no_ssrf/{README.md → typescript/README.md} +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Impact Analyzer - Main Entry Point
|
|
5
|
+
* Orchestrates the entire impact analysis workflow
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { CLI } from './cli.js';
|
|
9
|
+
import { loadConfig } from './config/default-config.js';
|
|
10
|
+
import { ChangeDetector } from './core/change-detector.js';
|
|
11
|
+
import { ImpactAnalyzer } from './core/impact-analyzer.js';
|
|
12
|
+
import { ReportGenerator } from './core/report-generator.js';
|
|
13
|
+
import { GitUtils } from './core/utils/git-utils.js';
|
|
14
|
+
import fs from 'fs';
|
|
15
|
+
import path from 'path';
|
|
16
|
+
|
|
17
|
+
async function main() {
|
|
18
|
+
const cli = new CLI(process.argv);
|
|
19
|
+
|
|
20
|
+
// Show help if requested
|
|
21
|
+
if (cli.hasArg('help') || cli.hasArg('h')) {
|
|
22
|
+
cli.showHelp();
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Load configuration
|
|
27
|
+
const config = loadConfig(cli);
|
|
28
|
+
const absoluteSourceDir = path.resolve(config.sourceDir);
|
|
29
|
+
|
|
30
|
+
console.log('🚀 Starting Impact Analysis...\n');
|
|
31
|
+
console.log('Configuration:');
|
|
32
|
+
console.log(` Source Dir: ${config.sourceDir}`);
|
|
33
|
+
console.log(` Absolute Path: ${absoluteSourceDir}`);
|
|
34
|
+
console.log(` Base Ref: ${config.baseRef}`);
|
|
35
|
+
console.log(` Head Ref: ${config.headRef}`);
|
|
36
|
+
console.log(` Exclude: ${config.excludePaths.join(', ')}`);
|
|
37
|
+
console.log('');
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
// ============================================
|
|
41
|
+
// Validation
|
|
42
|
+
// ============================================
|
|
43
|
+
|
|
44
|
+
// Check if source directory exists
|
|
45
|
+
if (! fs.existsSync(absoluteSourceDir)) {
|
|
46
|
+
throw new Error(`Source directory does not exist: ${absoluteSourceDir}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Check if it's a git repository
|
|
50
|
+
if (!GitUtils.isGitRepo(absoluteSourceDir)) {
|
|
51
|
+
throw new Error(`Source directory is not a git repository: ${absoluteSourceDir}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Check if refs exist
|
|
55
|
+
if (!GitUtils.refExists(config.baseRef, absoluteSourceDir)) {
|
|
56
|
+
throw new Error(`Base ref does not exist: ${config.baseRef}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.log('✓ Validation passed\n');
|
|
60
|
+
|
|
61
|
+
// ============================================
|
|
62
|
+
// Step 1: Detect Changes
|
|
63
|
+
// ============================================
|
|
64
|
+
console.log('📝 Step 1: Detecting changes...');
|
|
65
|
+
const detector = new ChangeDetector(config);
|
|
66
|
+
|
|
67
|
+
const changedFiles = detector.detectChangedFiles();
|
|
68
|
+
console.log(` ✓ Found ${changedFiles.length} changed files`);
|
|
69
|
+
|
|
70
|
+
const changedSymbols = detector.detectChangedSymbols(changedFiles);
|
|
71
|
+
console.log(` ✓ Found ${changedSymbols.length} changed symbols\n`);
|
|
72
|
+
|
|
73
|
+
const changes = {
|
|
74
|
+
changedFiles,
|
|
75
|
+
changedSymbols,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// ============================================
|
|
79
|
+
// Step 2: Analyze Impact
|
|
80
|
+
// ============================================
|
|
81
|
+
console.log('🔍 Step 2: Analyzing impact...');
|
|
82
|
+
const analyzer = new ImpactAnalyzer(config);
|
|
83
|
+
|
|
84
|
+
// Initialize method-level call graph for precise tracking
|
|
85
|
+
await analyzer.initializeMethodCallGraph();
|
|
86
|
+
|
|
87
|
+
const impact = await analyzer.analyzeImpact(changes);
|
|
88
|
+
console.log(` ✓ Impact score: ${impact.impactScore}`);
|
|
89
|
+
console.log(` ✓ Severity: ${impact.severity.toUpperCase()}\n`);
|
|
90
|
+
|
|
91
|
+
// ============================================
|
|
92
|
+
// Step 3: Generate Reports
|
|
93
|
+
// ============================================
|
|
94
|
+
console.log('📄 Step 3: Generating reports...\n');
|
|
95
|
+
const reporter = new ReportGenerator();
|
|
96
|
+
|
|
97
|
+
// Console report
|
|
98
|
+
reporter.generateConsoleReport(changes, impact);
|
|
99
|
+
|
|
100
|
+
// Markdown report
|
|
101
|
+
const markdownReport = reporter.generateMarkdownReport(changes, impact);
|
|
102
|
+
|
|
103
|
+
// Save to file
|
|
104
|
+
const outputFile = cli.getArg('output', 'impact-report.md');
|
|
105
|
+
fs.writeFileSync(outputFile, markdownReport);
|
|
106
|
+
console.log(`✅ Report saved to: ${outputFile}\n`);
|
|
107
|
+
|
|
108
|
+
// JSON output (optional)
|
|
109
|
+
if (cli.hasArg('json')) {
|
|
110
|
+
const jsonOutput = cli.getArg('json');
|
|
111
|
+
const jsonReport = reporter.generateJSONReport(changes, impact);
|
|
112
|
+
fs.writeFileSync(jsonOutput, JSON.stringify(jsonReport, null, 2));
|
|
113
|
+
console.log(`✅ JSON report saved to: ${jsonOutput}\n`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Exit with code based on severity
|
|
117
|
+
if (impact.severity === 'critical' && ! cli.hasArg('no-fail')) {
|
|
118
|
+
console.log('⚠️ Critical impact detected - exiting with error code');
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
console.log('✨ Analysis completed successfully!\n');
|
|
123
|
+
process.exit(0);
|
|
124
|
+
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error('❌ Error during analysis:', error.message);
|
|
127
|
+
if (cli.hasArg('verbose')) {
|
|
128
|
+
console.error(error.stack);
|
|
129
|
+
}
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Run if executed directly
|
|
135
|
+
main();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sunlint/impact-analyzer",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Automated impact analysis for TypeScript/JavaScript projects (internal - bundled into sunlint)",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"impact-analyzer": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "echo 'No build required (pure Node.js)'",
|
|
13
|
+
"test": "echo 'No tests yet'",
|
|
14
|
+
"analyze": "node index.js"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"impact-analysis",
|
|
18
|
+
"code-analysis",
|
|
19
|
+
"ci-cd"
|
|
20
|
+
],
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@babel/parser": "^7.23.0",
|
|
25
|
+
"@babel/traverse": "^7.23.0",
|
|
26
|
+
"glob": "^10.3.0",
|
|
27
|
+
"ts-morph": "^27.0.2"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sun-asterisk/sunlint",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.35",
|
|
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": {
|
|
@@ -15,46 +15,6 @@
|
|
|
15
15
|
"registry": "https://registry.npmjs.org",
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"test": "node examples/run-tests.js",
|
|
20
|
-
"test:examples": "node examples/integration-tests/examples-integration-test.js",
|
|
21
|
-
"test:architecture": "node examples/integration-tests/core-architecture-test.js",
|
|
22
|
-
"test:integration": "echo 'Temporarily disabled - config extension issue'",
|
|
23
|
-
"test:realworld": "node examples/integration-tests/realworld-integration-test.js",
|
|
24
|
-
"test:cli": "node examples/integration-tests/direct-cli-test.js",
|
|
25
|
-
"test:performance": "node test/performance-test.js",
|
|
26
|
-
"test:c019": "node cli.js --rule=C019 --input=examples/test-fixtures --format=eslint",
|
|
27
|
-
"test:c006": "node cli.js --rule=C006 --input=examples/test-fixtures --format=eslint",
|
|
28
|
-
"test:c029": "node cli.js --rule=C029 --input=examples/test-fixtures --format=eslint",
|
|
29
|
-
"test:multi": "node cli.js --rules=C019,C006,C029 --input=examples/test-fixtures --format=eslint",
|
|
30
|
-
"test:all": "node cli.js --all --input=examples/test-fixtures --format=eslint",
|
|
31
|
-
"test:quality": "node cli.js --category=quality --input=examples/test-fixtures --format=eslint",
|
|
32
|
-
"test:security": "node cli.js --category=security --input=examples/test-fixtures --format=eslint",
|
|
33
|
-
"demo": "./demo.sh",
|
|
34
|
-
"demo:single": "node cli.js --rule=C019 --input=examples/test-fixtures/typescript --format=eslint",
|
|
35
|
-
"demo:multi": "node cli.js --rules=C019,C006 --input=test/fixtures --format=summary",
|
|
36
|
-
"demo:quality": "node cli.js --quality --input=test/fixtures --format=summary",
|
|
37
|
-
"demo:security": "node cli.js --security --input=test/fixtures --format=summary",
|
|
38
|
-
"demo:all": "node cli.js --all --input=test/fixtures --format=summary",
|
|
39
|
-
"demo:config": "node cli.js --config=.sunlint.json --input=test/fixtures",
|
|
40
|
-
"demo:eslint-integration": "./demo-eslint-integration.sh",
|
|
41
|
-
"demo:file-targeting": "./demo-file-targeting.sh",
|
|
42
|
-
"lint": "node cli.js --config=.sunlint.json --input=.",
|
|
43
|
-
"lint:eslint-integration": "node cli.js --all --eslint-integration --input=.",
|
|
44
|
-
"build": "npm run copy-rules && npm run generate-registry && npm run copy-arch-detect && echo 'Build completed'",
|
|
45
|
-
"copy-rules": "node scripts/copy-rules.js",
|
|
46
|
-
"generate-registry": "node scripts/generate-rules-registry.js",
|
|
47
|
-
"copy-arch-detect": "node scripts/copy-arch-detect.js",
|
|
48
|
-
"clean": "rm -rf coverage/ *.log reports/ *.tgz engines/arch-detect",
|
|
49
|
-
"postpack": "echo '📦 Package created successfully! Size: ' && ls -lh *.tgz | awk '{print $5}'",
|
|
50
|
-
"start": "node cli.js --help",
|
|
51
|
-
"version": "node cli.js --version",
|
|
52
|
-
"pack": "npm run build && npm pack",
|
|
53
|
-
"publish:github": "npm publish --registry=https://npm.pkg.github.com",
|
|
54
|
-
"publish:npmjs": "npm publish --registry=https://registry.npmjs.org",
|
|
55
|
-
"publish:test": "npm publish --dry-run --registry=https://registry.npmjs.org",
|
|
56
|
-
"prepublishOnly": "npm run clean && npm run build"
|
|
57
|
-
},
|
|
58
18
|
"keywords": [
|
|
59
19
|
"linting",
|
|
60
20
|
"code-quality",
|
|
@@ -79,6 +39,7 @@
|
|
|
79
39
|
"integrations/",
|
|
80
40
|
"rules/",
|
|
81
41
|
"scripts/",
|
|
42
|
+
"templates/",
|
|
82
43
|
"docs/",
|
|
83
44
|
".sunlint.json",
|
|
84
45
|
"README.md",
|
|
@@ -139,5 +100,19 @@
|
|
|
139
100
|
"bugs": {
|
|
140
101
|
"url": "https://github.com/sun-asterisk/engineer-excellence/issues"
|
|
141
102
|
},
|
|
142
|
-
"homepage": "https://github.com/sun-asterisk/engineer-excellence/tree/main/coding-quality/extensions/sunlint#readme"
|
|
143
|
-
|
|
103
|
+
"homepage": "https://github.com/sun-asterisk/engineer-excellence/tree/main/coding-quality/extensions/sunlint#readme",
|
|
104
|
+
"scripts": {
|
|
105
|
+
"test": "node examples/run-tests.js",
|
|
106
|
+
"test:perf": "node test/performance-test.js",
|
|
107
|
+
"lint": "node cli.js --all --input=. --format=summary",
|
|
108
|
+
"build": "pnpm run copy-rules && pnpm run generate-registry && pnpm run copy-arch-detect && pnpm run copy-impact",
|
|
109
|
+
"copy-rules": "node scripts/copy-rules.js",
|
|
110
|
+
"generate-registry": "node scripts/generate-rules-registry.js",
|
|
111
|
+
"copy-arch-detect": "node scripts/copy-arch-detect.js",
|
|
112
|
+
"copy-impact": "node scripts/copy-impact-analyzer.js",
|
|
113
|
+
"clean": "rm -rf coverage/ *.log reports/ *.tgz engines/arch-detect engines/impact",
|
|
114
|
+
"pack": "pnpm run build && pnpm pack",
|
|
115
|
+
"publish:npmjs": "pnpm publish --registry=https://registry.npmjs.org --no-git-checks",
|
|
116
|
+
"publish:test": "pnpm publish --dry-run --registry=https://registry.npmjs.org --no-git-checks"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
3
|
-
"name": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"severity": "
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"status": "pending"
|
|
2
|
+
"id": "C002",
|
|
3
|
+
"name": "No Duplicate Code",
|
|
4
|
+
"description": "Không để trùng lặp code > 10 dòng - Tránh code rối, khó refactor và áp dụng DRY principle",
|
|
5
|
+
"category": "complexity",
|
|
6
|
+
"severity": "warning",
|
|
7
|
+
"languages": ["typescript", "javascript", "dart"],
|
|
8
|
+
"config": {
|
|
9
|
+
"minLines": 10,
|
|
10
|
+
"similarityThreshold": 0.95
|
|
12
11
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"**/*.ts"
|
|
17
|
-
],
|
|
18
|
-
"exclude": [
|
|
19
|
-
"**/*.test.*",
|
|
20
|
-
"**/*.spec.*"
|
|
21
|
-
]
|
|
22
|
-
}
|
|
12
|
+
"references": [
|
|
13
|
+
"https://en.wikipedia.org/wiki/Don%27t_repeat_yourself"
|
|
14
|
+
]
|
|
23
15
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C002 Dart Analyzer - No Duplicate Code (> 10 lines)
|
|
3
|
+
*
|
|
4
|
+
* This is a JS wrapper that delegates to DartAnalyzer binary.
|
|
5
|
+
* Actual implementation: dart_analyzer/lib/rules/duplicate_code_analyzer.dart
|
|
6
|
+
*
|
|
7
|
+
* Rule: Không để trùng lặp code > 10 dòng
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
class DartC002Analyzer {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.ruleId = 'C002';
|
|
13
|
+
this.language = 'dart';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get rule metadata
|
|
18
|
+
*/
|
|
19
|
+
getMetadata() {
|
|
20
|
+
return {
|
|
21
|
+
ruleId: 'C002',
|
|
22
|
+
name: 'No Duplicate Code',
|
|
23
|
+
language: 'dart',
|
|
24
|
+
delegateTo: 'dart_analyzer',
|
|
25
|
+
description: 'Detect duplicate code blocks > 10 lines'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get default configuration
|
|
31
|
+
*/
|
|
32
|
+
getConfig() {
|
|
33
|
+
return {
|
|
34
|
+
minLines: 10,
|
|
35
|
+
similarityThreshold: 0.95,
|
|
36
|
+
severity: 'warning'
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Analysis is delegated to DartAnalyzer via heuristic-engine.js
|
|
42
|
+
*/
|
|
43
|
+
async analyze(files, language, options) {
|
|
44
|
+
// Delegated to DartAnalyzer binary via heuristic-engine.js
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
supportsLanguage(language) {
|
|
49
|
+
return language === 'dart';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = DartC002Analyzer;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C002 Rule Router - No Duplicate Code (> 10 lines)
|
|
3
|
+
*
|
|
4
|
+
* Routes analysis to the appropriate language-specific analyzer.
|
|
5
|
+
* Supports: TypeScript, JavaScript, Dart
|
|
6
|
+
*
|
|
7
|
+
* Rule: Không để trùng lặp code > 10 dòng
|
|
8
|
+
* - Cảnh báo nếu trùng lặp >= 10 dòng trong các function/class
|
|
9
|
+
* - Extract common logic thành functions hoặc utilities
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const path = require('path');
|
|
13
|
+
|
|
14
|
+
class C002Router {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.analyzers = new Map();
|
|
17
|
+
this.ruleId = 'C002';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getAnalyzer(language) {
|
|
21
|
+
const normalizedLang = this.normalizeLanguage(language);
|
|
22
|
+
|
|
23
|
+
if (!this.analyzers.has(normalizedLang)) {
|
|
24
|
+
try {
|
|
25
|
+
const analyzerPath = path.join(__dirname, normalizedLang, 'analyzer.js');
|
|
26
|
+
const AnalyzerClass = require(analyzerPath);
|
|
27
|
+
this.analyzers.set(normalizedLang, new AnalyzerClass());
|
|
28
|
+
} catch (error) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return this.analyzers.get(normalizedLang);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
normalizeLanguage(language) {
|
|
37
|
+
// Handle case where language might not be a string
|
|
38
|
+
if (typeof language !== 'string') {
|
|
39
|
+
return 'typescript'; // Default fallback
|
|
40
|
+
}
|
|
41
|
+
const languageMap = {
|
|
42
|
+
'typescript': 'typescript',
|
|
43
|
+
'javascript': 'typescript',
|
|
44
|
+
'ts': 'typescript',
|
|
45
|
+
'js': 'typescript',
|
|
46
|
+
'dart': 'dart'
|
|
47
|
+
};
|
|
48
|
+
return languageMap[language.toLowerCase()] || language.toLowerCase();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
supportsLanguage(language) {
|
|
52
|
+
if (typeof language !== 'string') return false;
|
|
53
|
+
const supported = ['typescript', 'javascript', 'ts', 'js', 'dart'];
|
|
54
|
+
return supported.includes(language.toLowerCase());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
getSupportedLanguages() {
|
|
58
|
+
return ['typescript', 'javascript', 'dart'];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async analyze(files, language, options = {}) {
|
|
62
|
+
const analyzer = this.getAnalyzer(language);
|
|
63
|
+
if (!analyzer) return [];
|
|
64
|
+
if (typeof analyzer.analyze === 'function') {
|
|
65
|
+
return analyzer.analyze(files, language, options);
|
|
66
|
+
}
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async initialize(semanticEngineOrLanguage = null, semanticEngine = null) {
|
|
71
|
+
// Handle both signatures:
|
|
72
|
+
// 1. initialize(semanticEngine) - called by heuristic engine
|
|
73
|
+
// 2. initialize(language, semanticEngine) - original signature
|
|
74
|
+
let engine = semanticEngine;
|
|
75
|
+
let lang = null;
|
|
76
|
+
|
|
77
|
+
if (typeof semanticEngineOrLanguage === 'string') {
|
|
78
|
+
lang = semanticEngineOrLanguage;
|
|
79
|
+
} else if (semanticEngineOrLanguage && typeof semanticEngineOrLanguage === 'object') {
|
|
80
|
+
engine = semanticEngineOrLanguage;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// If language specified, initialize only that analyzer
|
|
84
|
+
if (lang) {
|
|
85
|
+
const analyzer = this.getAnalyzer(lang);
|
|
86
|
+
if (analyzer && typeof analyzer.initialize === 'function') {
|
|
87
|
+
await analyzer.initialize(engine);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = new C002Router();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "Clear variable names, avoid arbitrary abbreviations",
|
|
5
5
|
"category": "naming",
|
|
6
6
|
"severity": "warning",
|
|
7
|
-
"
|
|
7
|
+
"languages": ["typescript", "javascript", "dart"],
|
|
8
8
|
"engine": "heuristic",
|
|
9
9
|
"meta": {
|
|
10
10
|
"docs": {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C003 Dart Analyzer - No Vague Abbreviations
|
|
3
|
+
*
|
|
4
|
+
* This is a JS wrapper that delegates to DartAnalyzer binary.
|
|
5
|
+
* Actual implementation: dart_analyzer/lib/rules/vague_abbreviations_analyzer.dart
|
|
6
|
+
*
|
|
7
|
+
* Rule: Clear variable names, avoid arbitrary abbreviations
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
class DartC003Analyzer {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.ruleId = 'C003';
|
|
13
|
+
this.language = 'dart';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get rule metadata
|
|
18
|
+
*/
|
|
19
|
+
getMetadata() {
|
|
20
|
+
return {
|
|
21
|
+
ruleId: 'C003',
|
|
22
|
+
name: 'No Vague Abbreviations',
|
|
23
|
+
language: 'dart',
|
|
24
|
+
delegateTo: 'dart_analyzer',
|
|
25
|
+
description: 'Ensure clear variable names without arbitrary abbreviations'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get default configuration
|
|
31
|
+
*/
|
|
32
|
+
getConfig() {
|
|
33
|
+
return {
|
|
34
|
+
minLength: 2,
|
|
35
|
+
allowedSingleChar: ['i', 'j', 'k', 'x', 'y', 'z', 'e', '_'],
|
|
36
|
+
allowedAbbreviations: ['id', 'url', 'api', 'io', 'db', 'ui', 'ok'],
|
|
37
|
+
severity: 'warning'
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Analysis is delegated to DartAnalyzer via heuristic-engine.js
|
|
43
|
+
*/
|
|
44
|
+
async analyze(files, language, options) {
|
|
45
|
+
// Delegated to DartAnalyzer binary via heuristic-engine.js
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
supportsLanguage(language) {
|
|
50
|
+
return language === 'dart';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = DartC003Analyzer;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C003 Rule Router - No Vague Abbreviations
|
|
3
|
+
*
|
|
4
|
+
* Routes analysis to the appropriate language-specific analyzer.
|
|
5
|
+
* Supports: TypeScript, JavaScript, Dart
|
|
6
|
+
*
|
|
7
|
+
* Rule: Clear variable names, avoid arbitrary abbreviations
|
|
8
|
+
* - Ensure clear, understandable variable names
|
|
9
|
+
* - Avoid vague/unclear abbreviations
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const path = require('path');
|
|
13
|
+
|
|
14
|
+
class C003Router {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.analyzers = new Map();
|
|
17
|
+
this.ruleId = 'C003';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getAnalyzer(language) {
|
|
21
|
+
const normalizedLang = this.normalizeLanguage(language);
|
|
22
|
+
|
|
23
|
+
if (!this.analyzers.has(normalizedLang)) {
|
|
24
|
+
try {
|
|
25
|
+
const analyzerPath = path.join(__dirname, normalizedLang, 'analyzer.js');
|
|
26
|
+
const AnalyzerClass = require(analyzerPath);
|
|
27
|
+
this.analyzers.set(normalizedLang, new AnalyzerClass());
|
|
28
|
+
} catch (error) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return this.analyzers.get(normalizedLang);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
normalizeLanguage(language) {
|
|
37
|
+
// Handle case where language might not be a string
|
|
38
|
+
if (typeof language !== 'string') {
|
|
39
|
+
return 'typescript'; // Default fallback
|
|
40
|
+
}
|
|
41
|
+
const languageMap = {
|
|
42
|
+
'typescript': 'typescript',
|
|
43
|
+
'javascript': 'typescript',
|
|
44
|
+
'ts': 'typescript',
|
|
45
|
+
'js': 'typescript',
|
|
46
|
+
'dart': 'dart'
|
|
47
|
+
};
|
|
48
|
+
return languageMap[language.toLowerCase()] || language.toLowerCase();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
supportsLanguage(language) {
|
|
52
|
+
if (typeof language !== 'string') return false;
|
|
53
|
+
const supported = ['typescript', 'javascript', 'ts', 'js', 'dart'];
|
|
54
|
+
return supported.includes(language.toLowerCase());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
getSupportedLanguages() {
|
|
58
|
+
return ['typescript', 'javascript', 'dart'];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async analyze(files, language, options = {}) {
|
|
62
|
+
const analyzer = this.getAnalyzer(language);
|
|
63
|
+
if (!analyzer) return [];
|
|
64
|
+
if (typeof analyzer.analyze === 'function') {
|
|
65
|
+
return analyzer.analyze(files, language, options);
|
|
66
|
+
}
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async initialize(semanticEngineOrLanguage = null, semanticEngine = null) {
|
|
71
|
+
// Handle both signatures:
|
|
72
|
+
// 1. initialize(semanticEngine) - called by heuristic engine
|
|
73
|
+
// 2. initialize(language, semanticEngine) - original signature
|
|
74
|
+
let engine = semanticEngine;
|
|
75
|
+
let lang = null;
|
|
76
|
+
|
|
77
|
+
if (typeof semanticEngineOrLanguage === 'string') {
|
|
78
|
+
lang = semanticEngineOrLanguage;
|
|
79
|
+
} else if (semanticEngineOrLanguage && typeof semanticEngineOrLanguage === 'object') {
|
|
80
|
+
engine = semanticEngineOrLanguage;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// If language specified, initialize only that analyzer
|
|
84
|
+
if (lang) {
|
|
85
|
+
const analyzer = this.getAnalyzer(lang);
|
|
86
|
+
if (analyzer && typeof analyzer.initialize === 'function') {
|
|
87
|
+
await analyzer.initialize(engine);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = new C003Router();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C006 Dart Analyzer - Function Naming Convention
|
|
3
|
+
*
|
|
4
|
+
* This is a JS wrapper that delegates to DartAnalyzer binary.
|
|
5
|
+
* Actual implementation: dart_analyzer/lib/rules/C006_function_naming.dart
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
class DartC006Analyzer {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.ruleId = 'C006';
|
|
11
|
+
this.language = 'dart';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getMetadata() {
|
|
15
|
+
return {
|
|
16
|
+
ruleId: 'C006',
|
|
17
|
+
name: 'Function Naming Convention',
|
|
18
|
+
language: 'dart',
|
|
19
|
+
delegateTo: 'dart_analyzer',
|
|
20
|
+
description: 'Tên hàm phải là động từ/verb-noun pattern'
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getConfig() {
|
|
25
|
+
return {
|
|
26
|
+
severity: 'warning'
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async analyze(files, language, options) {
|
|
31
|
+
// Delegated to DartAnalyzer binary via heuristic-engine.js
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
supportsLanguage(language) {
|
|
36
|
+
return language === 'dart';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = DartC006Analyzer;
|