Kylob/BootPress

View on GitHub

Showing 16,700 of 16,700 total issues

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

    private static function restore()
    {
        extract(Admin::params('bp', 'page', 'blog', 'website'));
        $page->title = 'Restore Blog at '.$website;
        $html = '';
Severity: Minor
Found in src/Admin/Pages/Blog.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 debugbar has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    function debugbar($action, $params = null)
    {
        static $debugbar = null;
        $params = func_get_args();
        $action = (string) array_shift($params);
Severity: Minor
Found in src/DebugBar/function.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 setup has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setup($auth, $path)
    {
        if (!$auth->isAdmin(2)) {
            return false;
        }
Severity: Minor
Found in src/Admin/Pages/Blog.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

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

        this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px");
Severity: Major
Found in src/Admin/Pages/admin/wyciwyg.js and 1 other location - About 1 hr to fix
src/Admin/Pages/admin/wyciwyg.js on lines 190..190

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

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 setup has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function setup($auth, $path)
    {
        if (!$auth->isAdmin(2)) {
            return false;
        }
Severity: Minor
Found in src/Admin/Pages/Blog.php - About 1 hr to fix

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

        private static function create()
        {
            $html = '';
            extract(Admin::params('bp', 'page', 'blog'));
            $form = $bp->form('admin_theme_create');
    Severity: Minor
    Found in src/Admin/Pages/Themes.php - About 1 hr to fix

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

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

            private static function ids(array $ids, array $snippets = array())
            {
                $html = '';
                extract(Admin::params(array('bp', 'blog', 'page')));
                foreach ($blog->info($ids) as $id => $row) {
        Severity: Minor
        Found in src/Admin/Pages/Blog.php - About 1 hr to fix

          Function id has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function id($table, $value, array $insert = array())
              {
                  settype($value, 'string');
                  if (isset(self::$ids[$table][$value])) {
                      return self::$ids[$table][$value];
          Severity: Minor
          Found in src/Analytics/Component.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 loadFileListByEof has a Cognitive Complexity of 13 (exceeds 5 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: Minor
          Found in src/Unzip/Component.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 page has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function page()
              {
                  extract(Admin::params('bp', 'blog', 'auth', 'page', 'admin', 'path', 'method'));
                  if ($method) {
                      switch ($method) {
          Severity: Minor
          Found in src/Admin/Pages/Blog.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 signIn has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function signIn()
              {
                  extract(Admin::params('bp', 'page', 'auth', 'path'));
                  $page->title = 'Sign In for Admin Users';
                  $html = '';
          Severity: Minor
          Found in src/Admin/Pages/Users.php - About 1 hr to fix

            Method debugbar has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function debugbar($action, $params = null)
                {
                    static $debugbar = null;
                    $params = func_get_args();
                    $action = (string) array_shift($params);
            Severity: Minor
            Found in src/DebugBar/function.php - About 1 hr to fix

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

                  public static function page()
                  {
                      extract(Admin::params('page', 'blog', 'bp'));
                      if ($edit = $page->get('edit')) {
                          // enforce only one folder path ie. no subfolders
              Severity: Minor
              Found in src/Admin/Pages/Themes.php - About 1 hr to fix

                Method collect has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function collect()
                    {
                        $logs = array(
                            'nb_databases' => 0,
                            'nb_statements' => 0,
                Severity: Minor
                Found in src/DebugBar/Collector/Queries.php - About 1 hr to fix

                  Method timeRange has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function timeRange($time, $range, $label = '')
                      {
                          // H - hour - 00 to 23
                          // i - minute - 00 to 59
                          // s - second - 00 to 59
                  Severity: Minor
                  Found in src/Admin/Pages/Analytics.php - About 1 hr to fix

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

                        public static function page()
                        {
                            extract(Admin::params('bp', 'page', 'auth', 'path', 'method'));
                            switch ($method) {
                                case 'logout':
                    Severity: Minor
                    Found in src/Admin/Pages/Users.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 getCookieHeader has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function getCookieHeader($name, $value, $expires, $path, $domain, $secure, $httponly)
                        {
                            $cookie = sprintf('%s=%s', $name, urlencode($value));
                    
                            if (0 !== $expires) {
                    Severity: Minor
                    Found in src/DebugBar/Collector/BootPress.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 registerUser has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function registerUser()
                        {
                            extract(Admin::params('bp', 'page', 'auth', 'path', 'website'));
                            $page->title = 'Register User at '.$website;
                            $html = '';
                    Severity: Minor
                    Found in src/Admin/Pages/Users.php - About 1 hr to fix

                      Method collect has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function collect()
                          {
                              $time = DebugBar::$debugbar->hasCollector('time') ? DebugBar::$debugbar['time'] : false;
                              $templates = Theme::$templates;
                              $data = array(
                      Severity: Minor
                      Found in src/DebugBar/Collector/Twig.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language