piotrpolak/pepiscms

View on GitHub

Showing 481 of 486 total issues

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

    public function onAuthRequest()
    {
        parse_str(substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1), $_GET);
        $this->_init();
        phpCAS::forceAuthentication();
Severity: Minor
Found in pepiscms/application/drivers/auth/CasAuthDriver.php - About 1 hr to fix

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

        public function runModule($module_name, $method)
        {
            $this->load->model('Module_model');
            if (!$module_name || !self::isModuleInstalled($module_name)) {
                return false;
    Severity: Minor
    Found in pepiscms/application/libraries/ModuleRunner.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 describeClass has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function describeClass($class, $must_be_declaring = true)
        {
            $ignored_methods = array(
                'ModuleAdminController',
                'getPrivileges',
    Severity: Minor
    Found in pepiscms/application/libraries/SecurityPolicy.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 execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute($baseDir, $currentRelativePath, $input)
        {
            $files = $this->getFiles($input);
    
            foreach ($files as $file) {

    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 index has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function index()
        {
            /* Getting module name from class name */
            $module_name = strtolower(str_replace('Admin', '', __CLASS__));
    
    

    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 renderReadOnlyComponent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function renderReadOnlyComponent($field, $value, $valueEscaped, &$object)
        {
            $output_element = '';
            if (is_array($valueEscaped)) {
                // Multiple select etc

    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 _fb_format_title_and_modify_option has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _fb_format_title_and_modify_option($content, $line)
        {
            $this->removeMetaActions();
            if ($line->status == 0) {
                $this->setEditable(false);
    Severity: Minor
    Found in pepiscms/modules/cms_users/controllers/Cms_usersAdmin.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 cleanPagesCache has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function cleanPagesCache()
        {
            $return = array('size' => 0, 'count' => 0);
    
            $cache_path = $this->config->item('cache_path');
    Severity: Minor
    Found in pepiscms/modules/pages/models/Page_model.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 makeConfigurationTestsAngGetErrors has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function makeConfigurationTestsAngGetErrors()
        {
            $cache_path = $this->config->item('cache_path');
            $cache_path = ($cache_path === '') ? 'application/cache/' : $cache_path;
            if ($cache_path[0] !== '/') {
    Severity: Minor
    Found in pepiscms/application/models/Siteconfig_model.php - About 1 hr to fix

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

          public static function error($message, $collection = 'SYSTEM', $resource_id = false, $notify = true)
          {
              if ($notify && self::$config->item('debug_maintainer_email_address')) {
                  $hash = md5($message . '' . $collection);
                  $path = INSTALLATIONPATH . 'application/cache/errors/';
      Severity: Minor
      Found in pepiscms/application/libraries/Logger.php - About 1 hr to fix

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

            protected function journalingPersistPreSave($id, $data)
            {
                if (!$id || !$this->getJournalingIsEnabled()) {
                    return false;
                }
        Severity: Minor
        Found in pepiscms/application/models/Generic_model.php - About 1 hr to fix

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

              public function index()
              {
                  if (ENVIRONMENT !== 'development') {
                      show_error('Upgradedb utility is only available in development environment. <a href="' . admin_url() . '">Go back to admin panel</a>');
          
          
          Severity: Minor
          Found in pepiscms/application/controllers/admin/Upgradedb.php - About 1 hr to fix

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

                public function drawSimpleLineChart($data_feed, $collumn1_desc = '', $collumn2_desc = '', $width = 1200, $height = 200, $max_value = 10, $column1_data_type = "string", $column2_datatype = "number", $colors = array(), $type = 'number')
                {
                    $id = $this->generateId('line_chart');
            
                    $out = $this->includeJavaScripts();
            Severity: Minor
            Found in pepiscms/application/libraries/Google_chart_helper.php - About 1 hr to fix

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

                  public function logs()
                  {
                      $logFile = $this->symfony2_bridge->getKernel()->getLogDir() . '/';
                      if (!$logFile) {
                          show_error(sprintf($this->lang->line('symfony2_bridge_log_file_does_not_exist'), $logFile));

                Consider simplifying this complex logical expression.
                Open

                                if (strpos($field_name, 'color') !== false || strpos($field_name, 'colour') !== false) {
                                    $input_type = FormBuilder::COLORPICKER;
                                } elseif (strpos($field_name, 'path') !== false || strpos($field_name, 'image') !== false || strpos($field_name, 'file') !== false || strpos($field_name, 'icon') !== false || strpos($field_name, 'logo') !== false || strpos($field_name, 'baner') !== false || strpos($field_name, 'thumb') !== false || strpos($field_name, 'img') !== false) {
                                    $input_type = FormBuilder::FILE;
                                    $definition[$field_name]['upload_path'] = 'uploads/';
                Severity: Critical
                Found in pepiscms/modules/crud/libraries/TableUtility.php - About 1 hr to fix

                  Method addColumnByDefinition has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function addColumnByDefinition($column, $key = false)
                      {
                          $defaults = $this->getFieldDefaults();
                          if (!isset($column['filter_condition']) && isset($column['filter_type'])) {
                              $defaults['filter_condition'] = $this->getDefaultFilterConditionByFilterType($column['filter_type']);
                  Severity: Minor
                  Found in pepiscms/application/libraries/DataGrid.php - About 1 hr to fix

                    Method parseExcel has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function parseExcel($path, $first_row_as_keys = true, $normalize_keys = true)
                        {
                            if (!$this->isFullyEnabled()) {
                                throw new \RuntimeException("PhpSpreadsheet is not enabled. Please refer to README.md");
                            }
                    Severity: Minor
                    Found in pepiscms/application/libraries/Spreadsheet.php - About 1 hr to fix

                      Method installed_modules has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function installed_modules()
                          {
                              $this->formbuilder->setTitle($this->lang->line('installer_installed_modules'));
                              $that = $this;
                              $this->formbuilder->setCallback(function ($data_array) use ($that) {
                      Severity: Minor
                      Found in pepiscms/application/controllers/admin/Installer.php - About 1 hr to fix

                        Method index has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function index()
                            {
                                /* Getting module name from class name */
                                $module_name = strtolower(str_replace('Admin', '', __CLASS__));
                        
                        

                          Method prepareReplacementTokens has 13 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              private function prepareReplacementTokens($module_database_table_name,
                                                                        $module_name,
                                                                        $module_label,
                                                                        $module_name_singular,
                                                                        $definition_output,
                          Severity: Major
                          Found in pepiscms/modules/development/libraries/ModuleGenerator.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language