Hi community, In this proposal, we focus on improving the code quality of the DolphinScheduler project. There will be two main tasks to be discussed:
1. Refactoring unit tests. 2. Fixing style & formatting errors. When those two tasks done, we expect a significant increase in code stability and a unified coding style. As we have already discussed in another email thread[1] and community bi-weekly conference about replacing `Checksytle` with `Spotless` and reached the agreement on fixing the style and formatting errors gradually, we may combine these two tasks together. Specifically speaking, we will submit an initial PR to add `Spotless` plugin and enable incremental fixes on code style. Then, when we refactor the UTs, we will fix the style and formatting errors of both the related `test` code and `tested` code. In this way, hopefully, we will fix most of the legacy style & formatting errors once UT refactoring done. I ran UTs with coverage of every modules in DS by `Intellij` and generated the reports. We will take the report into consideration when deciding the refactoring priority. We could see the UT coverage sorted by `method coverage` of different modules here[2]. For the criteria of UT coverage, from my perspective, I propose to use `method coverage`. By writing tests for methods instead of a whole class, we could make sure those tests are decoupled and will not break easily when changing the tested code. We expect every method of DS core covered but we may slack a bit for plugins to trade-off between code quality and contributors' patience, as many of our contributors are tired of writing UTs. However, we still expect contributors / maintainers to follow up those PRs of plugins and add more UTs. Certainly there will be exceptions as some legacy class in java are quite difficult to get covered. There will be three subtasks for refactoring UTs: 1. Refactor UTs in each module. 2. Add some docs of instructions with examples on how to write UTs in DS. 3. Leave some typical UTs without refactored, create related issues and label them with `good first issue` for new contributors to get onboard. Suggestions and comments are appreciated as always and you are very welcome to reply in this email thread : ) References and related issues: [1]https://lists.apache.org/thread/9sqvd1wlfgkyn2y926l732zj1n3z7xkx [2] https://github.com/apache/dolphinscheduler/issues/10573#issuecomment-1193753867 [3]https://github.com/apache/dolphinscheduler/issues/10573 [4]https://github.com/apache/dolphinscheduler/issues/10963 *Best Regards,* *Chufeng (Eric) Gao*
