cjtterabytesoft/yii2-adminlte-basic

View on GitHub

Showing 5 of 5 total issues

Function bootstrap has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function bootstrap($app)
    {
        /* Config Translation */
        if (!isset($app->get('i18n')->translations['adminlte*'])) {
            $app->get('i18n')->translations['adminlte*'] = [
Severity: Minor
Found in Bootstrap.php - About 2 hrs to fix

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 bootstrap has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function bootstrap($app)
    {
        /* Config Translation */
        if (!isset($app->get('i18n')->translations['adminlte*'])) {
            $app->get('i18n')->translations['adminlte*'] = [
Severity: Major
Found in Bootstrap.php - About 2 hrs to fix

    Method renderItem has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function renderItem($item)
        {
            $item['badgeOptions'] = isset($item['badgeOptions']) ? $item['badgeOptions'] : [];
            if (!ArrayHelper::getValue($item, 'badgeOptions.class')) {
                $bg = isset($item['badgeBgClass']) ? $item['badgeBgClass'] : $this->badgeBgClass;
    Severity: Minor
    Found in widgets/MainSidebar.php - About 1 hr to fix

      Function init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function init()
          {
              parent::init();
      
              $session = \Yii::$app->getSession();
      Severity: Minor
      Found in widgets/Alert.php - About 25 mins to fix

      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 actionContact has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function actionContact()
          {
              $model = new ContactForm();
              if ($model->load(Yii::$app->request->post()) && $model->validate()) {
                  if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
      Severity: Minor
      Found in controllers/SiteController.php - About 25 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language