qcminecraft/Carbon-Forum-F

View on GitHub

Showing 851 of 851 total issues

Function FormatTime has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function FormatTime($UnixTimeStamp)
{
    global $Lang;
    $Seconds = $_SERVER['REQUEST_TIME'] - $UnixTimeStamp;
    if ($Seconds < 2592000) {
Severity: Minor
Found in common.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 data has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function data($msg_data)
    {
        //This will use the standard timelimit
        if (!$this->sendCommand('DATA', 'DATA', 354)) {
            return false;
Severity: Minor
Found in library/PHPMailer.smtp.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 checkIdenticalFiles has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkIdenticalFiles($tempFileName, $inputType)
    {
        if ($this->DB) {
            if ($inputType == 'string') {
                $this->fileMD5  = md5($tempFileName);
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 upFile has a Cognitive Complexity of 20 (exceeds 5 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 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

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

<?php
if (!defined('InternalAccess')) exit('error: 403 Access Denied');
if (empty($Lang) || !is_array($Lang))
    $Lang = array();

Severity: Major
Found in language/en/user.php and 4 other locations - About 2 hrs to fix
language/pl/user.php on lines 1..21
language/ru/user.php on lines 1..21
language/zh-cn/user.php on lines 1..21
language/zh-tw/user.php on lines 1..21

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

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

<?php
if (!defined('InternalAccess')) exit('error: 403 Access Denied');
if (empty($Lang) || !is_array($Lang))
    $Lang = array();

Severity: Major
Found in language/pl/user.php and 4 other locations - About 2 hrs to fix
language/en/user.php on lines 1..21
language/ru/user.php on lines 1..21
language/zh-cn/user.php on lines 1..21
language/zh-tw/user.php on lines 1..21

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

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

<?php
if (!defined('InternalAccess')) exit('error: 403 Access Denied');
if (empty($Lang) || !is_array($Lang))
    $Lang = array();

Severity: Major
Found in language/ru/user.php and 4 other locations - About 2 hrs to fix
language/en/user.php on lines 1..21
language/pl/user.php on lines 1..21
language/zh-cn/user.php on lines 1..21
language/zh-tw/user.php on lines 1..21

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

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

<?php
if (!defined('InternalAccess')) exit('error: 403 Access Denied');
if (empty($Lang) || !is_array($Lang))
    $Lang = array();

Severity: Major
Found in language/zh-cn/user.php and 4 other locations - About 2 hrs to fix
language/en/user.php on lines 1..21
language/pl/user.php on lines 1..21
language/ru/user.php on lines 1..21
language/zh-tw/user.php on lines 1..21

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

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

<?php
if (!defined('InternalAccess')) exit('error: 403 Access Denied');
if (empty($Lang) || !is_array($Lang))
    $Lang = array();

Severity: Major
Found in language/zh-tw/user.php and 4 other locations - About 2 hrs to fix
language/en/user.php on lines 1..21
language/pl/user.php on lines 1..21
language/ru/user.php on lines 1..21
language/zh-cn/user.php on lines 1..21

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

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

function RenderTopic() {
    //强制所有链接在新窗口中打开
    var AllPosts = document.getElementsByClassName("comment-content");
    PostContentLists = {};//Global
    AllPosts[AllPosts.length] = document.getElementsByClassName("topic-content")[0];
Severity: Major
Found in static/js/default/topic.function.js - About 2 hrs to fix

    Method DKIM_Add has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function DKIM_Add($headers_line, $subject, $body)
        {
            $DKIMsignatureType = 'rsa-sha256'; // Signature & hash algorithms
            $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
            $DKIMquery = 'dns/txt'; // Query method
    Severity: Major
    Found in library/PHPMailer.class.php - About 2 hrs to fix

      Method validateAddress has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function validateAddress($address, $patternselect = null)
          {
              if (is_null($patternselect)) {
                  $patternselect = self::$validator;
              }
      Severity: Major
      Found in library/PHPMailer.class.php - About 2 hrs to fix

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

            function css(stream, state) {
                if (stream.match(/^<\/\s*style\s*>/i, false)) {
                    state.token = html;
                    state.localState = null;
                    state.mode = "html";
        Severity: Major
        Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 2 hrs to fix
        static/editor/third-party/codemirror/codemirror.js on lines 3526..3535

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

        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

            function javascript(stream, state) {
                if (stream.match(/^<\/\s*script\s*>/i, false)) {
                    state.token = html;
                    state.curState = null;
                    state.mode = "html";
        Severity: Major
        Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 2 hrs to fix
        static/editor/third-party/codemirror/codemirror.js on lines 3536..3545

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

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

            private function saveRemote()
            {
                $imgUrl = htmlspecialchars($this->fileField);
                $imgUrl = str_replace("&amp;", "&", $imgUrl);
                
        Severity: Major
        Found in library/Uploader.class.php - About 2 hrs to fix

          PhpAnalysis has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class PhpAnalysis
          {
              
              //hash算法选项
              public $mask_value = 0x000F; //Default:0xFFFF
          Severity: Minor
          Found in library/PHPAnalysis.class.php - About 2 hrs to fix

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

                        function removeFile(file) {
                            var $li = $('#' + file.id);
                            delete percentages[ file.id ];
                            updateTotalProgress();
                            $li.off().find('.file-panel').off().end().remove();
            Severity: Major
            Found in static/editor/dialogs/attachment/attachment.js and 2 other locations - About 2 hrs to fix
            static/editor/dialogs/image/image.js on lines 531..536
            static/editor/dialogs/video/video.js on lines 542..547

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

            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

                        function removeFile(file) {
                            var $li = $('#' + file.id);
                            delete percentages[ file.id ];
                            updateTotalProgress();
                            $li.off().find('.file-panel').off().end().remove();
            Severity: Major
            Found in static/editor/dialogs/image/image.js and 2 other locations - About 2 hrs to fix
            static/editor/dialogs/attachment/attachment.js on lines 316..321
            static/editor/dialogs/video/video.js on lines 542..547

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

            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

                        function removeFile(file) {
                            var $li = $('#' + file.id);
                            delete percentages[ file.id ];
                            updateTotalProgress();
                            $li.off().find('.file-panel').off().end().remove();
            Severity: Major
            Found in static/editor/dialogs/video/video.js and 2 other locations - About 2 hrs to fix
            static/editor/dialogs/attachment/attachment.js on lines 316..321
            static/editor/dialogs/image/image.js on lines 531..536

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

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

                    getHTML: function(sfrom, sto, includePre, tabText, endAt) {
                        var html = [], first = true;
                        if (includePre)
                            html.push(this.className ? '<pre class="' + this.className + '">': "<pre>");
                        function span(text, style) {
            Severity: Major
            Found in static/editor/third-party/codemirror/codemirror.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language