4 ms·
It's an absolute massive codebase, but the compilers and analyzers in Roslyn[0] are very clearly written. For a random example, here is the analyzer finding va
by kryptiskt 4y ago
It's an absolute massive codebase, but the compilers and analyzers in Roslyn[0] are very clearly written.
For a random example, here is the analyzer finding variable swaps of the form
tmp = a;
a = b;
b = tmp;
that can better be done using tuples:
https://github.com/dotnet/roslyn/blob/main/src/Analyzers/CSharp/Analyzers/UseTupleSwap/CSharpUseTupleSwapDiagnosticAnalyzer.cs https://github.com/dotnet/roslyn/blob/main/src/Analyzers/CSh...
And here is the code fix that automatically performs the substitution:
https://github.com/dotnet/roslyn/blob/main/src/Analyzers/CSharp/CodeFixes/UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs https://github.com/dotnet/roslyn/blob/main/src/Analyzers/CSh...
[0]: https://github.com/dotnet/roslyn https://github.com/dotnet/roslyn
- _Chief 4y agoA tip for going over github code is to use the github.dev domain. This will help going over the code in an IDE (if you'd like that), that provides you language features, and easier navigation (eg Go To/ Peek Definitions, or References). It also helps avoid to clone a large repo to do the same locally. For example https://github.dev/dotnet/roslyn/blob/main/src/Analyzers/CSharp/Analyzers/UseTupleSwap/CSharpUseTupleSwapDiagnosticAnalyzer.cs https://github.dev/dotnet/roslyn/blob/main/src/Analyzers/CSh... (takes a few mins to cache such a large repo, but caches in browser local storage for subsequent use)
- bob1029 4y agoPressing '.' while in the code area of GitHub.com will automagically take you to dev space.