How to remove functionality from a program in ruby?

You have the code you want to remove associated with outdated functionality from a ruby ​​project. How to ensure that you get rid of all the code?

Some recommendations that usually help in ruby ​​refactoring apply, but there are additional problems because code that is not called by anything will not break any unit tests.

Refresh . Has anyone written something that allows you to guess, based on your version control history, if there are commits, where have you since removed most, but not all, of the code and can you specify the remaining code?

+1
source share
3 answers

Current thoughts:

  • Define the outer part of the stack associated with obsolete functionality: a binary script that calls it, or a module verifies its call.
  • Look for methods called only by methods associated with legacy functionality. I often use git grepfor this.
  • Theoretically, when testing mutations and searching for code that used to be mutation resistant when the old test suite was used, but now it can affect the mutation. This only helps if your code has been well tested first! (Or you can use code coverage tools like rcov rather than mutation testing).
  • Running test suites ensures that you don’t delete anything you don’t need!
    • Using autotest can save you time if you constantly perform tests.
  • , , .
+2

. unittests, , , . SOL. , , , , , .

0

. , , , ( ). ( , . =])

0

Source: https://habr.com/ru/post/1748190/


All Articles