• Maintenance notes
    • Analyze churn

    Maintenance notes

    This picks and describes some tools to help analyze the state of the codebase and support its maintenance.

    Analyze churn

    The amount of churn, so the number of changes done to a file can be an indicator which files/parts might need refactoring.

    To find churn metrics a tool such as Churn can be used:

    1. gem install churn

    An example output as of v1.6.0-rc2 would be:

    1. cd src/Firmware
    2. churn --start_date "6 months ago"
    3. **********************************************************************
    4. * Revision Changes
    5. **********************************************************************
    6. Files
    7. +------------------------------------------+
    8. | file |
    9. +------------------------------------------+
    10. | src/modules/navigator/mission.cpp |
    11. | src/modules/navigator/navigator_main.cpp |
    12. | src/modules/navigator/rtl.cpp |
    13. +------------------------------------------+
    14. **********************************************************************
    15. * Project Churn
    16. **********************************************************************
    17. Files
    18. +---------------------------------------------------------------------------+---------------+
    19. | file_path | times_changed |
    20. +---------------------------------------------------------------------------+---------------+
    21. | src/modules/mc_pos_control/mc_pos_control_main.cpp | 107 |
    22. | src/modules/commander/commander.cpp | 67 |
    23. | ROMFS/px4fmu_common/init.d/rcS | 52 |
    24. | Makefile | 49 |
    25. | src/drivers/px4fmu/fmu.cpp | 47 |
    26. | ROMFS/px4fmu_common/init.d/rc.sensors | 40 |
    27. | src/drivers/boards/aerofc-v1/board_config.h | 31 |
    28. | src/modules/logger/logger.cpp | 29 |
    29. | src/modules/navigator/navigator_main.cpp | 28 |