@dxworks/insider 2.9.1
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/.github/workflows/build.yml +19 -0
- package/.github/workflows/release-docs.yml +15 -0
- package/.github/workflows/release-voyager.yml +57 -0
- package/.github/workflows/release.yml +102 -0
- package/Dockerfile +8 -0
- package/README.md +89 -0
- package/TODO.txt +7 -0
- package/bin/insider.bat +1 -0
- package/bin/insider.sh +1 -0
- package/build.gradle +55 -0
- package/config/.ignore +4 -0
- package/config/comments.json +71 -0
- package/config/fingerprints/_anomalies-full.json +116 -0
- package/config/fingerprints/_extLibs.json +2555 -0
- package/config/fingerprints/code_smells.json +94 -0
- package/config/fingerprints/generated_code.json +17 -0
- package/config/fingerprints/libraries.json +4667 -0
- package/config/ignoredImports.txt +0 -0
- package/config/insider-conf.properties +3 -0
- package/config/rules/cloud_services/ad_networks.json +50 -0
- package/config/rules/cloud_services/bigdata.json +21 -0
- package/config/rules/cloud_services/cloud_hosting.json +398 -0
- package/config/rules/cloud_services/data_storage.json +291 -0
- package/config/rules/cloud_services/ecommerce.json +45 -0
- package/config/rules/cloud_services/socialmedia.json +82 -0
- package/config/rules/cloud_services/web_analytics.json +108 -0
- package/config/rules/components/active_content.json +157 -0
- package/config/rules/components/load_dll.json +66 -0
- package/config/rules/cryptography/algorithm_implementation.json +62 -0
- package/config/rules/cryptography/certificate.json +199 -0
- package/config/rules/cryptography/ciphers.json +174 -0
- package/config/rules/cryptography/crypto_currency.json +32 -0
- package/config/rules/cryptography/encoding.json +20 -0
- package/config/rules/cryptography/extended.json +220 -0
- package/config/rules/cryptography/external_libraries.json +141 -0
- package/config/rules/cryptography/hash_algorithm.json +98 -0
- package/config/rules/cryptography/key_derivation.json +65 -0
- package/config/rules/cryptography/protocol.json +156 -0
- package/config/rules/cryptography/random.json +97 -0
- package/config/rules/cryptography/weakssl.json +206 -0
- package/config/rules/data_handling/compressed_files.json +18 -0
- package/config/rules/data_handling/database.json +361 -0
- package/config/rules/data_handling/deserialization.json +296 -0
- package/config/rules/data_handling/json_parsing.json +49 -0
- package/config/rules/data_handling/media_parsing.json +33 -0
- package/config/rules/data_handling/pastebin.json +18 -0
- package/config/rules/data_handling/xml_parsing.json +168 -0
- package/config/rules/data_types/financial.json +106 -0
- package/config/rules/data_types/media.json +48 -0
- package/config/rules/data_types/secrets.json +91 -0
- package/config/rules/data_types/sensitive.json +176 -0
- package/config/rules/device_permissions/IOSPermissions.json +240 -0
- package/config/rules/device_permissions/UWP.json +221 -0
- package/config/rules/device_permissions/android_intents.json +599 -0
- package/config/rules/frameworks/PHP.json +172 -0
- package/config/rules/frameworks/build.json +189 -0
- package/config/rules/frameworks/c.json +45 -0
- package/config/rules/frameworks/csharp-nonMS.json +19 -0
- package/config/rules/frameworks/java.json +291 -0
- package/config/rules/frameworks/javascript.json +318 -0
- package/config/rules/frameworks/logging.json +103 -0
- package/config/rules/frameworks/microsoft.json +257 -0
- package/config/rules/frameworks/python.json +274 -0
- package/config/rules/frameworks/ruby.json +53 -0
- package/config/rules/frameworks/rust.json +77 -0
- package/config/rules/general/OSS_license.json +146 -0
- package/config/rules/general/code_metrics.json +132 -0
- package/config/rules/general/dependencies.json +199 -0
- package/config/rules/general/hygiene.json +47 -0
- package/config/rules/general/platforms.json +283 -0
- package/config/rules/general/solutioninfo.json +378 -0
- package/config/rules/infrastructure/hashicorp_packers_tmpl.json +18 -0
- package/config/rules/infrastructure/hashicorp_terraform_tmpl.json +19 -0
- package/config/rules/infrastructure/microsoft_arm_tmpl.json +198 -0
- package/config/rules/networkcomms/outbound_network.json +429 -0
- package/config/rules/os/acl.json +250 -0
- package/config/rules/os/dynamic_execution.json +359 -0
- package/config/rules/os/file_io.json +468 -0
- package/config/rules/os/process.json +179 -0
- package/config/rules/os/setenv.json +270 -0
- package/config/rules/os/system_registry.json +237 -0
- package/config/rules/os/user_accts.json +34 -0
- package/config/rules/security_feature/authentication.json +387 -0
- package/config/rules/security_feature/authorization.json +148 -0
- package/config/rules/test_frameworks/cpp_testing.json +194 -0
- package/config/rules/test_frameworks/go_testing.json +18 -0
- package/config/rules/test_frameworks/java_testing.json +720 -0
- package/config/rules/test_frameworks/javascript_testing.json +724 -0
- package/config/rules/test_frameworks/objectiveC_testing.json +146 -0
- package/config/rules/test_frameworks/php_testing.json +156 -0
- package/config/rules/test_frameworks/powershell_testing.json +17 -0
- package/config/rules/test_frameworks/python_testing.json +108 -0
- package/config/rules/test_frameworks/ruby_testing.json +114 -0
- package/config/rules/tools/pipeline.json +195 -0
- package/config/rules/webapp/comms.json +89 -0
- package/config/rules/webapp/headers.json +178 -0
- package/config/rules/webapp/media.json +56 -0
- package/config/rules/webapp/sessions.json +228 -0
- package/config/rules/webapp/storage.json +215 -0
- package/dist/config/.ignore +4 -0
- package/dist/config/comments.json +71 -0
- package/dist/config/fingerprints/_anomalies-full.json +116 -0
- package/dist/config/fingerprints/_extLibs.json +2555 -0
- package/dist/config/fingerprints/code_smells.json +94 -0
- package/dist/config/fingerprints/generated_code.json +17 -0
- package/dist/config/fingerprints/libraries.json +4667 -0
- package/dist/config/ignoredImports.txt +0 -0
- package/dist/config/insider-conf.properties +3 -0
- package/dist/config/rules/cloud_services/ad_networks.json +50 -0
- package/dist/config/rules/cloud_services/bigdata.json +21 -0
- package/dist/config/rules/cloud_services/cloud_hosting.json +398 -0
- package/dist/config/rules/cloud_services/data_storage.json +291 -0
- package/dist/config/rules/cloud_services/ecommerce.json +45 -0
- package/dist/config/rules/cloud_services/socialmedia.json +82 -0
- package/dist/config/rules/cloud_services/web_analytics.json +108 -0
- package/dist/config/rules/components/active_content.json +157 -0
- package/dist/config/rules/components/load_dll.json +66 -0
- package/dist/config/rules/cryptography/algorithm_implementation.json +62 -0
- package/dist/config/rules/cryptography/certificate.json +199 -0
- package/dist/config/rules/cryptography/ciphers.json +174 -0
- package/dist/config/rules/cryptography/crypto_currency.json +32 -0
- package/dist/config/rules/cryptography/encoding.json +20 -0
- package/dist/config/rules/cryptography/extended.json +220 -0
- package/dist/config/rules/cryptography/external_libraries.json +141 -0
- package/dist/config/rules/cryptography/hash_algorithm.json +98 -0
- package/dist/config/rules/cryptography/key_derivation.json +65 -0
- package/dist/config/rules/cryptography/protocol.json +156 -0
- package/dist/config/rules/cryptography/random.json +97 -0
- package/dist/config/rules/cryptography/weakssl.json +206 -0
- package/dist/config/rules/data_handling/compressed_files.json +18 -0
- package/dist/config/rules/data_handling/database.json +361 -0
- package/dist/config/rules/data_handling/deserialization.json +296 -0
- package/dist/config/rules/data_handling/json_parsing.json +49 -0
- package/dist/config/rules/data_handling/media_parsing.json +33 -0
- package/dist/config/rules/data_handling/pastebin.json +18 -0
- package/dist/config/rules/data_handling/xml_parsing.json +168 -0
- package/dist/config/rules/data_types/financial.json +106 -0
- package/dist/config/rules/data_types/media.json +48 -0
- package/dist/config/rules/data_types/secrets.json +91 -0
- package/dist/config/rules/data_types/sensitive.json +176 -0
- package/dist/config/rules/device_permissions/IOSPermissions.json +240 -0
- package/dist/config/rules/device_permissions/UWP.json +221 -0
- package/dist/config/rules/device_permissions/android_intents.json +599 -0
- package/dist/config/rules/frameworks/PHP.json +172 -0
- package/dist/config/rules/frameworks/build.json +189 -0
- package/dist/config/rules/frameworks/c.json +45 -0
- package/dist/config/rules/frameworks/csharp-nonMS.json +19 -0
- package/dist/config/rules/frameworks/java.json +291 -0
- package/dist/config/rules/frameworks/javascript.json +318 -0
- package/dist/config/rules/frameworks/logging.json +103 -0
- package/dist/config/rules/frameworks/microsoft.json +257 -0
- package/dist/config/rules/frameworks/python.json +274 -0
- package/dist/config/rules/frameworks/ruby.json +53 -0
- package/dist/config/rules/frameworks/rust.json +77 -0
- package/dist/config/rules/general/OSS_license.json +146 -0
- package/dist/config/rules/general/code_metrics.json +132 -0
- package/dist/config/rules/general/dependencies.json +199 -0
- package/dist/config/rules/general/hygiene.json +47 -0
- package/dist/config/rules/general/platforms.json +283 -0
- package/dist/config/rules/general/solutioninfo.json +378 -0
- package/dist/config/rules/infrastructure/hashicorp_packers_tmpl.json +18 -0
- package/dist/config/rules/infrastructure/hashicorp_terraform_tmpl.json +19 -0
- package/dist/config/rules/infrastructure/microsoft_arm_tmpl.json +198 -0
- package/dist/config/rules/networkcomms/outbound_network.json +429 -0
- package/dist/config/rules/os/acl.json +250 -0
- package/dist/config/rules/os/dynamic_execution.json +359 -0
- package/dist/config/rules/os/file_io.json +468 -0
- package/dist/config/rules/os/process.json +179 -0
- package/dist/config/rules/os/setenv.json +270 -0
- package/dist/config/rules/os/system_registry.json +237 -0
- package/dist/config/rules/os/user_accts.json +34 -0
- package/dist/config/rules/security_feature/authentication.json +387 -0
- package/dist/config/rules/security_feature/authorization.json +148 -0
- package/dist/config/rules/test_frameworks/cpp_testing.json +194 -0
- package/dist/config/rules/test_frameworks/go_testing.json +18 -0
- package/dist/config/rules/test_frameworks/java_testing.json +720 -0
- package/dist/config/rules/test_frameworks/javascript_testing.json +724 -0
- package/dist/config/rules/test_frameworks/objectiveC_testing.json +146 -0
- package/dist/config/rules/test_frameworks/php_testing.json +156 -0
- package/dist/config/rules/test_frameworks/powershell_testing.json +17 -0
- package/dist/config/rules/test_frameworks/python_testing.json +108 -0
- package/dist/config/rules/test_frameworks/ruby_testing.json +114 -0
- package/dist/config/rules/tools/pipeline.json +195 -0
- package/dist/config/rules/webapp/comms.json +89 -0
- package/dist/config/rules/webapp/headers.json +178 -0
- package/dist/config/rules/webapp/media.json +56 -0
- package/dist/config/rules/webapp/sessions.json +228 -0
- package/dist/config/rules/webapp/storage.json +215 -0
- package/dist/index.js +13 -0
- package/dist/insider.jar +0 -0
- package/dist/insider.js +7 -0
- package/dist/lib.js +21 -0
- package/docs/config/config.md +3 -0
- package/docs/config/ignore.md +3 -0
- package/docs/config/languages.md +3 -0
- package/docs/index.md +58 -0
- package/dxworks-site.json +13 -0
- package/gradle.properties +0 -0
- package/gradlew +240 -0
- package/gradlew.bat +91 -0
- package/insider/README.md +89 -0
- package/insider/config/.ignore +4 -0
- package/insider/config/comments.json +71 -0
- package/insider/config/fingerprints/_anomalies-full.json +116 -0
- package/insider/config/fingerprints/_extLibs.json +2555 -0
- package/insider/config/fingerprints/code_smells.json +94 -0
- package/insider/config/fingerprints/generated_code.json +17 -0
- package/insider/config/fingerprints/libraries.json +4667 -0
- package/insider/config/ignoredImports.txt +0 -0
- package/insider/config/insider-conf.properties +3 -0
- package/insider/config/rules/cloud_services/ad_networks.json +50 -0
- package/insider/config/rules/cloud_services/bigdata.json +21 -0
- package/insider/config/rules/cloud_services/cloud_hosting.json +398 -0
- package/insider/config/rules/cloud_services/data_storage.json +291 -0
- package/insider/config/rules/cloud_services/ecommerce.json +45 -0
- package/insider/config/rules/cloud_services/socialmedia.json +82 -0
- package/insider/config/rules/cloud_services/web_analytics.json +108 -0
- package/insider/config/rules/components/active_content.json +157 -0
- package/insider/config/rules/components/load_dll.json +66 -0
- package/insider/config/rules/cryptography/algorithm_implementation.json +62 -0
- package/insider/config/rules/cryptography/certificate.json +199 -0
- package/insider/config/rules/cryptography/ciphers.json +174 -0
- package/insider/config/rules/cryptography/crypto_currency.json +32 -0
- package/insider/config/rules/cryptography/encoding.json +20 -0
- package/insider/config/rules/cryptography/extended.json +220 -0
- package/insider/config/rules/cryptography/external_libraries.json +141 -0
- package/insider/config/rules/cryptography/hash_algorithm.json +98 -0
- package/insider/config/rules/cryptography/key_derivation.json +65 -0
- package/insider/config/rules/cryptography/protocol.json +156 -0
- package/insider/config/rules/cryptography/random.json +97 -0
- package/insider/config/rules/cryptography/weakssl.json +206 -0
- package/insider/config/rules/data_handling/compressed_files.json +18 -0
- package/insider/config/rules/data_handling/database.json +361 -0
- package/insider/config/rules/data_handling/deserialization.json +296 -0
- package/insider/config/rules/data_handling/json_parsing.json +49 -0
- package/insider/config/rules/data_handling/media_parsing.json +33 -0
- package/insider/config/rules/data_handling/pastebin.json +18 -0
- package/insider/config/rules/data_handling/xml_parsing.json +168 -0
- package/insider/config/rules/data_types/financial.json +106 -0
- package/insider/config/rules/data_types/media.json +48 -0
- package/insider/config/rules/data_types/secrets.json +91 -0
- package/insider/config/rules/data_types/sensitive.json +176 -0
- package/insider/config/rules/device_permissions/IOSPermissions.json +240 -0
- package/insider/config/rules/device_permissions/UWP.json +221 -0
- package/insider/config/rules/device_permissions/android_intents.json +599 -0
- package/insider/config/rules/frameworks/PHP.json +172 -0
- package/insider/config/rules/frameworks/build.json +189 -0
- package/insider/config/rules/frameworks/c.json +45 -0
- package/insider/config/rules/frameworks/csharp-nonMS.json +19 -0
- package/insider/config/rules/frameworks/java.json +291 -0
- package/insider/config/rules/frameworks/javascript.json +318 -0
- package/insider/config/rules/frameworks/logging.json +103 -0
- package/insider/config/rules/frameworks/microsoft.json +257 -0
- package/insider/config/rules/frameworks/python.json +274 -0
- package/insider/config/rules/frameworks/ruby.json +53 -0
- package/insider/config/rules/frameworks/rust.json +77 -0
- package/insider/config/rules/general/OSS_license.json +146 -0
- package/insider/config/rules/general/code_metrics.json +132 -0
- package/insider/config/rules/general/dependencies.json +199 -0
- package/insider/config/rules/general/hygiene.json +47 -0
- package/insider/config/rules/general/platforms.json +283 -0
- package/insider/config/rules/general/solutioninfo.json +378 -0
- package/insider/config/rules/infrastructure/hashicorp_packers_tmpl.json +18 -0
- package/insider/config/rules/infrastructure/hashicorp_terraform_tmpl.json +19 -0
- package/insider/config/rules/infrastructure/microsoft_arm_tmpl.json +198 -0
- package/insider/config/rules/networkcomms/outbound_network.json +429 -0
- package/insider/config/rules/os/acl.json +250 -0
- package/insider/config/rules/os/dynamic_execution.json +359 -0
- package/insider/config/rules/os/file_io.json +468 -0
- package/insider/config/rules/os/process.json +179 -0
- package/insider/config/rules/os/setenv.json +270 -0
- package/insider/config/rules/os/system_registry.json +237 -0
- package/insider/config/rules/os/user_accts.json +34 -0
- package/insider/config/rules/security_feature/authentication.json +387 -0
- package/insider/config/rules/security_feature/authorization.json +148 -0
- package/insider/config/rules/test_frameworks/cpp_testing.json +194 -0
- package/insider/config/rules/test_frameworks/go_testing.json +18 -0
- package/insider/config/rules/test_frameworks/java_testing.json +720 -0
- package/insider/config/rules/test_frameworks/javascript_testing.json +724 -0
- package/insider/config/rules/test_frameworks/objectiveC_testing.json +146 -0
- package/insider/config/rules/test_frameworks/php_testing.json +156 -0
- package/insider/config/rules/test_frameworks/powershell_testing.json +17 -0
- package/insider/config/rules/test_frameworks/python_testing.json +108 -0
- package/insider/config/rules/test_frameworks/ruby_testing.json +114 -0
- package/insider/config/rules/tools/pipeline.json +195 -0
- package/insider/config/rules/webapp/comms.json +89 -0
- package/insider/config/rules/webapp/headers.json +178 -0
- package/insider/config/rules/webapp/media.json +56 -0
- package/insider/config/rules/webapp/sessions.json +228 -0
- package/insider/config/rules/webapp/storage.json +215 -0
- package/insider/insider.bat +1 -0
- package/insider/insider.jar +0 -0
- package/insider/insider.sh +1 -0
- package/insider/languages.yml +3988 -0
- package/instrument.yml +37 -0
- package/languages.yml +3988 -0
- package/lib/index.js +13 -0
- package/lib/insider.js +7 -0
- package/lib/lib.js +21 -0
- package/lombok.config +2 -0
- package/mkdocs.yml +18 -0
- package/package.json +51 -0
- package/releaseNotes/v2.6.0.md +1 -0
- package/releaseNotes/v2.7.1.md +1 -0
- package/settings.gradle +2 -0
- package/src/main/java/org/dxworks/insider/ChronosTag.java +14 -0
- package/src/main/java/org/dxworks/insider/Insider.java +214 -0
- package/src/main/java/org/dxworks/insider/InsiderAnalysis.java +7 -0
- package/src/main/java/org/dxworks/insider/InsiderFile.java +125 -0
- package/src/main/java/org/dxworks/insider/InsiderOptions.java +78 -0
- package/src/main/java/org/dxworks/insider/InsiderResult.java +15 -0
- package/src/main/java/org/dxworks/insider/application/inspector/CodeRuleExtractor.java +14 -0
- package/src/main/java/org/dxworks/insider/application/inspector/CommentRuleExtractor.java +14 -0
- package/src/main/java/org/dxworks/insider/application/inspector/FileRuleExtractor.java +14 -0
- package/src/main/java/org/dxworks/insider/application/inspector/RuleExtractor.java +11 -0
- package/src/main/java/org/dxworks/insider/application/inspector/dtos/Comment.java +18 -0
- package/src/main/java/org/dxworks/insider/application/inspector/dtos/CommentPattern.java +44 -0
- package/src/main/java/org/dxworks/insider/application/inspector/dtos/Condition.java +15 -0
- package/src/main/java/org/dxworks/insider/application/inspector/dtos/InsiderPattern.java +149 -0
- package/src/main/java/org/dxworks/insider/application/inspector/dtos/PatternMatch.java +23 -0
- package/src/main/java/org/dxworks/insider/application/inspector/dtos/Rule.java +61 -0
- package/src/main/java/org/dxworks/insider/application/inspector/services/CommentService.java +165 -0
- package/src/main/java/org/dxworks/insider/application/inspector/services/RuleService.java +54 -0
- package/src/main/java/org/dxworks/insider/commands/AddCommand.java +125 -0
- package/src/main/java/org/dxworks/insider/commands/AllFilesCommand.java +4 -0
- package/src/main/java/org/dxworks/insider/commands/ConvertCommand.java +55 -0
- package/src/main/java/org/dxworks/insider/commands/DetectCommand.java +42 -0
- package/src/main/java/org/dxworks/insider/commands/DiagnoseCommand.java +74 -0
- package/src/main/java/org/dxworks/insider/commands/ExtractCommand.java +35 -0
- package/src/main/java/org/dxworks/insider/commands/FindCommand.java +102 -0
- package/src/main/java/org/dxworks/insider/commands/HelpCommand.java +56 -0
- package/src/main/java/org/dxworks/insider/commands/IndentationCount.java +69 -0
- package/src/main/java/org/dxworks/insider/commands/InsiderCommand.java +71 -0
- package/src/main/java/org/dxworks/insider/commands/InspectCommand.java +98 -0
- package/src/main/java/org/dxworks/insider/commands/MeasureCommand.java +47 -0
- package/src/main/java/org/dxworks/insider/commands/NoFilesCommand.java +4 -0
- package/src/main/java/org/dxworks/insider/commands/VersionCommand.java +34 -0
- package/src/main/java/org/dxworks/insider/configuration/InsiderConfiguration.java +123 -0
- package/src/main/java/org/dxworks/insider/constants/InsiderConstants.java +19 -0
- package/src/main/java/org/dxworks/insider/depext/AbstractImportsProcessor.java +57 -0
- package/src/main/java/org/dxworks/insider/depext/CPPImportsProcessor.java +55 -0
- package/src/main/java/org/dxworks/insider/depext/CSharpImportsProcessor.java +53 -0
- package/src/main/java/org/dxworks/insider/depext/DependencyExtractor.java +105 -0
- package/src/main/java/org/dxworks/insider/depext/ImportItem.java +19 -0
- package/src/main/java/org/dxworks/insider/depext/ImportResult.java +32 -0
- package/src/main/java/org/dxworks/insider/depext/JavastackImportsProcessor.java +88 -0
- package/src/main/java/org/dxworks/insider/depext/VBImportsProcessor.java +41 -0
- package/src/main/java/org/dxworks/insider/exceptions/InsiderException.java +7 -0
- package/src/main/java/org/dxworks/insider/library/detector/C_ImportsContainer.java +73 -0
- package/src/main/java/org/dxworks/insider/library/detector/ImportsContainer.java +122 -0
- package/src/main/java/org/dxworks/insider/library/detector/JavaImportsContainer.java +63 -0
- package/src/main/java/org/dxworks/insider/library/detector/LibraryDetector.java +150 -0
- package/src/main/java/org/dxworks/insider/library/detector/LibraryDetectorLanguage.java +6 -0
- package/src/main/java/org/dxworks/insider/library/detector/model/PackagingUnit.java +26 -0
- package/src/main/java/org/dxworks/insider/technology/finder/LinguistService.java +79 -0
- package/src/main/java/org/dxworks/insider/technology/finder/converters/XmlToJsonConverter.java +41 -0
- package/src/main/java/org/dxworks/insider/technology/finder/exceptions/FingerprintParseException.java +7 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/Technology.java +73 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/json/JsonConfigurationDTO.java +14 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/json/TechnologyJsonDTO.java +66 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/xml/old/CategoryXmlDTO.java +21 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/xml/old/ConfigurationDataXmlDTO.java +17 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/xml/old/FingerprintXmlDTO.java +17 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/xml/old/LanguageXmlDTO.java +20 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/xml/old/LanguagesXmlDTO.java +18 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/xml/old/TechnologyXmlDTO.java +19 -0
- package/src/main/java/org/dxworks/insider/technology/finder/model/xml/old/XmlConfigurationDTO.java +17 -0
- package/src/main/java/org/dxworks/insider/technology/finder/parsers/FingerprintsParser.java +14 -0
- package/src/main/java/org/dxworks/insider/technology/finder/parsers/FingerprintsXmlParser.java +57 -0
- package/src/main/java/org/dxworks/insider/technology/finder/parsers/JavaLibrariesCsvParser.java +71 -0
- package/src/main/java/org/dxworks/insider/technology/finder/parsers/JsonFingerprintParser.java +58 -0
- package/src/main/java/org/dxworks/insider/utils/FileUtils.java +45 -0
- package/src/main/java/org/dxworks/insider/utils/ImportUtils.java +21 -0
- package/src/main/java/org/dxworks/insider/utils/LibraryImport.java +17 -0
- package/src/main/java/org/dxworks/insider/utils/LibraryImportInOtherTechnology.java +30 -0
- package/src/main/java/org/dxworks/insider/utils/MapUtils.java +19 -0
- package/src/main/resources/insider-version +1 -0
- package/src/test/java/org/dxworks/insider/application/inspector/services/CommentServiceTest.java +40 -0
- package/src/test/java/org/dxworks/insider/technology/finder/parsers/FingerprintsXmlParserTest.java +15 -0
- package/src/test/java/org/dxworks/insider/utils/FileUtilsTest.java +31 -0
- package/src/test/java/org/dxworks/insider/utils/ImportUtilsTest.java +24 -0
- package/src/test/java/org/dxworks/insider/utils/transformers/JsonToCsvTransformerTest.java +18 -0
- package/src/test/resources/Test1.java +21 -0
- package/src/test/resources/Test2.java +21 -0
- package/src/test/resources/cobol/CM201M.CBL +88 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const {insider} = require("./lib");
|
|
2
|
+
const {Command} = require("commander");
|
|
3
|
+
|
|
4
|
+
exports.insiderCommand = new Command()
|
|
5
|
+
.name('insider')
|
|
6
|
+
.description('Running Insider commands')
|
|
7
|
+
.option('-wd --working-directory', 'Selects the directory where Insider will store the results folder.' +
|
|
8
|
+
` Defaults to the location where Insider is installed: ${__dirname}. If set to true it will use the current working directory process.cwd()`,
|
|
9
|
+
false)
|
|
10
|
+
.allowUnknownOption()
|
|
11
|
+
.action(insider)
|
|
12
|
+
|
|
13
|
+
|
package/lib/insider.js
ADDED
package/lib/lib.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const {JavaCaller} = require('java-caller');
|
|
2
|
+
|
|
3
|
+
async function insider(options) {
|
|
4
|
+
const java = new JavaCaller({
|
|
5
|
+
jar: 'insider.jar', // CLASSPATH referencing the package embedded jar files
|
|
6
|
+
mainClass: 'org.dxworks.insider.Insider',// Main class to call, must be available from CLASSPATH,
|
|
7
|
+
rootPath: __dirname,
|
|
8
|
+
minimumJavaVersion: 11,
|
|
9
|
+
output: 'console'
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const args = [...process.argv];
|
|
13
|
+
let index = args.indexOf('insider'); //if it is called from dxw cli
|
|
14
|
+
if(index === -1)
|
|
15
|
+
index = 1
|
|
16
|
+
args.splice(0, index + 1);
|
|
17
|
+
const {status} = await java.run(args, {cwd: options?.workingDirectory? process.cwd(): __dirname});
|
|
18
|
+
process.exitCode = status;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = {insider}
|
package/lombok.config
ADDED
package/mkdocs.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
site_name: Dxworks Insider
|
|
2
|
+
|
|
3
|
+
theme:
|
|
4
|
+
name: material
|
|
5
|
+
|
|
6
|
+
nav:
|
|
7
|
+
- Home: 'index.md'
|
|
8
|
+
- 'Installation': 'queryLanguage.md'
|
|
9
|
+
- 'Configuration':
|
|
10
|
+
- 'config/config.md'
|
|
11
|
+
- 'Languages': 'config/languages.md'
|
|
12
|
+
- 'Ignore Files': 'config/ignore.md'
|
|
13
|
+
- 'Fingerprints': 'config/fingerprints.md'
|
|
14
|
+
- 'Insider Config': 'config/insider.md'
|
|
15
|
+
- 'Commands':
|
|
16
|
+
- 'Detect': 'commands/detect.md'
|
|
17
|
+
- 'Find': 'commands/find.md'
|
|
18
|
+
- 'Inspect': 'commands/inspect.md'
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dxworks/insider",
|
|
3
|
+
"version": "2.9.1",
|
|
4
|
+
"description": "Insider is a belt of tools built on the idea of searching regular expressions in code",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"insider",
|
|
7
|
+
"java",
|
|
8
|
+
"regex"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/dxworks/insider#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/dxworks/insider/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/dxworks/insider.git"
|
|
17
|
+
},
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"author": "Mario Rivis",
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"bin": {
|
|
22
|
+
"insider": "dist/insider.js"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "npm run clean && mkdir dist && cp lib/*.js dist && cp build/libs/insider*.jar dist/insider.jar && npm run copy-assets",
|
|
26
|
+
"copy-assets": "cp -R config dist/config",
|
|
27
|
+
"clean": "rimraf dist/",
|
|
28
|
+
"local": "npm run build && npm i"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"commander": "11.1.0",
|
|
32
|
+
"java-caller": "^2.7.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"json": "^11.0.0",
|
|
36
|
+
"rimraf": "^3.0.2",
|
|
37
|
+
"sort-package-json": "^1.52.0"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"registry": "https://npm.pkg.github.com"
|
|
42
|
+
},
|
|
43
|
+
"dxw": {
|
|
44
|
+
"commands": [
|
|
45
|
+
{
|
|
46
|
+
"file": "dist/index.js",
|
|
47
|
+
"command": "insiderCommand"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* added npm module
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Fixed null modifiers rule issue.
|
package/settings.gradle
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package org.dxworks.insider;
|
|
2
|
+
|
|
3
|
+
import lombok.AllArgsConstructor;
|
|
4
|
+
import lombok.Builder;
|
|
5
|
+
import lombok.Data;
|
|
6
|
+
|
|
7
|
+
@Data
|
|
8
|
+
@Builder
|
|
9
|
+
@AllArgsConstructor
|
|
10
|
+
public class ChronosTag {
|
|
11
|
+
private String entity;
|
|
12
|
+
private String tag;
|
|
13
|
+
private Integer strength;
|
|
14
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
package org.dxworks.insider;
|
|
2
|
+
|
|
3
|
+
import lombok.extern.slf4j.Slf4j;
|
|
4
|
+
import me.tongfei.progressbar.ProgressBar;
|
|
5
|
+
import me.tongfei.progressbar.ProgressBarStyle;
|
|
6
|
+
import org.apache.commons.collections4.CollectionUtils;
|
|
7
|
+
import org.apache.commons.io.FilenameUtils;
|
|
8
|
+
import org.dxworks.ignorerLibrary.Ignorer;
|
|
9
|
+
import org.dxworks.ignorerLibrary.IgnorerBuilder;
|
|
10
|
+
import org.dxworks.insider.commands.*;
|
|
11
|
+
import org.dxworks.insider.configuration.InsiderConfiguration;
|
|
12
|
+
import org.dxworks.insider.technology.finder.LinguistService;
|
|
13
|
+
|
|
14
|
+
import java.io.File;
|
|
15
|
+
import java.io.IOException;
|
|
16
|
+
import java.nio.file.Files;
|
|
17
|
+
import java.nio.file.Path;
|
|
18
|
+
import java.nio.file.Paths;
|
|
19
|
+
import java.util.ArrayList;
|
|
20
|
+
import java.util.LinkedHashMap;
|
|
21
|
+
import java.util.List;
|
|
22
|
+
import java.util.Map;
|
|
23
|
+
import java.util.concurrent.atomic.AtomicInteger;
|
|
24
|
+
import java.util.function.Function;
|
|
25
|
+
import java.util.stream.Collectors;
|
|
26
|
+
|
|
27
|
+
import static org.dxworks.insider.constants.InsiderConstants.CONFIGURATION_FOLDER;
|
|
28
|
+
import static org.dxworks.insider.constants.InsiderConstants.RESULTS_FOLDER;
|
|
29
|
+
|
|
30
|
+
@Slf4j
|
|
31
|
+
public class Insider {
|
|
32
|
+
|
|
33
|
+
private static HelpCommand helpCommand = new HelpCommand();
|
|
34
|
+
private static VersionCommand versionCommand = new VersionCommand();
|
|
35
|
+
|
|
36
|
+
public static void main(String[] args) {
|
|
37
|
+
|
|
38
|
+
if (args == null) {
|
|
39
|
+
System.err.println("Arguments cannot be null");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
List<String> argsList = List.of(args);
|
|
44
|
+
InsiderConfiguration.getInstance().readInsiderVersion();
|
|
45
|
+
|
|
46
|
+
if (args.length == 0) {
|
|
47
|
+
System.err.println("No command found");
|
|
48
|
+
helpCommand.execute(null, argsList);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (versionCommand.parse(argsList)) {
|
|
53
|
+
versionCommand.execute(null, argsList);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (helpCommand.parse(argsList)) {
|
|
58
|
+
helpCommand.execute(null, argsList);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
List<List<String>> commands = extractCommands(args).stream()
|
|
63
|
+
.filter(it -> !it.isEmpty())
|
|
64
|
+
.collect(Collectors.toList());
|
|
65
|
+
|
|
66
|
+
Map<List<String>, InsiderCommand> allCommandsConfig = commands.stream()
|
|
67
|
+
.filter(it -> getInsiderCommand(it) != null)
|
|
68
|
+
.collect(Collectors.toMap(Function.identity(), Insider::getInsiderCommand, (a, b) -> b, LinkedHashMap::new));
|
|
69
|
+
|
|
70
|
+
readInsiderConfiguration();
|
|
71
|
+
List<InsiderFile> insiderFiles = allCommandsConfig.values()
|
|
72
|
+
.stream()
|
|
73
|
+
.allMatch(it -> it instanceof NoFilesCommand)
|
|
74
|
+
? new ArrayList<>()
|
|
75
|
+
: getInsiderFiles(allCommandsConfig);
|
|
76
|
+
|
|
77
|
+
AtomicInteger index = new AtomicInteger(1);
|
|
78
|
+
int commandsSize = allCommandsConfig.size();
|
|
79
|
+
allCommandsConfig.forEach((commandArgs, insiderCommand) -> {
|
|
80
|
+
System.out.printf("*******************\nCommand %s (%d/%d) \n*******************\n", insiderCommand.getName(), index.getAndIncrement(), commandsSize);
|
|
81
|
+
|
|
82
|
+
boolean isValidInput = insiderCommand.parse(commandArgs);
|
|
83
|
+
if (!isValidInput) {
|
|
84
|
+
log.error("Input is not valid!");
|
|
85
|
+
helpCommand.execute(null, commandArgs);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
List<InsiderFile> acceptedFiles =
|
|
90
|
+
insiderFiles.stream().filter(it -> hasAcceptedExtension(it.getPath())).collect(Collectors.toList());
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
if (insiderCommand instanceof NoFilesCommand) {
|
|
94
|
+
insiderCommand.execute(null, commandArgs);
|
|
95
|
+
} else if (insiderCommand instanceof AllFilesCommand) {
|
|
96
|
+
insiderCommand.execute(insiderFiles, commandArgs);
|
|
97
|
+
} else {
|
|
98
|
+
insiderCommand.execute(acceptedFiles, commandArgs);
|
|
99
|
+
}
|
|
100
|
+
} catch (Exception e) {
|
|
101
|
+
System.out.println("Command " + insiderCommand.getName() + "finished with errors");
|
|
102
|
+
e.printStackTrace();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
System.out.println("Insider " + InsiderConfiguration.getInstance().getInsiderVersion() + " finished analysis");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private static List<List<String>> extractCommands(String[] args) {
|
|
110
|
+
List<List<String>> commands = new ArrayList<>();
|
|
111
|
+
List<String> currentCommand = new ArrayList<>();
|
|
112
|
+
for (String arg : args) {
|
|
113
|
+
if ("AND".equals(arg)) {
|
|
114
|
+
commands.add(currentCommand);
|
|
115
|
+
currentCommand = new ArrayList<>();
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
currentCommand.add(arg);
|
|
119
|
+
}
|
|
120
|
+
commands.add(currentCommand);
|
|
121
|
+
|
|
122
|
+
return commands;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private static InsiderCommand getInsiderCommand(List<String> commandArgs) {
|
|
126
|
+
if (CollectionUtils.isEmpty(commandArgs))
|
|
127
|
+
return null;
|
|
128
|
+
switch (commandArgs.get(0)) {
|
|
129
|
+
case InsiderCommand.FIND:
|
|
130
|
+
return new FindCommand();
|
|
131
|
+
case InsiderCommand.DETECT:
|
|
132
|
+
return new DetectCommand();
|
|
133
|
+
case InsiderCommand.ADD:
|
|
134
|
+
return new AddCommand();
|
|
135
|
+
case InsiderCommand.DIAGNOSE:
|
|
136
|
+
return new DiagnoseCommand();
|
|
137
|
+
case InsiderCommand.CONVERT:
|
|
138
|
+
return new ConvertCommand();
|
|
139
|
+
case InsiderCommand.INSPECT:
|
|
140
|
+
return new InspectCommand();
|
|
141
|
+
case InsiderCommand.EXTRACT:
|
|
142
|
+
return new ExtractCommand();
|
|
143
|
+
case InsiderCommand.INDENT:
|
|
144
|
+
return new IndentationCount();
|
|
145
|
+
case InsiderCommand.MEASURE:
|
|
146
|
+
return new MeasureCommand();
|
|
147
|
+
default:
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private static void readInsiderConfiguration() {
|
|
153
|
+
File resultsFolder = new File(RESULTS_FOLDER);
|
|
154
|
+
if (!resultsFolder.exists())
|
|
155
|
+
resultsFolder.mkdirs();
|
|
156
|
+
|
|
157
|
+
InsiderConfiguration.getInstance().load();
|
|
158
|
+
reportUnknownExtensions();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private static List<InsiderFile> getInsiderFiles(Map<List<String>, InsiderCommand> insiderCommand) {
|
|
162
|
+
Ignorer ignorer = new IgnorerBuilder(Paths.get(CONFIGURATION_FOLDER, ".ignore")).compile();
|
|
163
|
+
|
|
164
|
+
if (!insiderCommand.values().stream().allMatch(it -> it instanceof NoFilesCommand))
|
|
165
|
+
return readProjectFiles(InsiderConfiguration.getInstance().getRootFolder(), ignorer);
|
|
166
|
+
else return new ArrayList<>();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private static void reportUnknownExtensions() {
|
|
170
|
+
List<String> requiredLanguages = InsiderConfiguration.getInstance().getLanguages();
|
|
171
|
+
requiredLanguages.stream()
|
|
172
|
+
.filter(lang -> !LinguistService.getInstance().containsLanguage(lang))
|
|
173
|
+
.forEach(lang -> System.out.println("Unknown language " + lang));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private static List<InsiderFile> readProjectFiles(String rootFolder, Ignorer ignorer) {
|
|
177
|
+
List<InsiderFile> insiderFiles = new ArrayList<>();
|
|
178
|
+
try {
|
|
179
|
+
List<Path> pathList = Files.walk(Paths.get(rootFolder))
|
|
180
|
+
.filter(Files::isRegularFile)
|
|
181
|
+
.filter(ignorer::accepts)
|
|
182
|
+
.collect(Collectors.toList());
|
|
183
|
+
try (ProgressBar pb = new ProgressBar("Reading files", pathList.size(), ProgressBarStyle.ASCII)) {
|
|
184
|
+
for (Path path : pathList) {
|
|
185
|
+
pb.step();
|
|
186
|
+
try {
|
|
187
|
+
insiderFiles.add(InsiderFile.builder()
|
|
188
|
+
.path(path.toAbsolutePath().toString())
|
|
189
|
+
.name(path.getFileName().toString())
|
|
190
|
+
.extension(FilenameUtils.getExtension(path.getFileName().toString()))
|
|
191
|
+
.content(new String(Files.readAllBytes(path)))
|
|
192
|
+
.size(Files.size(path))
|
|
193
|
+
.build());
|
|
194
|
+
} catch (IOException e) {
|
|
195
|
+
e.printStackTrace();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
} catch (IOException e) {
|
|
200
|
+
e.printStackTrace();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return insiderFiles;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
private static boolean hasAcceptedExtension(String filePath) {
|
|
207
|
+
LinguistService linguistService = LinguistService.getInstance();
|
|
208
|
+
if (InsiderConfiguration.getInstance().getLanguages().isEmpty()) {
|
|
209
|
+
return linguistService.hasAcceptedExtension(filePath, linguistService.getProgrammingLanguages());
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return linguistService.hasAcceptedExtension(filePath);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
package org.dxworks.insider;
|
|
2
|
+
|
|
3
|
+
import lombok.Data;
|
|
4
|
+
import lombok.RequiredArgsConstructor;
|
|
5
|
+
import org.dxworks.insider.configuration.InsiderConfiguration;
|
|
6
|
+
|
|
7
|
+
import java.nio.file.Path;
|
|
8
|
+
import java.util.ArrayList;
|
|
9
|
+
import java.util.List;
|
|
10
|
+
|
|
11
|
+
@RequiredArgsConstructor
|
|
12
|
+
@Data
|
|
13
|
+
public class InsiderFile {
|
|
14
|
+
|
|
15
|
+
private final String name;
|
|
16
|
+
private final String path;
|
|
17
|
+
private final String extension;
|
|
18
|
+
|
|
19
|
+
private final String content;
|
|
20
|
+
|
|
21
|
+
private List<Integer> lineBreaks;
|
|
22
|
+
|
|
23
|
+
private int lines;
|
|
24
|
+
private final long size;
|
|
25
|
+
|
|
26
|
+
private String fullyQualifiedName;
|
|
27
|
+
|
|
28
|
+
public static InsiderFileBuilder builder() {
|
|
29
|
+
return new InsiderFileBuilder();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public String getLine(Integer index) {
|
|
33
|
+
if (index == lines - 1)
|
|
34
|
+
return (content.substring(lineBreaks.get(index) + 1));
|
|
35
|
+
return content.substring(lineBreaks.get(index) + 1, lineBreaks.get(index + 1) + 1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private void extractLineBreaks(String content) {
|
|
39
|
+
lineBreaks = new ArrayList<>();
|
|
40
|
+
lineBreaks.add(-1);
|
|
41
|
+
for (int i = 0; i < content.length(); i++) {
|
|
42
|
+
if (content.charAt(i) == '\n') {
|
|
43
|
+
lineBreaks.add(i);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public String getFullyQualifiedName() {
|
|
49
|
+
if (fullyQualifiedName == null)
|
|
50
|
+
fullyQualifiedName = Path.of(InsiderConfiguration.getInstance().getRootFolder()).toAbsolutePath()
|
|
51
|
+
.relativize(Path.of(getPath()).toAbsolutePath())
|
|
52
|
+
.normalize().toString().replace("\\", "/");
|
|
53
|
+
return fullyQualifiedName;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public int getLineNumberOfAbsoluteCharacterIndex(int index) {
|
|
57
|
+
for (int i = 0; i < lineBreaks.size(); i++) {
|
|
58
|
+
if (index <= lineBreaks.get(i))
|
|
59
|
+
return i;
|
|
60
|
+
}
|
|
61
|
+
return lineBreaks.size();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public int getLineIndexFromFileIndex(int fileIndex) {
|
|
65
|
+
return fileIndex - lineBreaks.get(getLineNumberOfAbsoluteCharacterIndex(fileIndex) - 1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public static class InsiderFileBuilder {
|
|
69
|
+
private String name;
|
|
70
|
+
private String path;
|
|
71
|
+
private String extension;
|
|
72
|
+
private String content;
|
|
73
|
+
private long size;
|
|
74
|
+
|
|
75
|
+
InsiderFileBuilder() {
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public InsiderFileBuilder name(String name) {
|
|
79
|
+
this.name = name;
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public InsiderFileBuilder path(String path) {
|
|
84
|
+
this.path = path;
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public InsiderFileBuilder extension(String extension) {
|
|
89
|
+
this.extension = extension;
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public InsiderFileBuilder content(String content) {
|
|
94
|
+
this.content = content;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public InsiderFileBuilder size(long size) {
|
|
99
|
+
this.size = size;
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public InsiderFile build() {
|
|
104
|
+
InsiderFile insiderFile = new InsiderFile(name, path, extension, content, size);
|
|
105
|
+
insiderFile.init();
|
|
106
|
+
return insiderFile;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Override
|
|
110
|
+
public String toString() {
|
|
111
|
+
return "InsiderFileBuilder{" +
|
|
112
|
+
"name='" + name + '\'' +
|
|
113
|
+
", path='" + path + '\'' +
|
|
114
|
+
", extension='" + extension + '\'' +
|
|
115
|
+
", content='" + content + '\'' +
|
|
116
|
+
", size=" + size +
|
|
117
|
+
'}';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private void init() {
|
|
122
|
+
extractLineBreaks(content);
|
|
123
|
+
lines = lineBreaks.size();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
package org.dxworks.insider;
|
|
2
|
+
|
|
3
|
+
import java.io.File;
|
|
4
|
+
|
|
5
|
+
import static picocli.CommandLine.*;
|
|
6
|
+
|
|
7
|
+
@Command(name = "insider")
|
|
8
|
+
public class InsiderOptions {
|
|
9
|
+
|
|
10
|
+
@ArgGroup
|
|
11
|
+
InsiderCommands insiderCommands;
|
|
12
|
+
|
|
13
|
+
// @formatter:off
|
|
14
|
+
static class TechnologyFinderOptions {
|
|
15
|
+
@Option(names = {"find", "--find-technologies"},
|
|
16
|
+
description = {"TechnologyFinder is an analysis that find regular expressions",
|
|
17
|
+
"( that should be provided in a configuration file )",
|
|
18
|
+
"in your project files."},
|
|
19
|
+
paramLabel = "technology-finder")
|
|
20
|
+
boolean technologyFinderFile;
|
|
21
|
+
|
|
22
|
+
@Parameters(description = "FingerPrint Files to analyze")
|
|
23
|
+
File[] fingerPrintFiles;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static class AddOptions {
|
|
27
|
+
@Option(names = {"add", "--add-imports"},
|
|
28
|
+
description = "The path to the imports CSV file you want to clean.",
|
|
29
|
+
paramLabel = "imports_file")
|
|
30
|
+
boolean add;
|
|
31
|
+
|
|
32
|
+
@Parameters(hidden = true)
|
|
33
|
+
File[] files;
|
|
34
|
+
|
|
35
|
+
@Parameters(index = "0", description = "The csv file from where add libraries")
|
|
36
|
+
File csvFile;
|
|
37
|
+
|
|
38
|
+
@Parameters(index = "1", description = "The json file to add libraries to")
|
|
39
|
+
File jsonFile;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static class DiagnoseOptions {
|
|
43
|
+
@Option(names = {"diagnose", "-diag", "--diagnose-imports-file"})
|
|
44
|
+
boolean diagnoseFile;
|
|
45
|
+
|
|
46
|
+
@Parameters(description = "The path to the imports JSON file you want to diagnose.")
|
|
47
|
+
File jsonFile;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static class LibraryDetectorOptions {
|
|
51
|
+
|
|
52
|
+
@Option(names = {"detect", "--detect-libraries"},
|
|
53
|
+
description = {"Library Detector is a regex based analysis that finds all import statements",
|
|
54
|
+
"in Java or C-based projects (C, Objective C, C++). It also aggregates the results",
|
|
55
|
+
"on packages (for Java), or on libraries (through a header to library mapping file for C-based)",
|
|
56
|
+
"For now, only Java detection is implemented"},
|
|
57
|
+
paramLabel = "library-discovery")
|
|
58
|
+
boolean libraryDiscovery;
|
|
59
|
+
|
|
60
|
+
@Parameters(description = "Path to ignored Imports file")
|
|
61
|
+
File ignoredImports;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static class InsiderCommands {
|
|
65
|
+
@ArgGroup(exclusive = false)
|
|
66
|
+
TechnologyFinderOptions technologyFinderOptions;
|
|
67
|
+
|
|
68
|
+
@ArgGroup(exclusive = false)
|
|
69
|
+
LibraryDetectorOptions libraryDetectorOptions;
|
|
70
|
+
|
|
71
|
+
@ArgGroup(exclusive = false)
|
|
72
|
+
AddOptions addOptions;
|
|
73
|
+
|
|
74
|
+
@ArgGroup(exclusive = false)
|
|
75
|
+
DiagnoseOptions diagnoseOptions;
|
|
76
|
+
}
|
|
77
|
+
// @formatter:on
|
|
78
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package org.dxworks.insider;
|
|
2
|
+
|
|
3
|
+
import lombok.AllArgsConstructor;
|
|
4
|
+
import lombok.Builder;
|
|
5
|
+
import lombok.Data;
|
|
6
|
+
|
|
7
|
+
@Data
|
|
8
|
+
@Builder
|
|
9
|
+
@AllArgsConstructor
|
|
10
|
+
public class InsiderResult {
|
|
11
|
+
private String name;
|
|
12
|
+
private String category;
|
|
13
|
+
private String file;
|
|
14
|
+
private Integer value;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package org.dxworks.insider.application.inspector;
|
|
2
|
+
|
|
3
|
+
import org.dxworks.insider.InsiderFile;
|
|
4
|
+
import org.dxworks.insider.application.inspector.dtos.PatternMatch;
|
|
5
|
+
import org.dxworks.insider.application.inspector.dtos.Rule;
|
|
6
|
+
|
|
7
|
+
import java.util.List;
|
|
8
|
+
|
|
9
|
+
public class CodeRuleExtractor implements RuleExtractor {
|
|
10
|
+
@Override
|
|
11
|
+
public List<PatternMatch> extract(InsiderFile insiderFile, Rule rule) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package org.dxworks.insider.application.inspector;
|
|
2
|
+
|
|
3
|
+
import org.dxworks.insider.InsiderFile;
|
|
4
|
+
import org.dxworks.insider.application.inspector.dtos.PatternMatch;
|
|
5
|
+
import org.dxworks.insider.application.inspector.dtos.Rule;
|
|
6
|
+
|
|
7
|
+
import java.util.List;
|
|
8
|
+
|
|
9
|
+
public class CommentRuleExtractor implements RuleExtractor {
|
|
10
|
+
@Override
|
|
11
|
+
public List<PatternMatch> extract(InsiderFile insiderFile, Rule rule) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package org.dxworks.insider.application.inspector;
|
|
2
|
+
|
|
3
|
+
import org.dxworks.insider.InsiderFile;
|
|
4
|
+
import org.dxworks.insider.application.inspector.dtos.PatternMatch;
|
|
5
|
+
import org.dxworks.insider.application.inspector.dtos.Rule;
|
|
6
|
+
|
|
7
|
+
import java.util.List;
|
|
8
|
+
|
|
9
|
+
public class FileRuleExtractor implements RuleExtractor {
|
|
10
|
+
@Override
|
|
11
|
+
public List<PatternMatch> extract(InsiderFile insiderFile, Rule rule) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package org.dxworks.insider.application.inspector;
|
|
2
|
+
|
|
3
|
+
import org.dxworks.insider.InsiderFile;
|
|
4
|
+
import org.dxworks.insider.application.inspector.dtos.PatternMatch;
|
|
5
|
+
import org.dxworks.insider.application.inspector.dtos.Rule;
|
|
6
|
+
|
|
7
|
+
import java.util.List;
|
|
8
|
+
|
|
9
|
+
public interface RuleExtractor {
|
|
10
|
+
List<PatternMatch> extract(InsiderFile insiderFile, Rule rule);
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package org.dxworks.insider.application.inspector.dtos;
|
|
2
|
+
|
|
3
|
+
import lombok.AllArgsConstructor;
|
|
4
|
+
import lombok.Data;
|
|
5
|
+
import lombok.NoArgsConstructor;
|
|
6
|
+
|
|
7
|
+
import java.util.List;
|
|
8
|
+
|
|
9
|
+
@Data
|
|
10
|
+
@NoArgsConstructor
|
|
11
|
+
@AllArgsConstructor
|
|
12
|
+
public class Comment {
|
|
13
|
+
private List<String> languages;
|
|
14
|
+
private String inline;
|
|
15
|
+
private String preffix;
|
|
16
|
+
private String suffix;
|
|
17
|
+
private List<CommentPattern> inlinePatterns;
|
|
18
|
+
}
|