Showing 20 of 276 total issues
Function init
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function() {
this.treeElement = $('#category-list');
if (!this.treeElement.length) {
return false;
}
Function display
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
display: function() {
var options = {
dragAndDrop: true,
selectable: true,
autoOpen: true,
Function performModelSave
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function performModelSave(ActiveRecord $model, array $params)
{
$ajax = Yii::$app->request->isAjax;
if ($model->save()) {
if ($ajax) {
- 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 actionIndex
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionIndex()
{
if (!$this->confirm('Remove all data and insert demo data?')) {
return false;
}
Method safeUp
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function safeUp()
{
$this->createTable('{{%user}}', [
'id' => $this->primaryKey(),
'username' => $this->string()->notNull()->unique(),
Function exports
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (grunt) {
grunt.initConfig({
less: {
prod: {
options: {
Function matchRole
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function matchRole($user)
{
if (empty($this->roles)) {
return true;
}
- 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 renderItems
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function renderItems()
{
$items = [];
foreach ($this->items as $i => $item) {
if ($item instanceof NavItemInterface) {
- 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 renderCategories
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function renderCategories($categories, $parentId = null, $level = 0)
{
$html = '';
foreach ($categories as $category) {
- 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 run
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
if (($exception = Yii::$app->getErrorHandler()->exception) === null) {
// action has been invoked not from error handler, but by direct route, so we display '404 Not Found'
$exception = new HttpException(404, Yii::t('yii', 'Page not found.'));
Function onCreateLi
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
onCreateLi: function(node, li) {
if (node.isEmpty) {
li.addClass('jqtree-empty');
return;
}
Method performModelSave
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function performModelSave(ActiveRecord $model, array $params)
{
$ajax = Yii::$app->request->isAjax;
if ($model->save()) {
if ($ajax) {
Function run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
$classes = ['posts-widget'];
if ($this->renderCategories) {
$classes[] = 'with-categories';
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
if (($exception = Yii::$app->getErrorHandler()->exception) === null) {
// action has been invoked not from error handler, but by direct route, so we display '404 Not Found'
$exception = new HttpException(404, Yii::t('yii', 'Page not found.'));
- 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 performModelDelete
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function performModelDelete(ActiveRecord $model, array $params)
{
Yii::$app->response->format = Response::FORMAT_JSON;
if ($model->delete()) {
if (isset($params['afterDelete']) && is_callable($params['afterDelete'])) {
- 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 actionSortItems
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionSortItems()
{
$form = new CategorySortForm();
if ($form->load(Yii::$app->request->post()) && !$form->validate()) {
throw new InvalidParamException(VarDumper::dumpAsString($form->errors));
- 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
Avoid too many return
statements within this method. Open
return false;
Function actionSignup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function actionSignup()
{
$model = new SignupForm();
if ($model->load(Yii::$app->request->post())) {
if ($user = $model->signup()) {
- 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 init
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function init()
{
parent::init();
$session = \Yii::$app->session;
- 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 buildTree
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function buildTree($categories, $parentId = null, $level = 0)
{
$items = [];
foreach ($categories as $category) {
- 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"