luyadev/luya-testsuite

View on GitHub

Showing 16 of 18 total issues

Method createPage has 136 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createPage($title, $layoutViewFile, array $layoutPlaceholders, array $options = [])
    {
        $id = ArrayHelper::getValue($options, 'id', 1);
        $parentNavId = ArrayHelper::getValue($options, 'parentNavId', 0);
        $isHome = ArrayHelper::getValue($options, 'isHome', true);
Severity: Major
Found in src/scopes/PageScope.php - About 5 hrs to fix

    Function createSchemaFromRules has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createSchemaFromRules()
        {
            $object = $this->getNewModel();
            
            $fields = [];
    Severity: Minor
    Found in src/fixtures/ActiveRecordFixture.php - About 3 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

    File AdminDatabaseTableTrait.php has 315 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace luya\testsuite\traits;
    
    use luya\admin\models\Group;
    Severity: Minor
    Found in src/traits/AdminDatabaseTableTrait.php - About 3 hrs to fix

      File NgRestTestCase.php has 295 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace luya\testsuite\cases;
      
      use yii\base\InvalidConfigException;
      Severity: Minor
      Found in src/cases/NgRestTestCase.php - About 3 hrs to fix

        ServerTestCase has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        abstract class ServerTestCase extends BaseTestSuite
        {
            /**
             * @var string
             */
        Severity: Minor
        Found in src/cases/ServerTestCase.php - About 2 hrs to fix

          Function compareMessages has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public function compareMessages($folder, $masterLang)
              {
                  $folder = Yii::getAlias($folder);
                  $folders = [];
                  
          Severity: Minor
          Found in src/traits/MessageFileCompareTrait.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 mockBasicAdminModels has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function mockBasicAdminModels()
              {
                  $this->createAdminUserGroupTable();
                  $this->createAdminGroupAuthTable();
                  $this->createAdminAuthTable();
          Severity: Minor
          Found in src/cases/NgRestTestCase.php - About 1 hr to fix

            Method actionIndex has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function actionIndex()
                {
                    if ($this->mode === null) {
                        $this->mode = $this->select('Table or Model (ActiveRecord) based Fixture', [
                            self::MODE_MODEL => 'Model (Active Record)',
            Severity: Minor
            Found in src/commands/GenerateFixtureController.php - About 1 hr to fix

              Method prepare has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function prepare()
                  {
                      // ensure the given and required application components are available.
                      $this->updateApplicationConfig();
              
              
              Severity: Minor
              Found in src/scopes/PermissionScope.php - About 1 hr to fix

                Method createAdminUserFixture has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function createAdminUserFixture(array $fixtureData = [], $defaultSchema = true)
                    {
                        return new NgRestModelFixture([
                            'modelClass' => User::class,
                            'schema' => $defaultSchema ? [
                Severity: Minor
                Found in src/traits/AdminDatabaseTableTrait.php - About 1 hr to fix

                  Method createSchemaFromRules has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function createSchemaFromRules()
                      {
                          $object = $this->getNewModel();
                          
                          $fields = [];
                  Severity: Minor
                  Found in src/fixtures/ActiveRecordFixture.php - About 1 hr to fix

                    Method testBasicNgRestMethods has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function testBasicNgRestMethods()
                        {
                            $class = $this->modelClass;
                            
                            $this->assertNotNull($class::ngRestApiEndpoint());
                    Severity: Minor
                    Found in src/cases/NgRestTestCase.php - About 1 hr to fix

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

                          protected function itemToStructure($item, $lang, $parentNavId)
                          {
                              $id = ArrayHelper::getValue($item, 'id');
                              $title = ArrayHelper::getValue($item, 'title');
                              return [
                      Severity: Minor
                      Found in src/components/DummyMenu.php - About 1 hr to fix

                        Function actionIndex has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function actionIndex()
                            {
                                if ($this->mode === null) {
                                    $this->mode = $this->select('Table or Model (ActiveRecord) based Fixture', [
                                        self::MODE_MODEL => 'Model (Active Record)',
                        Severity: Minor
                        Found in src/commands/GenerateFixtureController.php - About 45 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

                        Method generateClassFile has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function generateClassFile(TableSchema $schema, $className, array $data, $modelClass = null, $tableName = null, $addData = null)
                        Severity: Minor
                        Found in src/commands/GenerateFixtureController.php - About 45 mins to fix

                          Method assignGroupAuth has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function assignGroupAuth($groupId, $authId, $canCreate = true, $canUpdate = true, $canDelete = true)
                          Severity: Minor
                          Found in src/traits/AdminDatabaseTableTrait.php - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language