qcminecraft/Carbon-Forum-F

View on GitHub

Showing 851 of 851 total issues

Method connect has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function connect($host, $port = null, $timeout = 30, $options = array())
    {
        static $streamok;
        //This is enabled by default since 5.0.0 but some providers disable it
        //Check this once and cache the result
Severity: Major
Found in library/PHPMailer.smtp.class.php - About 2 hrs to fix

    Function GetTags has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    function GetTags() {
        var CurrentContentHash = md5(document.NewForm.Title.value + UE.getEditor('editor').getContentTxt());
        //取Title与Content 联合Hash值,与之前input的内容比较,不同则开始获取话题,随后保存进hidden input。
        if (CurrentContentHash !== document.NewForm.ContentHash.value) {
            if (document.NewForm.Title.value.length || UE.getEditor('editor').getContentTxt().length) {
    Severity: Minor
    Found in static/js/default/new.function.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

    Function GetTags has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    function GetTags() {
        var CurrentContentHash = md5(document.NewForm.Title.value + document.NewForm.Content.value);
        //取Title与Content 联合Hash值,与之前input的内容比较,不同则开始获取话题,随后保存进hidden input。
        if (CurrentContentHash != document.NewForm.ContentHash.value) {
            if (document.NewForm.Title.value.length || document.NewForm.Content.value.length) {
    Severity: Minor
    Found in static/js/mobile/topic.function.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 AutoTest has 64 lines of code (exceeds 25 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: Major
    Found in test.php - About 2 hrs to fix

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

                  doneCallback: function() {
                      TargetTag.innerText = "Loading";
                      var CallbackObj = new ManageCallback(TargetTag);
                      $.ajax({
                          url: WebsitePath + "/manage",
      Severity: Major
      Found in static/js/mobile/global.js and 1 other location - About 2 hrs to fix
      static/js/mobile/global.js on lines 357..371

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

      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 2 locations. Consider refactoring.
      Open

          }else{
              TargetTag.innerText = "Loading";
              var CallbackObj = new ManageCallback(TargetTag);
              $.ajax({
                  url: WebsitePath + "/manage",
      Severity: Major
      Found in static/js/mobile/global.js and 1 other location - About 2 hrs to fix
      static/js/mobile/global.js on lines 340..354

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

      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 2 locations. Consider refactoring.
      Open

                          if ($onstr != '') {
                              $this->simpleResult[$s]['w'] = $onstr;
                              if ($lastc == 2) {
                                  if (!preg_match('/' . $notNumberMatch . '/i', iconv(UCS2, 'utf-8', $onstr)))
                                      $lastc = 4;
      Severity: Major
      Found in library/PHPAnalysis.class.php and 1 other location - About 2 hrs to fix
      library/PHPAnalysis.class.php on lines 378..388

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

      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 2 locations. Consider refactoring.
      Open

                          if ($onstr != '') {
                              $this->simpleResult[$s]['w'] = $onstr;
                              if ($lastc == 2) {
                                  if (!preg_match('/' . $notNumberMatch . '/i', iconv(UCS2, 'utf-8', $onstr)))
                                      $lastc = 4;
      Severity: Major
      Found in library/PHPAnalysis.class.php and 1 other location - About 2 hrs to fix
      library/PHPAnalysis.class.php on lines 335..345

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

      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 (NewMessageNumber > 0) {
              document.title = '(' + Lang['New_Message'].replace('{{NewMessage}}', NewMessageNumber) + ')' + document.title.replace(new RegExp(('\\(' + Lang['New_Message'] + '\\)').replace('{{NewMessage}}', '\\d+'), "g"), '');
              $("#MessageNumber").css("visibility", "visible");
              $("#MessageNumber").html(NewMessageNumber);
              var EnableNotification = true;
      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 240..287

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

      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 (NewMessageNumber > 0) {
              document.title = '(' + Lang['New_Message'].replace('{{NewMessage}}', NewMessageNumber) + ')' + document.title.replace(new RegExp(('\\(' + Lang['New_Message'] + '\\)').replace('{{NewMessage}}', '\\d+'), "g"), '');
              $("#MessageNumber").css("visibility", "visible");
              $("#MessageNumber").html(NewMessageNumber);
              var EnableNotification = true;
      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 329..370

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

      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

      Function HtmlScript has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          sh.HtmlScript = function(scriptBrushName)
          {
              var brushClass = findBrush(scriptBrushName),
                  scriptBrush,
                  xmlBrush = new sh.brushes.Xml(),
      Severity: Major
      Found in static/editor/third-party/SyntaxHighlighter/shCore.js - About 2 hrs to fix

        Function replace has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            String.prototype.replace = function (search, replacement) {
                var isRegex = XRegExp.isRegExp(search),
                    captureNames, result, str, origLastIndex;
        
                // There are too many combinations of search/replacement types/values and browser bugs that
        Severity: Major
        Found in static/editor/third-party/SyntaxHighlighter/shCore.js - About 2 hrs to fix

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

                  for (var i = 0; i < tabs.length; i++) {
                      domUtils.on(tabs[i], "click", function (e) {
                          var target = e.target || e.srcElement;
                          setTabFocus(target.getAttribute('data-content-id'));
                      });
          Severity: Major
          Found in static/editor/dialogs/attachment/attachment.js and 1 other location - About 2 hrs to fix
          static/editor/dialogs/image/image.js on lines 24..29

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

          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 2 locations. Consider refactoring.
          Open

                  for (var i = 0; i < tabs.length; i++) {
                      domUtils.on(tabs[i], "click", function (e) {
                          var target = e.target || e.srcElement;
                          setTabFocus(target.getAttribute('data-content-id'));
                      });
          Severity: Major
          Found in static/editor/dialogs/image/image.js and 1 other location - About 2 hrs to fix
          static/editor/dialogs/attachment/attachment.js on lines 21..26

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

          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

          Function Brush has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function Brush()
              {
                  // Contributed by Jen
                  // http://www.jensbits.com/2009/05/14/coldfusion-brush-for-syntaxhighlighter-plus
              
          Severity: Major
          Found in static/editor/third-party/SyntaxHighlighter/shCore.js - About 2 hrs to fix

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

                    switch ($this->Debugoutput) {
                        case 'error_log':
                            //Don't output, just log
                            error_log($str);
                            break;
            Severity: Major
            Found in library/PHPMailer.smtp.class.php and 1 other location - About 2 hrs to fix
            library/PHPMailer.class.php on lines 711..734

            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

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

                    switch ($this->Debugoutput) {
                        case 'error_log':
                            //Don't output, just log
                            error_log($str);
                            break;
            Severity: Major
            Found in library/PHPMailer.class.php and 1 other location - About 2 hrs to fix
            library/PHPMailer.smtp.class.php on lines 212..235

            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

            Function loadMoreMessages has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            function loadMoreMessages(forceToShow) {
                var MessagesList = $("#MessagesList");
                var InboxID = $("#InboxID").val();
                var MessagesPage = $("#MessagesPage");
                var MessagesLoading = $("#MessagesLoading");
            Severity: Minor
            Found in static/js/default/global.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

            Function loadMoreMessages has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            function loadMoreMessages(forceToShow) {
                var MessagesList = $("#MessagesList");
                var InboxID = $("#InboxID").val();
                var MessagesPage = $("#MessagesPage");
                var MessagesLoading = $("#MessagesLoading");
            Severity: Minor
            Found in static/js/mobile/inbox.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

            Function _sort_finally_result has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                private function _sort_finally_result()
                {
                    $newarr = array();
                    $i      = 0;
                    foreach ($this->simpleResult as $k => $v) {
            Severity: Minor
            Found in library/PHPAnalysis.class.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

            Severity
            Category
            Status
            Source
            Language