fulldecent/cameralife

View on GitHub

Showing 127 of 127 total issues

Function handlePost has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handlePost($get, $post, $files, $cookies)
    {
        if (Models\User::currentUser($cookies)->authorizationLevel < 5) {
            throw new \Exception('You are not authorized to view this page');
        }
Severity: Minor
Found in sources/Controllers/AdminPreferenceChangeController.php - About 1 hr 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 handleRequest has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function handleRequest($get, $post, $files, $cookies, $server)
    {
        try {
            $page = isset($get['page']) ? $get['page'] : 'mainPage';
            $dbIsCurrent = Models\Database::installedSchemaIsCorrectVersion();
Severity: Minor
Found in sources/Controllers/Controller.php - About 1 hr to fix

    Method imagerotateRightAngle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function imagerotateRightAngle($imgSrc, $angle)
        {
            // dimenstion of source image
            $srcX = imagesx($imgSrc);
            $srcY = imagesy($imgSrc);
    Severity: Minor
    Found in sources/Models/Image.php - About 1 hr to fix

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

                          foreach ($popularPhotos as $photo) {
                              // fix links
                              $percent = $photo->Get('hits') * 100 / $popularPhotos[0]->Get('hits');
                              echo "<tr><td>";
                              echo "<progress class=\"progress\" value=\"$percent\" max=\"100\" style=\"width:70px\">$percent</progress>";
      Severity: Minor
      Found in sources/Views/StatisticsView.php and 1 other location - About 1 hr to fix
      sources/Views/StatisticsView.php on lines 70..78

      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 100.

      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

                          foreach ($popularAlbums as $photo) {
                              $percent = $photo->get('hits') * 100 / $popularPhotos[0]->get('hits');
                              echo "<tr><td>";
                              echo "<progress class=\"progress\" value=\"$percent\" max=\"100\" style=\"width:70px\">$percent</progress>";
                              echo "<td>" . number_format($photo->Get('hits'));
      Severity: Minor
      Found in sources/Views/StatisticsView.php and 1 other location - About 1 hr to fix
      sources/Views/StatisticsView.php on lines 46..55

      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 100.

      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

      Function getDefaultForRecordTypeAndValueField has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function getDefaultForRecordTypeAndValueField($recordType, $valueField)
          {
              switch ($recordType . '_' . $valueField) {
                  case 'photo_description':
                      $oldvalue = 'unnamed';
      Severity: Minor
      Found in sources/Models/AuditTrail.php - About 55 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 select has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function select($table, $selection = '*', $condition = '1', $extra = '', $joins = '', $bind = array())
          {
              empty(self::$pdoConnection) && self::connect();
              if (!$condition) {
                  $condition = '1';
      Severity: Minor
      Found in sources/Models/Database.php - About 55 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 handleGet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handleGet($get, $post, $files, $cookies)
          {
              $this->htmlHeader($cookies);
      
              /* Set up the page view */
      Severity: Minor
      Found in sources/Controllers/AllTagCollectionsController.php - About 55 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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function update()
          {
              //TODO: NEED TEST CASES FOR THIS AND ACTUAL TESTING!!!!!!!
              // move files / delete files / readd files (undelete) / UTF filenames
              $retval = array();
      Severity: Minor
      Found in sources/Models/Folder.php - About 55 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 handleGet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handleGet($get, $post, $files, $cookies)
          {
              $this->htmlHeader($cookies);
      
              /* Set up the page view */
      Severity: Minor
      Found in sources/Controllers/MainPageController.php - About 55 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 select has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function select($table, $selection = '*', $condition = '1', $extra = '', $joins = '', $bind = array())
      Severity: Minor
      Found in sources/Models/Database.php - About 45 mins to fix

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

            public static function createAuditTrailForChange(User $user, $record_type, $record_id, $value_field, $value_old, $value_new)
        Severity: Minor
        Found in sources/Models/AuditTrail.php - About 45 mins to fix

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

              public function generateThumbnail()
              {
                  $this->loadImage(); // sets $this->EXIF and $this-record
                  if ($this->record['modified'] == '1') {
                      $this->record['modified'] = null; // legacy before 2.7
          Severity: Minor
          Found in sources/Models/Photo.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 selectOne has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function selectOne($table, $selection = '*', $condition = '1', $extra = '', $joins = '', $bind = array())
          Severity: Minor
          Found in sources/Models/Database.php - About 45 mins to fix

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

                protected function photoSortSqlForOption($option)
                {
                    if ($option == 'newest') {
                        return 'value desc, photos.id desc';
                    } elseif ($option == 'oldest') {
            Severity: Minor
            Found in sources/Models/Search.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

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

                public function render()
                {
                    echo <<<EOL
                    <!-- CAMERALIFE PHONE HOME Global site tag (gtag.js) - Google Analytics -->
                    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-52764-13"></script>
            Severity: Minor
            Found in sources/Views/AdminView.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 handleRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function handleRequest($get, $post, $files, $cookies, $server)
            Severity: Minor
            Found in sources/Controllers/Controller.php - About 35 mins to fix

              Function tagSortSqlForOption has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function tagSortSqlForOption($option)
                  {
                      if ($option == 'newest') {
                          return 'albums.id desc';
                      } elseif ($option == 'oldest') {
              Severity: Minor
              Found in sources/Models/Search.php - About 35 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 handleGet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function handleGet($get, $post, $files, $cookies)
                  {
                      if (Models\User::currentUser($cookies)->authorizationLevel < 5) {
                          throw new \Exception('You are not authorized to view this page');
                      }
              Severity: Minor
              Found in sources/Controllers/AdminThumbnailController.php - About 35 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function render()
                  {
                      echo "<h2>Site change logs</h2>";
                      echo "<p class=\"lead\">";
                      if ($this->checkpointId > 0) {
              Severity: Minor
              Found in sources/Views/AdminLogsView.php - About 35 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