Showing 331 of 503 total issues
Function actionCreate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function actionCreate()
{
// 1. ask for module
if ($this->moduleName === null) {
Console::clearScreenBeforeCursor();
- 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 parseDocBlockToArrays
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function parseDocBlockToArrays(PhpDocReflection $reflection)
{
$rows = [
'texts' => [],
'return' => [], // @return <type> <description>
- 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 actions
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actions()
{
$actions = [
'index' => [ // for casual api request behavior
'class' => 'luya\admin\ngrest\base\actions\IndexAction',
Method getModuleItems
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getModuleItems($nodeId)
{
if (isset($this->_nodeItems[$nodeId])) {
return $this->_nodeItems[$nodeId];
}
Method createImage
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createImage($fileId, $filterId)
{
gc_collect_cycles();
$image = StorageImage::find()->where(['file_id' => $fileId, 'filter_id' => $filterId])->one();
Consider simplifying this complex logical expression. Open
"pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) { return PLURAL_CATEGORY.FEW; } if (vf.v == 0 && i != 1 && i % 10 >= 0 && i % 10 <= 1 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 12 && i % 100 <= 14) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;}
Method actionIndex
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionIndex($query)
{
$search = [];
$module = Yii::$app->getModule('admin');
Method actionIndex
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionIndex($identifier, $token)
{
$machine = ProxyMachine::findOne(['identifier' => $identifier, 'is_deleted' => false]);
if (!$machine) {
Function generateMonthAndYearHeader
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
, generateMonthAndYearHeader = function generateMonthAndYearHeader(prevButton, nextButton, preventMobile) {
if (preventMobile) {
isMobile = false;
Function appendFieldOption
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function appendFieldOption($fieldName, $optionKey, $optionValue)
{
foreach ($this->getConfig() as $pointer => $fields) {
if (is_array($fields)) {
foreach ($fields as $field) {
- 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 actionSync
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function actionSync()
{
$this->db = Instance::ensure($this->db, Connection::class);
if ($this->url === null) {
- 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 getProperties
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getProperties($phpDocProperties = true)
{
$properties = [];
$attributeFields = [];
- 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 controller
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
function ($scope, $http, $filter, $timeout, $q, HtmlStorage, cfpLoadingBar, Upload, ServiceFoldersData, ServiceFilesData, LuyaLoading, AdminToastService, ServiceFoldersDirectoryId, ServiceAdminTags, ServiceQueueWaiting) {
Function controller
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: ['$scope', '$element', '$timeout', function ($scope, $element, $timeout) {
$scope.init = function () {
if ($scope.model === undefined || $scope.model === null) {
$scope.model = [];
Method generateModelContent
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateModelContent($fileNamepsace, $className, $apiEndpoint, TableSchema $schema, $i18nFields)
{
$alias = Inflector::humanize(Inflector::camel2words($className));
$dbTableName = $schema->fullName;
Function controller
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: ['$scope', '$http', '$timeout', function($scope, $http, $timeout) {
// the loaded file to crop
$scope.file;
// cropper image
$scope.cropperImage;
Function controller
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: ['$scope', '$timeout', function ($scope, $timeout) {
$scope.init = function () {
if ($scope.model === undefined || $scope.model === null) {
$scope.model = [];
} else {
Function localDateTimestamp
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
, localDateTimestamp = function localDateTimestamp(rawDate, dateFormatDefinition) {
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|MMMM|MMM|MM|M|dd?d?|yy?yy?y?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g
,formatDate,dateSplit, m, d, y, index, el, longName, shortName;
Function setDaysInMonth
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
, setDaysInMonth = function setDaysInMonth(month, year) {
var i
, limitDate = new Date(year, month, 0).getDate()
, firstDayMonthNumber = new Date(year + '/' + month + '/' + 1).getDay()
Method actionServices
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionServices()
{
$settings = [];
$apiEndpoint = $this->model->ngRestApiEndpoint();
$userSortSettings = Yii::$app->adminuser->identity->setting->get('ngrestorder.admin/'.$apiEndpoint, false);