fulldecent/cameralife

View on GitHub

Showing 127 of 127 total issues

Method resize has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function resize($filename, $newSize, $quality = 91)
    {
        $baseImage = $this->originalImage;
        $baseSize = $this->size;

Severity: Minor
Found in sources/Models/Image.php - About 1 hr to fix

    Function getRelated has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getRelated()
        {
            //todo pass in referrer
            global $_SERVER;
            $retval = array($this->getFolder());
    Severity: Minor
    Found in sources/Models/Photo.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

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

        public function render()
        {
            $start = $this->start;
            $total = $this->total;
            $perPage = $this->perPage;
    Severity: Minor
    Found in sources/Views/PageSelectorView.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

    Function checkPrerequesites has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkPrerequesites()
        {
            global $_SERVER;
            $prerequesitesAreMet = true;
    
    
    Severity: Minor
    Found in sources/Controllers/SetupInstallController.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

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

            foreach ($root->getDescendants() as $descendant) {
                $folderController = new FolderController($descendant->id);
                $folderAndPhotoOG = array($folderController);
                $photoOpenGraphs = array();
                $descendant->sort = 'rand';
    Severity: Major
    Found in sources/Controllers/MainPageController.php and 1 other location - About 1 hr to fix
    sources/Controllers/AllTagCollectionsController.php on lines 59..71

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

    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

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

            foreach ($root->getDescendants() as $descendant) {
                $folderController = new FolderController($descendant->id);
                $folderAndPhotoOG = array($folderController);
                $photoOpenGraphs = array();
                $descendant->sort = 'rand';
    Severity: Major
    Found in sources/Controllers/AllTagCollectionsController.php and 1 other location - About 1 hr to fix
    sources/Controllers/MainPageController.php on lines 64..76

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

    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

    Method handleGet has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handleGet($get, $post, $files, $cookies)
        {
            $photoCount = $this->model->getPhotoCount();
            $folderCount = $this->model->getFolderCount();
            $albumCount = $this->model->getTagCount();
    Severity: Minor
    Found in sources/Controllers/SearchController.php - About 1 hr to fix

      Method handleGet has 45 lines of code (exceeds 25 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 1 hr to fix

        Method findChangesOnDisk has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function findChangesOnDisk()
            {
                $retval = array();
        
                $fileStore = FileStore::fileStoreWithName('photo');
        Severity: Minor
        Found in sources/Models/Folder.php - About 1 hr to fix

          Function handleGet has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handleGet($get, $post, $files, $cookies)
              {
                  $nextInstaller = null;
                  if (!Models\Database::installedSchemaIsCorrectVersion()) {
                      $driver = Models\Database::driverName();
          Severity: Minor
          Found in sources/Controllers/SetupUpgradeController.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

          Function handlePost has a Cognitive Complexity of 14 (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/AdminFileStoreController.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

          Function handlePost has a Cognitive Complexity of 14 (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/AdminAppearanceController.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 generateThumbnail has 43 lines of code (exceeds 25 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 1 hr to fix

            Method render has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function render()
                {
                    $start = $this->start;
                    $total = $this->total;
                    $perPage = $this->perPage;
            Severity: Minor
            Found in sources/Views/PageSelectorView.php - About 1 hr to fix

              Method getRelated has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getRelated()
                  {
                      //todo pass in referrer
                      global $_SERVER;
                      $retval = array($this->getFolder());
              Severity: Minor
              Found in sources/Models/Photo.php - About 1 hr to fix

                Method render has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function render()
                    {
                        $message = $this->exception->getMessage();
                
                        echo '<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">';
                Severity: Minor
                Found in sources/Views/ExceptionView.php - About 1 hr to fix

                  Method listFiles has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function listFiles($path = '/', $recursive = true)
                      {
                          $fullpath = $this->baseDir . $path;
                  
                          // FEATURE // add " NOCL" to the end of a folder to exclude it
                  Severity: Minor
                  Found in sources/Models/FileStore.php - About 1 hr to fix

                    Method render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function render()
                        {
                              $gravitarHTML = htmlentities($this->currentUser->gravitarUrl());
                            ?>
                    
                    
                    Severity: Minor
                    Found in sources/Views/NavbarView.php - About 1 hr to fix

                      Method render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function render()
                          {
                              echo "<h2>Review New photos</h2>";
                              
                              $percentDone = 0;
                      Severity: Minor
                      Found in sources/Views/AdminPhotosView.php - About 1 hr to fix

                        Function getMediaURL has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getMediaURL($scale = 'thumbnail')
                            {
                                $bucket = 'other';
                                $path = '';
                                if ($scale == 'photo') {
                        Severity: Minor
                        Found in sources/Models/Photo.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

                        Severity
                        Category
                        Status
                        Source
                        Language