owncloud/core

View on GitHub
apps/dav/appinfo/Migrations/Version20170116150538.php

Summary

Maintainability
F
4 days
Test Coverage

File Version20170116150538.php has 453 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Viktar Dubiniuk <dubiniuk@owncloud.com>
 *
 * @copyright Copyright (c) 2018, ownCloud GmbH
Severity: Minor
Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 6 hrs to fix

    Method createCalendarObjectsTable has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function createCalendarObjectsTable(Schema $schema) {
            if (!$schema->hasTable("{$this->prefix}calendarobjects")) {
                $table = $schema->createTable("{$this->prefix}calendarobjects");
                $table->addColumn('id', 'integer', [
                    'notnull' => true,
    Severity: Major
    Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 2 hrs to fix

      Method createCalendarSubscriptionsTable has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function createCalendarSubscriptionsTable(Schema $schema) {
              if (!$schema->hasTable("{$this->prefix}calendarsubscriptions")) {
                  $table = $schema->createTable("{$this->prefix}calendarsubscriptions");
                  $table->addColumn('id', 'integer', [
                      'autoincrement' => true,
      Severity: Major
      Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 2 hrs to fix

        Method createCalendarsTable has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function createCalendarsTable(Schema $schema) {
                if (!$schema->hasTable("{$this->prefix}calendars")) {
                    $table = $schema->createTable("{$this->prefix}calendars");
                    $table->addColumn('id', 'integer', [
                        'autoincrement' => true,
        Severity: Major
        Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 2 hrs to fix

          Method createCardsPropertiesTable has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function createCardsPropertiesTable(Schema $schema) {
                  if (!$schema->hasTable("{$this->prefix}cards_properties")) {
                      $table = $schema->createTable("{$this->prefix}cards_properties");
                      $table->addColumn('id', 'integer', [
                          'autoincrement' => true,
          Severity: Minor
          Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 1 hr to fix

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

                private function createCardsTable(Schema $schema) {
                    if (!$schema->hasTable("{$this->prefix}cards")) {
                        $table = $schema->createTable("{$this->prefix}cards");
                        $table->addColumn('id', 'integer', [
                            'autoincrement' => true,
            Severity: Minor
            Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 1 hr to fix

              Method createSchedulingObjectsTable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function createSchedulingObjectsTable(Schema $schema) {
                      if (!$schema->hasTable("{$this->prefix}schedulingobjects")) {
                          $table = $schema->createTable("{$this->prefix}schedulingobjects");
                          $table->addColumn('id', 'integer', [
                              'autoincrement' => true,
              Severity: Minor
              Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 1 hr to fix

                Method createDavSharesTable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function createDavSharesTable(Schema $schema) {
                        if (!$schema->hasTable("{$this->prefix}dav_shares")) {
                            $table = $schema->createTable("{$this->prefix}dav_shares");
                            $table->addColumn('id', 'integer', [
                                'autoincrement' => true,
                Severity: Minor
                Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 1 hr to fix

                  Method createAddressbooksTable has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function createAddressbooksTable(Schema $schema) {
                          if (!$schema->hasTable("{$this->prefix}addressbooks")) {
                              $table = $schema->createTable("{$this->prefix}addressbooks");
                              $table->addColumn('id', 'integer', [
                                  'autoincrement' => true,
                  Severity: Minor
                  Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 1 hr to fix

                    Method createAddressbookChangesTable has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function createAddressbookChangesTable(Schema $schema) {
                            if (!$schema->hasTable("{$this->prefix}addressbookchanges")) {
                                $table = $schema->createTable("{$this->prefix}addressbookchanges");
                                $table->addColumn('id', 'integer', [
                                    'autoincrement' => true,
                    Severity: Minor
                    Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 1 hr to fix

                      Method createCalendarChangesTable has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function createCalendarChangesTable(Schema $schema) {
                              if (!$schema->hasTable("{$this->prefix}calendarchanges")) {
                                  $table = $schema->createTable("{$this->prefix}calendarchanges");
                                  $table->addColumn('id', 'integer', [
                                      'autoincrement' => true,
                      Severity: Minor
                      Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 1 hr to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            private function createAddressbookChangesTable(Schema $schema) {
                                if (!$schema->hasTable("{$this->prefix}addressbookchanges")) {
                                    $table = $schema->createTable("{$this->prefix}addressbookchanges");
                                    $table->addColumn('id', 'integer', [
                                        'autoincrement' => true,
                        Severity: Major
                        Found in apps/dav/appinfo/Migrations/Version20170116150538.php and 1 other location - About 7 hrs to fix
                        apps/dav/appinfo/Migrations/Version20170116150538.php on lines 300..331

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 243.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            private function createCalendarChangesTable(Schema $schema) {
                                if (!$schema->hasTable("{$this->prefix}calendarchanges")) {
                                    $table = $schema->createTable("{$this->prefix}calendarchanges");
                                    $table->addColumn('id', 'integer', [
                                        'autoincrement' => true,
                        Severity: Major
                        Found in apps/dav/appinfo/Migrations/Version20170116150538.php and 1 other location - About 7 hrs to fix
                        apps/dav/appinfo/Migrations/Version20170116150538.php on lines 135..166

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 243.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        There are no issues that match your filters.

                        Category
                        Status