qcminecraft/Carbon-Forum-F

View on GitHub

Showing 851 of 851 total issues

Function preSend has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function preSend()
    {
        try {
            $this->error_count = 0; // Reset errors
            $this->mailHeader = '';
Severity: Minor
Found in library/PHPMailer.class.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

File new.function.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Carbon-Forum-F
 * https://github.com/lincanbin/Carbon-Forum
 *
 * Copyright 2006-2017 Canbin Lin (lincanbin@hotmail.com)
Severity: Minor
Found in static/js/default/new.function.js - About 3 hrs to fix

    Function InitEditor has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function InitEditor() {
        //Initialize editor
        UE.delEditor('editor');
        window.UEDITOR_CONFIG['textarea'] = 'Content';
        window.UEDITOR_CONFIG['elementPathEnabled'] = false;
    Severity: Major
    Found in static/js/default/topic.function.js - About 3 hrs to fix

      File index.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <meta charset="utf-8">
      
      <?php
      @set_time_limit(0);
      date_default_timezone_set('Asia/Shanghai');
      Severity: Minor
      Found in install/index.php - About 3 hrs to fix

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

                    uploader.on('uploadProgress', function (file, percentage) {
                        var $li = $('#' + file.id),
                            $percent = $li.find('.progress span');
        
                        $percent.css('width', percentage * 100 + '%');
        Severity: Major
        Found in static/editor/dialogs/video/video.js and 2 other locations - About 3 hrs to fix
        static/editor/dialogs/attachment/attachment.js on lines 491..498
        static/editor/dialogs/image/image.js on lines 706..713

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

        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

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

                    uploader.on('uploadProgress', function (file, percentage) {
                        var $li = $('#' + file.id),
                            $percent = $li.find('.progress span');
        
                        $percent.css('width', percentage * 100 + '%');
        Severity: Major
        Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 3 hrs to fix
        static/editor/dialogs/image/image.js on lines 706..713
        static/editor/dialogs/video/video.js on lines 717..724

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

        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

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

                    uploader.on('uploadProgress', function (file, percentage) {
                        var $li = $('#' + file.id),
                            $percent = $li.find('.progress span');
        
                        $percent.css('width', percentage * 100 + '%');
        Severity: Major
        Found in static/editor/dialogs/image/image.js and 2 other locations - About 3 hrs to fix
        static/editor/dialogs/attachment/attachment.js on lines 491..498
        static/editor/dialogs/video/video.js on lines 717..724

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

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

            public function wrapText($message, $length, $qp_mode = false)
            {
                if ($qp_mode) {
                    $soft_break = sprintf(' =%s', $this->LE);
                } else {
        Severity: Major
        Found in library/PHPMailer.class.php - About 3 hrs to fix

          Function onMouseDown has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function onMouseDown(e) {
                      setShift(e.shiftKey);
                      // Check whether this is a click in a widget
                      for (var n = e_target(e); n != wrapper; n = n.parentNode)
                          if (n.parentNode == code && n != mover) return;
          Severity: Major
          Found in static/editor/third-party/codemirror/codemirror.js - About 3 hrs to fix

            Manage has 26 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Manage
            {
                private $id;
                private $action;
                private $db;
            Severity: Minor
            Found in controller/manage.php - About 3 hrs to fix

              Method AlertMsg has 75 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function AlertMsg($PageTitle, $Error, $StatusCode = 200)
              {
                  global $Lang, $CurProtocol, $RequestURI, $UrlPath, $IsAjax, $IsMobile, $IsApp, $DB, $Config, $HotTagsArray, $CurUserID, $CurUserName, $CurUserCode, $CurUserRole, $CurUserInfo, $FormHash, $StartTime, $PageMetaKeyword, $TemplatePath;
                  $HttpStatuses = [
                      100 => 'Continue',
              Severity: Major
              Found in common.php - About 3 hrs to fix

                Function fileUploader has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                baidu.flash.fileUploader = baidu.flash.fileUploader || function(options){
                    var me = this,
                        options = options || {};
                    
                    options.createOptions = baidu.extend({
                Severity: Major
                Found in static/editor/dialogs/wordimage/tangram.js - About 2 hrs to fix

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

                  function AutoTest($Method, $View, $URL, $Parameters = [], $ExpectedStatusCode = 200, $Callback = null)
                  {
                      global $APISignature, $Passed, $Failed;
                      $Pass = true;
                      echo "\n\033[33m --------$Method  $URL expect $ExpectedStatusCode-------- \033[0m\n\n";
                  Severity: Minor
                  Found in test.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 Pagination has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function Pagination($PageUrl, $CurrentPage, $TotalPage)
                  {
                      if ($TotalPage <= 1)
                          return false;
                      global $Config, $Lang;
                  Severity: Minor
                  Found in view/default/layout.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

                  File statistics.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  if (!defined('InternalAccess')) exit('error: 403 Access Denied');
                  ?>
                  <!-- main-content start -->
                  <script type="text/javascript">
                  Severity: Minor
                  Found in view/default/statistics.php - About 2 hrs to fix

                    Function _addBoardListener has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            _addBoardListener:function (saveNum) {
                                var me = this,
                                    margin = 0,
                                    startX = -1,
                                    startY = -1,
                    Severity: Major
                    Found in static/editor/dialogs/scrawl/scrawl.js - About 2 hrs to fix

                      Method createHeader has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function createHeader()
                          {
                              $result = '';
                      
                              if ($this->MessageDate == '') {
                      Severity: Major
                      Found in library/PHPMailer.class.php - About 2 hrs to fix

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

                                if(window.localStorage){
                                    var NotificationTime = localStorage.getItem(Prefix + "NotificationTime");
                                    if(NotificationTime){
                                        //如果距离上次弹出时间大于30s,才允许弹出通知
                                        EnableNotification = (Math.round(new Date().getTime()/1000)-parseInt(NotificationTime))>30;
                        Severity: Major
                        Found in static/js/mobile/global.js and 1 other location - About 2 hrs to fix
                        static/js/default/global.js on lines 334..341

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

                        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

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

                                if(window.localStorage){
                                    var NotificationTime = localStorage.getItem(Prefix + "NotificationTime");
                                    if(NotificationTime){
                                        //如果距离上次弹出时间大于30s,才允许弹出通知
                                        EnableNotification = (Math.round(new Date().getTime()/1000)-parseInt(NotificationTime))>30;
                        Severity: Major
                        Found in static/js/default/global.js and 1 other location - About 2 hrs to fix
                        static/js/mobile/global.js on lines 245..252

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

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

                            public function preSend()
                            {
                                try {
                                    $this->error_count = 0; // Reset errors
                                    $this->mailHeader = '';
                        Severity: Major
                        Found in library/PHPMailer.class.php - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language