目录
当前位置: 首页 > 文档资料 > PX4 开发指南 >

测试和持续集成 - 维护

优质
小牛编辑
123浏览
2023-12-01

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 |