rbnvrw/crispus

View on GitHub

Showing 11 of 11 total issues

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

    public function get(){    
        $aArgs = func_get_args();
        
        $aResult = null;
        foreach($aArgs as $sArg){
Severity: Minor
Found in app/Crispus/Config.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 addToAssetManager has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function addToAssetManager($aAssets){
        // Build asset array
        foreach($aAssets as $sName => $aAssetGroup){        
            foreach($aAssetGroup as $sType => $aFiles){
            
Severity: Minor
Found in app/Crispus/AssetManager.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 getDirectories has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDirectories($sDirectory, $bWithPath = true){
        $aDirs = array();
        
        if(!is_dir($sDirectory)){
            return $aDirs;
Severity: Minor
Found in app/Crispus/Filesystem.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 getFiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFiles($sDirectory, $sExt = '')
    {
        $aFiles = array();
        
        if(!is_dir($sDirectory)){
Severity: Minor
Found in app/Crispus/Filesystem.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 setRootPath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function setRootPath(){        
        if(!isset($this->_aConfig['crispus']['paths']['root'])){
            /* Vendor directory is in the root, step up until we find vendor
             * Limit to 10 levels. */
            $sCurDir = __DIR__;
Severity: Minor
Found in app/Crispus/SiteConfig.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 getJSONError has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getJSONError($iError){
        switch ($iError) {
            case JSON_ERROR_NONE:
                return 'Success';
            break;
Severity: Minor
Found in app/Crispus/Config.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 getAllPagesInDir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllPagesInDir($sPath, $sUrl, $sGlobalConfigFile){        
        $oConfig = new SiteConfig($sGlobalConfigFile);
        $sSortKey = $oConfig->get('site', 'menu', 'sort_by');
        $bAsc = (bool)$oConfig->get('site', 'menu', 'sort_asc');
                
Severity: Minor
Found in app/Crispus/Filesystem.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

Avoid too many return statements within this method.
Open

                return 'Syntax error, malformed JSON';
Severity: Major
Found in app/Crispus/Config.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return 'Malformed UTF-8 characters, possibly incorrectly encoded';
    Severity: Major
    Found in app/Crispus/Config.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return 'Unknown error';
      Severity: Major
      Found in app/Crispus/Config.php - About 30 mins to fix

        Function setPageConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function setPageConfig($aConfig) {
                if(is_array($aConfig)){
                    if(is_array($aConfig)){
                        $this->aPageConfig = array_change_key_case($aConfig, CASE_LOWER);
                    }else{
        Severity: Minor
        Found in app/Crispus/Theme.php - About 25 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