https://github.com/angularsen/codequery
Experimenting with Roslyn to analyze and query code, until ReSharper or Rider/Visual Studio gets native support for something like this.
https://github.com/angularsen/codequery
Last synced: 4 months ago
JSON representation
Experimenting with Roslyn to analyze and query code, until ReSharper or Rider/Visual Studio gets native support for something like this.
- Host: GitHub
- URL: https://github.com/angularsen/codequery
- Owner: angularsen
- License: mit
- Created: 2020-01-03T14:05:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-03T15:13:50.000Z (almost 6 years ago)
- Last Synced: 2025-02-28T21:44:14.110Z (10 months ago)
- Language: C#
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeQuery
Experimenting with Roslyn to analyze and query code, until ReSharper or Rider/Visual Studio gets native support for something like this.
### Examples
```
$ dotnet run
Supported commands:
methods solution-or-project-or-source-file [--projects regex] [--namespaces regex] [--method-param-type regex]
Examples:
---
Query all methods with a parameter of type System.DateTime -or- System.DateTime?
CodeQuery.exe methods "C:/dev/CodeQuery/CodeQuery.sln" --projects "^(CodeQuery)$" --method-param-type "System.DateTime\??"
```
#### Find all methods with a parameter of type `System.DateTime` or the nullable `System.DateTime?`
Note that `Nullable` and `T?` is handled as if the same.
```cmd
dotnet run -- methods ../CodeQuery.sln --method-param-type "System.DateTime\??"
```
Output
```
File: C:/dev/CodeQuery/CodeQuery.sln
Projects: (all)
Namespaces: (all)
Method param type: System.DateTime\??
00:00:01.1675201 001 CodeQuery.SampleClass.NormalDateTime(System.DateTime)
00:00:01.2013137 002 CodeQuery.SampleClass.NullableDateTime1(System.DateTime?)
00:00:01.2120629 003 CodeQuery.SampleClass.NullableDateTime2(System.DateTime?)
```