{"id":15710491,"url":"https://github.com/aws/codelyzer","last_synced_at":"2025-10-20T04:30:17.900Z","repository":{"id":37793119,"uuid":"294775872","full_name":"aws/codelyzer","owner":"aws","description":"Codelyzer is a framework that provides interfaces to build and analyze source code in various languages and generates a platform-independent representation as a universal abstract syntax tree (UAST) model or a JSON file.","archived":false,"fork":false,"pushed_at":"2024-03-20T00:03:24.000Z","size":32410,"stargazers_count":66,"open_issues_count":20,"forks_count":15,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-01-28T19:48:30.435Z","etag":null,"topics":["analyzer","antlr4","code","roslyn","source-code"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aws.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-09-11T18:15:19.000Z","updated_at":"2024-12-07T14:36:40.000Z","dependencies_parsed_at":"2023-12-15T21:57:48.996Z","dependency_job_id":"a3727bc9-dd2d-470c-9a26-3f2cdeabfece","html_url":"https://github.com/aws/codelyzer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Fcodelyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Fcodelyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Fcodelyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws%2Fcodelyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aws","download_url":"https://codeload.github.com/aws/codelyzer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237261497,"owners_count":19281243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analyzer","antlr4","code","roslyn","source-code"],"created_at":"2024-10-03T21:08:13.609Z","updated_at":"2025-10-20T04:30:16.678Z","avatar_url":"https://github.com/aws.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codelyzer\n![Build Test](https://github.com/aws/codelyzer/workflows/Build%20Test/badge.svg)\n\nCodelyzer is a framework that provides interfaces to build and analyze source code in various languages and generates a platform-independent representation as a universal abstract syntax tree (UAST) model or a JSON file. It offers fine-grained controls to specify the kind of metadata (properties of classes, methods, etc.) to gather and how deep in the hierarchy of the code to search while generating these artifacts. Currently, the framework only supports the C# language.\n\nBy generating the output as a JSON file, this framework allows you to develop analysis tools in any language.\n\n## Codelyzer - Net\n\nCodelyzer-Net is an analyzer engine for languages based on the Roslyn compiler platform, like C# and VB. The CSharpRoslynProcessor walks an AST to collect metadata of source file components (e.g. solution, projects, namespaces, classes, methods, method invocations, literal expressions, etc). It uses semantic information from a design-time build to collect properties with fully qualified names.\n\n1. Add the Codelyzer NuGet package source into your Nuget configuration. \n   * [https://s3-us-west-2.amazonaws.com/aws.portingassistant.dotnet.download/nuget/index.json](https://s3-us-west-2.amazonaws.com/aws.portingassistant.dotnet.download/nuget/index.json)\n2. Add Codelyzer.Analysis to your project as a Nuget Package.\n\n## Getting Started\n\nFollow the example below to see how the library can be integrated into your application for analyzing .NET application.\n\n```csharp\n/* 1. Create logger object */\nvar loggerFactory = LoggerFactory.Create(builder =\u003e \n        builder.SetMinimumLevel(LogLevel.Debug).AddConsole());\nvar logger = loggerFactory.CreateLogger(\"Analyzer\");\nvar outputPath = @\"/home/users/steve/porting-analysis\";\n\n/* 2. Create Configuration settings */\nvar configuration = new AnalyzerConfiguration(LanguageOptions.CSharp);\nconfiguration.ExportSettings.OutputPath = outputPath;\n\n/* 3. Get Analyzer instance based on language */\nvar analyzer = CodeAnalyzerFactory.GetAnalyzer(configuration, logger);\n\n/* 4. Analyze the project or solution */\nvar projectFilePath = @\"/home/users/steve/projects/TestProject.csproj\";\nvar analyzerResult = await analyzer.AnalyzeProject(projectFilePath);\n\nConsole.WriteLine(\"The results are exported to file : \" + analyzerResult.OutputJsonFilePath);\n\n/* 5. Consume the results as model objects */\nvar sourcefile = analyzerResult.ProjectResult.SourceFileResults.First();\nforeach (var invocation in sourcefile.AllInvocationExpressions())\n{\n    Console.WriteLine(invocation.MethodName + \":\" + invocation.SemanticMethodSignature);\n}\n\nvar objectCreations = sourcefile.AllObjectCreationExpressions();\nvar allClasses = sourcefile.AllClasses();\nvar allMethods = sourcefile.AllMethods();\nvar allLiterals = sourcefile.AllLiterals();\n```\n\n## How to use this code?\n* Clone the Git repository.\n* Load the solution `Codelyzer.sln` using Visual Studio or Rider. \n* Create a \"Run/Debug\" Configuration for the \"Codelyzer.Analysis\" project.\n* Provide command line arguments for a solution and output path, then run the application.\n\n## Getting Help\n\nPlease use these community resources for getting help. We use the GitHub issues\nfor tracking bugs and feature requests.\n\n* Send us an email to: aws-porting-assistant-support@amazon.com\n* If it turns out that you may have found a bug,\n  please open an [issue](https://github.com/aws/codelyzer/issues/new)\n  \n## Contributing\n\nWe welcome community contributions and pull requests. See\n[CONTRIBUTING](./CONTRIBUTING.md) for information on how to set up a development\nenvironment and submit code.\n\n## Thank you\n* [The .NET Compiler Platform (\"Roslyn\")](https://github.com/dotnet/roslyn) - Roslyn provides open-source C# and Visual Basic compilers with rich code analysis APIs.   \n* [Buildalyzer](https://github.com/daveaglick/Buildalyzer) - Buildalyzer lets you run MSBuild from your own code and returns information about the project.  \n* [THIRD-PARTY](./THIRD-PARTY) - This project would not be possible without additional dependencies listed in [THIRD-PARTY](./THIRD-PARTY).\n  \n# License\n\nLibraries in this repository are licensed under the Apache 2.0 License.\n\nSee [LICENSE](./LICENSE) and [NOTICE](./NOTICE) for more information.    \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws%2Fcodelyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faws%2Fcodelyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws%2Fcodelyzer/lists"}