Showing 29 of 44 total issues
Method excelAction
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function excelAction($protocolId, $lang)
{
$this->languageKey = $lang;
$protocol = $this->getProtocol($protocolId);
File protocolControllers.js
has 400 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
angular.module('sammui.protocolControllers', ['ngRoute'])
.controller('formFillingMain', ['$rootScope', '$scope', '$route', '$routeParams', '$location', 'formProtocolManage', 'protocolData', 'formProtocolLock',
function ($rootScope, $scope, $route, $routeParams, $location, formProtocolManage, protocolData, formProtocolLock) {
Protocol
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class Protocol
{
/**
* Setting up ODM Document
*/
Method load
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function load(ObjectManager $manager)
{
$documentManager = $this->container->get('doctrine_mongodb.odm.document_manager');
/** @var Form $form */
Function getValueInHR
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getValueInHR()
{
$value = $this->value;
$opts = $this->getField()->getOptions();
$isMulti = (count($opts) > 0);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
ManageControllerTest
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ManageControllerTest extends WebTestCase implements AssertRestUtilsInterface, AssertMongoUtilsInterface, AssertLangInterface, OAuthClientInterface
{
use AssertMongoUtils, AssertRestUtils, AssertLang, OAuthClient;
Function patchFieldsSaveAction
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function patchFieldsSaveAction(Request $request, $protocolId)
{
$odm = $this->get('doctrine_mongodb')->getManager();
$protocol = $this->getProtocol($protocolId);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function excelAction
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function excelAction($protocolId, $lang)
{
$this->languageKey = $lang;
$protocol = $this->getProtocol($protocolId);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method testProtocol
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testProtocol(Form $form)
{
$formRepo = $this->documentManager->getRepository('FormBundle:Form');
$formObj = $formRepo->find($form->getId());
Function checkDependenciesSatisfied
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.checkDependenciesSatisfied = function () {
if ($scope.controllerReady === false) {
return true;
}
Method patchFieldsSaveAction
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function patchFieldsSaveAction(Request $request, $protocolId)
{
$odm = $this->get('doctrine_mongodb')->getManager();
$protocol = $this->getProtocol($protocolId);
Method infoAction
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function infoAction()
{
$auth = $this->get('security.authorization_checker');
$secToken = $this->get('security.token_storage')->getToken();
$oauthToken = $this->get('fos_oauth_server.access_token_manager.default');
Method registerBundles
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
Function saveFields
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.saveFields = function () {
$scope.savingForm = true;
var fieldsToSend = $scope.$parent.protocol.data.form.fields.filter(function (field) {
var fieldValue = null;
Method load
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function load(ObjectManager $manager)
{
$documentManager = $this->container->get('doctrine_mongodb.odm.document_manager');
$form = new Form();
Function getData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
publicFunctions.getData = function (protocolId) {
if (!currentData[protocolId]) {
currentData[protocolId] = formProtocolManage.get({protocolId: protocolId});
Method pdfAction
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pdfAction($protocolId, $lang)
{
$this->languageKey = $lang;
$protocol = $this->getProtocol($protocolId);
Function langKeysTable
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.langKeysTable = function (lang, reload) {
lang = lang || $location.search().lang;
reload = reload || false;
Method getValueInHR
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getValueInHR()
{
$value = $this->value;
$opts = $this->getField()->getOptions();
$isMulti = (count($opts) > 0);
Avoid deeply nested control flow statements. Open
if (field.options[cValue] &&
field.value !== null && field.value !== undefined &&
Object.getOwnPropertyNames(field.value).length > 0 &&
field.value[cValue] === true) {
return false;