handesk
handesk copied to clipboard
Test Coverage and Code Complexity: TODO
Easy
- [ ] Cover Authentication Process
- [ ] Refactor and Cover SettingsController
- [ ] Refactor TicketsController
- [ ] Cover UsersController
Medium
- [ ] Cover Attachment Model
- [ ] Cover DailyTasksMail
Hard
- [x] Reduce complexity of KpiRepository;
- [ ] Reduce complexity of next top 5 complex classes (after KpiRepository);
- [ ] Clean up uncovered and unused classes / files / methods
- [ ] Test coverage for the top 5 complex classes
- [ ] Refactor Ticket Model
Stats
How did you get that code complexity graph? it is really really interesiting!
I have this alias
:
alias unitreport='php -d xdebug.profiler_enable=On vendor/phpunit/phpunit/phpunit --coverage-html=./public/report'
Basically php -d
will enable xdebug (PHP is really slow with it, so I keep it off and only enable when running coverage). vendor/phpunit/phpunit/phpunit
is the actual phpunit file.
The magic happens with --coverage-html=./public/report
. It will generate the HTML files inside your public/report
and then you can access it on http://yourapp.domain/report
Running this I get a
Error: No code coverage driver is available
Then it runs the test but no report created :( Do I need to install anything extra?
You need to install PHP XDebug
It worked! really nice tool to know what to refactor first :D I'll work with the KPIRepository it is not really hard, but have all the kpis functions there, I'll create a class for each KPI and the KPIRepository just be a kind of dispatcher
For me it's a little hard because I don't have knowledge of the mechanics yet, but I would be glad to review a refactor PR if you want.
I did a first pass, I guess it will have reduced the complexity a bit
https://github.com/BadChoice/handesk/commit/6d1dc2f386d6a0d45c33d8f8af87f31852770934
https://github.com/BadChoice/handesk/commit/21cbd6ba1fea2e8585c4907759b7576b3b10cfdc
More complexity reduced ;)