4 ms·
Automated code sniffing sounds like a fantastic idea. Perhaps we’ll look back to the 2010s as the dark ages, when all we had at our disposal was peer review of
by gorgoiler 6y ago
Automated code sniffing sounds like a fantastic idea. Perhaps we’ll look back to the 2010s as the dark ages, when all we had at our disposal was peer review of our codes?
Review early and (fairly) often, lest you embark on implementing a FrobNibulatorFactory from the ground up only to be told there is one already in lib/util/frob/util/tools/misc/nibulation.
Not everyone has peers, alas. The imaginary ones help (rubber ducky, you’re the one...)
- foepys 6y agoThis 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.