Kylob/BootPress

View on GitHub

Showing 16,700 of 16,700 total issues

Function file has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function file($field, array $options = array())
    {
        $page = Page::html();

        // View
Severity: Minor
Found in src/Upload/Component.php - About 3 hrs 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 loadFileListByEof has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function loadFileListByEof()
    {
        // Check if there's a valid Central Dir signature.
        // Let's consider a file comment smaller than 1024 characters...
        // Actually, it length can be 65536.. But we're not going to support it.
Severity: Major
Found in src/Unzip/Component.php - About 3 hrs to fix

    Method listUsers has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function listUsers($view)
        {
            extract(Admin::params('bp', 'page', 'auth', 'website'));
            $page->title = 'View Users at '.$website;
            $html = '';
    Severity: Major
    Found in src/Admin/Pages/Users.php - About 3 hrs to fix

      Method page has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function page()
          {
              $page = Page::html();
              $get = $page->request->query->all();
              if ($page->get('adminer') == 'css') {
      Severity: Major
      Found in src/Admin/Pages/Databases.php - About 3 hrs to fix

        Function exec has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function exec($action, $table, $values = null)
            {
                $action = strtolower($action);
                if (!isset(self::$stmt[$action][$table])) {
                    switch ($action) {
        Severity: Minor
        Found in src/Analytics/Component.php - About 3 hrs 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 process has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function process()
            {
                $page = Page::html();
                $file = $page->file('analytics.csv');
                $temp = $page->file('analytics-temp.csv');
        Severity: Minor
        Found in src/Analytics/Component.php - About 3 hrs 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 page has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function page()
            {
                extract(Admin::params('bp', 'page'));
                $html = '';
        
        
        Severity: Minor
        Found in src/Admin/Pages/Code.php - About 3 hrs 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 setup has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function setup(Auth $auth, Blog $blog, array $map)
            {
                $html = '';
                if (!isset(static::$version['bootstrap'])) {
                    return $html;
        Severity: Major
        Found in src/Admin/Component.php - About 3 hrs to fix

          Function visitors has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              private function visitors()
              {
                  extract(Admin::params('bp', 'website', 'page', 'path', 'admin'));
                  $page->title = 'Visitors at '.$website;
                  $html = '';
          Severity: Minor
          Found in src/Admin/Pages/Analytics.php - About 2 hrs 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 __call has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __call($method, $arguments)
              {
                  switch ($method) {
                      case 'start':
                          if (self::$debugbar->hasCollector('time')) {
          Severity: Minor
          Found in src/DebugBar/Component.php - About 2 hrs 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 startStop has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              private function startStop($count, $range, $label = 'Y-m-d H:i:s', array $values = array())
              {
                  $array = array();
                  $range = substr($range, 0, 3);
                  if (in_array($range, array('sec', 'min', 'hou', 'day', 'wee', 'mon', 'yea'))) {
          Severity: Minor
          Found in src/Admin/Pages/Analytics.php - About 2 hrs 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 page has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function page()
              {
                  extract(Admin::params('bp', 'page'));
                  $html = '';
          
          
          Severity: Major
          Found in src/Admin/Pages/Code.php - About 2 hrs to fix

            Method save has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function save(array $files, array $remove = array())
                {
                    $page = Page::html();
                    if (($retrieve = $page->post('retrieve')) && isset($files[$retrieve])) {
                        exit(is_file($files[$retrieve]) ? file_get_contents($files[$retrieve]) : '');
            Severity: Major
            Found in src/Admin/Files.php - About 2 hrs to fix

              Method database has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function database()
                  {
                      $page = Page::html();
                      $db = new SQLite($page->file('Analytics.db'));
                      if ($db->created || version_compare(self::VERSION, $db->settings('version'), '>')) {
              Severity: Major
              Found in src/Analytics/Component.php - About 2 hrs to fix

                Function display_wyciwyg has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                function display_wyciwyg (classes, data, retrieve, file, line, col) {
                    acefile.compare = data;
                    $("#toolbar div.file").text(file);
                    $("#toolbar div.status").hide();
                    if (classes.hasClass("noMarkup")) {
                Severity: Minor
                Found in src/Admin/Pages/admin/wyciwyg.js - About 2 hrs 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 collect has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function collect()
                    {
                        // return array();
                
                        $responseHeaders = $this->response->headers->all();
                Severity: Major
                Found in src/DebugBar/Collector/BootPress.php - About 2 hrs to fix

                  Method exec has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function exec($action, $table, $values = null)
                      {
                          $action = strtolower($action);
                          if (!isset(self::$stmt[$action][$table])) {
                              switch ($action) {
                  Severity: Major
                  Found in src/Analytics/Component.php - About 2 hrs to fix

                    Method wyciwyg has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function wyciwyg()
                        {
                            extract(self::params('bp', 'page', 'plugin'));
                            $html = "\n\n".<<<EOT
                    <div id="wyciwyg" style="display:none; width:100%; padding:0 10px;">
                    Severity: Major
                    Found in src/Admin/Component.php - About 2 hrs to fix

                      Function display_wyciwyg has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function display_wyciwyg (classes, data, retrieve, file, line, col) {
                          acefile.compare = data;
                          $("#toolbar div.file").text(file);
                          $("#toolbar div.status").hide();
                          if (classes.hasClass("noMarkup")) {
                      Severity: Major
                      Found in src/Admin/Pages/admin/wyciwyg.js - About 2 hrs to fix

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

                                foreach ($this->startStop(180, 'minute', 'Y-m-d H:i:s') as $x => $info) { // D M j
                                    list($start, $stop) = $info;
                                    $this->db->execute($stmt, array($start, $stop));
                                    list($loaded, $server) = $this->db->fetch($stmt);
                                    $data[] = '{x:"'.$x.'", loaded:'.round($loaded, 2).', server:'.round($server, 2).'}';
                        Severity: Major
                        Found in src/Admin/Pages/Analytics.php and 2 other locations - About 2 hrs to fix
                        src/Admin/Pages/Analytics.php on lines 725..730
                        src/Admin/Pages/Analytics.php on lines 754..759

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language