qcminecraft/Carbon-Forum-F

View on GitHub

Showing 506 of 851 total issues

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

    private function saveRemote()
    {
        $imgUrl = htmlspecialchars($this->fileField);
        $imgUrl = str_replace("&", "&", $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

    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

          Method MakeDict has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function MakeDict($source_file, $target_file = '')
              {
                  $target_file = ($target_file == '' ? $this->mainDicFile : $target_file);
                  $allk        = array();
                  $fp          = fopen($source_file, 'r');
          Severity: Minor
          Found in library/PHPAnalysis.class.php - About 1 hr to fix

            Function InitNewTopicEditor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function InitNewTopicEditor() {
                UE.delEditor('editor');
                //Initialize editor
                //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
                window.UEDITOR_CONFIG['textarea'] = 'Content';
            Severity: Minor
            Found in static/js/default/new.function.js - 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 createTab has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function createTab( tabName ) {
                var faceVersion = "?v=1.1", //版本号
                        tab = $G( tabName ), //获取将要生成的Div句柄
                        imagePath = emotion.SmileyPath + emotion.imageFolders[tabName], //获取显示表情和预览表情的路径
                        positionLine = 11 / 2, //中间数
            Severity: Minor
            Found in static/editor/dialogs/emotion/emotion.js - 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 cleanAttrValue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                private function cleanAttrValue(DOMAttr $domAttr)
                {
                    $attrName = strtolower($domAttr->name);
                    if ($attrName === 'style' && !empty($this->config->WhiteListStyle)) {
                        $styles = explode(';', $domAttr->value);
            Severity: Minor
            Found in library/WhiteHTMLFilter.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 translate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function translate(&$ChineseLang, &$CurrentLang, &$CompareFlag, $language_name)
            {
                $diff = array_diff_key($ChineseLang, $CurrentLang);
                if (!empty($diff)) {
                    if ($CompareFlag === false) {
            Severity: Minor
            Found in language/auto_translate.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 ReplyToTopic has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function ReplyToTopic() {
                if (!UE.getEditor('editor').getContent().length) {
                    alert(Lang['Content_Empty']);
                    UE.getEditor('editor').focus();
                } else {
            Severity: Minor
            Found in static/js/default/topic.function.js - About 1 hr to fix

              Method _deep_analysis has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function _deep_analysis(&$str, $ctype, $spos, $optimize = true)
                  {
                      
                      //中文句子
                      if ($ctype == 1) {
              Severity: Minor
              Found in library/PHPAnalysis.class.php - About 1 hr to fix

                Method upFile has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function upFile()
                    {
                        $file = $this->file = $_FILES[$this->fileField];
                        if (!$file) {
                            $this->stateInfo = $this->getStateInfo("ERROR_FILE_NOT_FOUND");
                Severity: Minor
                Found in library/Uploader.class.php - About 1 hr to fix

                  Function callByServer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  baidu.sio.callByServer = /**@function*/function(url, callback, opt_options) {
                      var scr = document.createElement('SCRIPT'),
                          prefix = 'bd__cbs__',
                          callbackName,
                          callbackImpl,
                  Severity: Minor
                  Found in static/editor/dialogs/wordimage/tangram.js - About 1 hr to fix

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

                        function Brush()
                        {
                            // Contributed by David Simmons-Duffin and Marty Kube
                        
                            var funcs = 
                    Severity: Minor
                    Found in static/editor/third-party/SyntaxHighlighter/shCore.js - About 1 hr to fix

                      Function jsTokenBase has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function jsTokenBase(stream, state) {
                              var ch = stream.next();
                              if (ch == '"' || ch == "'")
                                  return chain(stream, state, jsTokenString(ch));
                              else if (/[\[\]{}\(\),;\:\.]/.test(ch))
                      Severity: Minor
                      Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

                        Method __construct has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function __construct($Char, $AvatarSize = 256)
                            {
                                $this->Char = strtoupper(mb_substr($Char, 0, 1, "UTF-8"));
                                $this->AvatarSize = $AvatarSize;
                                $this->Padding = 30*($this->AvatarSize/256);
                        Severity: Minor
                        Found in library/MaterialDesign.Avatars.class.php - About 1 hr to fix

                          Method GetInboxID has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function GetInboxID($ReceiverName)
                          {
                              global $DB, $CurUserID, $CurUserName, $TimeStamp;
                              if (empty($CurUserID) || empty($ReceiverName)) {
                                  return 0;
                          Severity: Minor
                          Found in service/inbox.php - About 1 hr to fix

                            Method smtpSend has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function smtpSend($header, $body)
                                {
                                    $bad_rcpt = array();
                                    if (!$this->smtpConnect($this->SMTPOptions)) {
                                        throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
                            Severity: Minor
                            Found in library/PHPMailer.class.php - About 1 hr to fix

                              Function ShowNotification has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function ShowNotification(NewMessageNumber) {
                                  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);
                              Severity: Minor
                              Found in static/js/mobile/global.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language