handesk icon indicating copy to clipboard operation
handesk copied to clipboard

Test Coverage and Code Complexity: TODO

Open deleugpn opened this issue 7 years ago • 8 comments

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

Project Risk


Test Coverage

deleugpn avatar Sep 08 '17 10:09 deleugpn

How did you get that code complexity graph? it is really really interesiting!

BadChoice avatar Sep 08 '17 14:09 BadChoice

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

deleugpn avatar Sep 08 '17 14:09 deleugpn

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?

BadChoice avatar Sep 08 '17 14:09 BadChoice

You need to install PHP XDebug

deleugpn avatar Sep 08 '17 14:09 deleugpn

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

BadChoice avatar Sep 08 '17 14:09 BadChoice

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.

deleugpn avatar Sep 08 '17 15:09 deleugpn

I did a first pass, I guess it will have reduced the complexity a bit

https://github.com/BadChoice/handesk/commit/6d1dc2f386d6a0d45c33d8f8af87f31852770934

BadChoice avatar Sep 08 '17 15:09 BadChoice

https://github.com/BadChoice/handesk/commit/21cbd6ba1fea2e8585c4907759b7576b3b10cfdc

More complexity reduced ;)

BadChoice avatar Sep 08 '17 15:09 BadChoice