tdmalone / slackemon

Inspired by Pokémon Go, now you can catch and battle Pokémon with your teammates on Slack!
GNU General Public License v3.0
10 stars 3 forks source link

Function complexity needs decreasing #25

Open tdmalone opened 7 years ago

tdmalone commented 7 years ago

Some functions - in particular some spawn, catch and battle routines - have quite high cyclomatic and NPath complexity. This makes it difficult to write tests for them, and of course makes development of some new features difficult and increases the possibilities of introducing bugs.

Some current functions need to be re-thought in order to resolve this.

tdmalone commented 7 years ago

Can use a tool such as phpmd for this, which is currently in composer on the tests branch. I've also linked the repo to Code Climate which reports on the same issues automatically and has some cool stats which I don't understand, but it might be easier to resolve this locally for now and possibly make Code Climate part of the build process later on (we'll need a codeclimate.yml file to turn off some of the 'controversial' tests).

Naramsim commented 7 years ago

Take a look at Codacy it is the same as Code Climate but with some added features. It reports coverage and checks for security issues. Or Scrutinizer.

Here you can find the Codacy dashboard for my fork, not updated.

tdmalone commented 7 years ago

Mmmm Codacy looks good. I will set that up too, it sounds better than Code Climate. When we're at a decent stage I'll put a badge for one of them on the readme.

tdmalone commented 7 years ago

Some complexity has been decreased on battle code in v0.0.46. Much further to go though. As complexity is reduced, further unit tests can be introduced.