qcminecraft/Carbon-Forum-F

View on GitHub

Showing 851 of 851 total issues

Function setState has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function setState(val, files) {

                if (val != state) {

                    var stats = uploader.getStats();
Severity: Major
Found in static/editor/dialogs/video/video.js - About 2 hrs to fix

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

        function Brush()
        {
            function getKeywordsCSS(str)
            {
                return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
    Severity: Major
    Found in static/editor/third-party/SyntaxHighlighter/shCore.js - About 2 hrs to fix

      Function setState has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  function setState(val, files) {
      
                      if (val != state) {
      
                          var stats = uploader.getStats();
      Severity: Major
      Found in static/editor/dialogs/image/image.js - About 2 hrs to fix

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

                    if (rect[dir][3] != 0) {
                        tmp = dom.clientHeight + rect[dir][3] * offset.y;
                        dom.style.height = me._validScaledProp('height', tmp) + 'px';
                    }
        Severity: Major
        Found in static/editor/dialogs/scrawl/scrawl.js and 1 other location - About 2 hrs to fix
        static/editor/dialogs/scrawl/scrawl.js on lines 528..531

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

        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 (rect[dir][2] != 0) {
                        tmp = dom.clientWidth + rect[dir][2] * offset.x;
                        dom.style.width = me._validScaledProp('width', tmp) + 'px';
                    }
        Severity: Major
        Found in static/editor/dialogs/scrawl/scrawl.js and 1 other location - About 2 hrs to fix
        static/editor/dialogs/scrawl/scrawl.js on lines 532..535

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

        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

        File new.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        require(LanguagePath . 'new.php');
        require (LibraryPath . 'Geetestlib.class.php');
        Auth(1, 0, true);
        
        
        Severity: Minor
        Found in controller/new.php - About 2 hrs to fix

          Method CreateMessage has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function CreateMessage($DialogInfo, $Content)
          {
              global $DB, $CurUserID, $TimeStamp;
              if (empty($CurUserID) || empty($DialogInfo) || empty($Content)) {
                  return false;
          Severity: Major
          Found in service/inbox.php - About 2 hrs to fix

            Function CreateNewTopic has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function CreateNewTopic() {
                if (!document.NewForm.Title.value.length) {
                    alert(Lang['Title_Can_Not_Be_Empty']);
                    document.NewForm.Title.focus();
                    return false;
            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 searchLike has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function searchLike( $pKeywords, $index='*', $pStart = 0, 
                                        $pSize=12, $filter = '', $sort = '', $columns=array("ID") ) {
                    self::getSingle();
                    $sp = self::$sphinx;
                    empty( $sort ) || $sp->SetSortMode ( SPH_SORT_EXTENDED, $sort );
            Severity: Minor
            Found in library/SearchClient.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

            Function saveRemote has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                private function saveRemote()
                {
                    $imgUrl = htmlspecialchars($this->fileField);
                    $imgUrl = str_replace("&amp;", "&", $imgUrl);
                    
            Severity: Minor
            Found in library/Uploader.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

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

                function Brush()
                {
                    function getKeywordsCSS(str)
                    {
                        return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
            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

                              case 'upload':
                                  list = uploadFile.getInsertList();
                                  var count = uploadFile.getQueueCount();
                                  if (count) {
                                      $('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>');
              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 89..96

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

              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

                  me.setFileType = function(type){
                      var type = type || [[]];
                      
                      if(type instanceof Array) type = [type];
                      else type = [[type]];
              Severity: Major
              Found in static/editor/dialogs/wordimage/tangram.js and 1 other location - About 2 hrs to fix
              static/editor/dialogs/wordimage/tangram.js on lines 978..984

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

              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

                              case 'upload':
                                  list = uploadImage.getInsertList();
                                  var count = uploadImage.getQueueCount();
                                  if (count) {
                                      $('.info', '#queueList').html('<span style="color:red;">' + '还有2个未上传文件'.replace(/[\d]/, count) + '</span>');
              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 68..75

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

              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

                  me.addFileType = function(type){
                      var type = type || [[]];
                      
                      if(type instanceof Array) type = [type];
                      else type = [[type]];
              Severity: Major
              Found in static/editor/dialogs/wordimage/tangram.js and 1 other location - About 2 hrs to fix
              static/editor/dialogs/wordimage/tangram.js on lines 992..998

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

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

                  function Brush()
                  {
                      var funcs    =    'abs acos acosh addcslashes addslashes ' +
                                      'array_change_key_case array_chunk array_combine array_count_values array_diff '+
                                      'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
              Severity: Major
              Found in static/editor/third-party/SyntaxHighlighter/shCore.js - About 2 hrs to fix

                Method _deep_analysis_cn has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function _deep_analysis_cn(&$str, $lastec, $spos, $slen, $optimize = true)
                    {
                        $quote1 = chr(0x20) . chr(0x1C);
                        $tmparr = array();
                        $hasw   = 0;
                Severity: Major
                Found in library/PHPAnalysis.class.php - About 2 hrs to fix

                  Method AddingNotifications has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function AddingNotifications($Content, $TopicID, $PostID, $FilterUser = '')
                  {
                      /*
                      Type:
                      1:新回复
                  Severity: Minor
                  Found in common.php - About 2 hrs to fix

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

                            document.title = '(' + Lang['New_Message'].replace('{{NewMessage}}', NewMessageNumber) + ')' + document.title.replace(new RegExp(('\\(' + Lang['New_Message'] + '\\)').replace('{{NewMessage}}', '\\d+'), "g"), '');
                    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 241..241

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

                    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

                        xAxis: {
                            gridLineColor: '#333333',
                            gridLineWidth: 1,
                            labels: {
                                style: {
                    Severity: Major
                    Found in static/editor/third-party/highcharts/themes/dark-blue.js and 1 other location - About 2 hrs to fix
                    static/editor/third-party/highcharts/themes/dark-green.js on lines 36..55

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

                    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