[api] move one more render function to a view

Conflicts:
	src/api/test/unit/code_quality_test.rb
[api] refactor source#index_package

Some of the code branches are rather bizzare

Conflicts:
	src/api/test/unit/code_quality_test.rb
[api] add a code quality check deploying flog

We measure code complexity in average per method and enforce going down
in average. I'm not sure what it means if new code is added, but I sure
hope that adding more if case cascades to existent code is blocked by
that

Conflicts:
	src/api/test/unit/code_quality_test.rb
[api] fix some code to meet the code quality metrics again :)
[api] refactor source#index_package too
[api] refactory source#file action too