7 ms·
Static analysis is your friend here. TypeScript, Rust, and C# can all identify dead code and report errors or warnings from that, and can perform "find all usag
by tdriggs 9y ago
Static analysis is your friend here. TypeScript, Rust, and C# can all identify dead code and report errors or warnings from that, and can perform "find all usage" searches across a workspace.
- marcosdumay 9y agoThis is my main criticism of the Ruby community. Code that will throw static analysis out is not only accepted, but even welcome. Python's cold acceptance is already enough to make big projects impractical on it, because every large codebase will gather some undecidable metaprogramming spread through it. But Ruby gets it everywhere.
- deleted 9y ago[deleted]
- bga 9y agoAnd so in Ruby, we use test frameworks with advanced mocking, as well as runtime-reflection coverage measurement. Metaprogramming: the cause of, and solution to, all of life's problems.
- jimktrains2 9y ago> And so in Ruby, we use test frameworks with advanced mocking, as well as runtime-reflection coverage measurement. No matter how many times you say it, that doesn't make it true.
- bga 9y agoCare to elaborate?
- Buttons840 9y agoI think he means that you seem to be speaking for all of the Ruby community (that is, people who write Ruby code). I've personally seen that not all of the Ruby community writes tests, because I've seen Ruby code that doesn't have tests. In fact, I've had coworkers who work with Ruby in multiple jobs in different industries, and in all cases the Ruby application had very few or no tests.
- cl0wnshoes 9y agoIf your code base is only used within a single workspace (and you know this with certainty) then I completely agree. The issue arises when your code is used outside of your workspace as a shared code base or a public facing API.
- msangi 9y agoStatic analysis is very useful to identify unreachable code given that it can see all the code depending on it. It doesn't help with potentially reachable but unused cpdepaths, which in my experience make up for the most of 'dead' code. Think of the functionality in an application that nobody uses or of obsolete API version when all the clients use a more recent version.
- lomnakkus 9y agoThis is an excellent point, but it should be noted that once you delete the unused API endpoint, finding the rest of the dead code is almost trivial with static analysis. 30-15 to static analysis, I think? ;)