fulldecent/cameralife

View on GitHub

Showing 110 of 127 total issues

Function getFileForPhotoWithScale has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getFileForPhotoWithScale(Models\Photo $photo, $scale)
    {
        $extension = $photo->extension;
        $bucket = 'other';
        $path = '';
Severity: Minor
Found in sources/Controllers/MediaController.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 handleGet has a Cognitive Complexity of 11 (exceeds 5 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

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 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function render()
    {
        if (!count($this->openGraphsForTop)) {
        ?>
            </div>
Severity: Minor
Found in sources/Views/MainPageView.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 handleGet has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleGet($get, $post, $files, $cookies)
    {
        $photo = Models\Photo::getPhotoWithID($get['id']);
        $scale = isset($get['scale']) ? $get['scale'] : null;
        $extension = $photo->extension;
Severity: Minor
Found in sources/Controllers/MediaController.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 getDefaultForRecordTypeAndValueField has 31 lines of code (exceeds 25 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 1 hr to fix

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

        public function getFunFacts()
        {
            if (empty($this->counts)) {
                $this->getCounts();
            }
    Severity: Minor
    Found in sources/Models/Statistics.php - About 1 hr to fix

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

          public function render()
          {
              ?>
              <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
              <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
      Severity: Minor
      Found in sources/Views/FooterView.php - About 1 hr to fix

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

            public static function setupTables()
            {
                empty(self::$pdoConnection) && self::connect();
                $prefix = self::$prefix;
        
        
        Severity: Minor
        Found in sources/Models/Database.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 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 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

          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

            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 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/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

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

              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

                Severity
                Category
                Status
                Source
                Language