3 ms·
This has been around for years in .NET and Java IDEs and I'm sure in many more places. Jetbrains' ReSharper is famous for its complex code analysis with useful
by foepys 6y ago
This has been around for years in .NET and Java IDEs and I'm sure in many more places. Jetbrains' ReSharper is famous for its complex code analysis with useful hints to improve code readability and robustness. A single click can refactor your code.
.NET's Roslyn compiler supports analyzers that you can write yourself which also support code fix providers to automatically refactor code. All analyzers and code fix providers are written in .NET languages (C#, F#, etc.), so the possibilities are endless.
- catlifeonmars 6y agoYes but how sophisticated is the code analysis? I’m curious if there are tools that can do things like: - detect and replace first party algorithms with third party libraries. For example, recognizing a hand-rolled binary search implementation and swapping it out. - recognize design patterns - apply suggestions based on solid principles
- jolux 6y agoWell in C# the collections have efficient searching and sorting built in :) but as for whether they can recognize design patterns — VS and R# can definitely move members and symbols around fluidly within a class hierarchy.
- foepys 6y agoFor performance you subscribe on a specific syntax kind in the syntax tree (like if, condition, operator, variable definition, etc.), the compiler calls your analyzer, and then you get a context object where you get full access to the syntax tree. After that you are only limited by your imagination.
- jolux 6y agoI believe you can also filter by semantics as well.