iMattPro/abbc3

View on GitHub

Showing 17 of 17 total issues

Method abbc3_bbcodes has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function abbc3_bbcodes()
    {
        return array(
            // These exist in core
            'b',
Severity: Major
Found in migrations/v310_m1_remove_data.php - About 2 hrs to fix

    Avoid excessively long variable names like $abbc3_bbcode_deprecated. Keep variable name length under 20.
    Open

            $abbc3_bbcode_deprecated = $this->abbc3_bbcodes();
    Severity: Minor
    Found in migrations/v310_m1_remove_data.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Method faq has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function faq()
        {
            // Set the block template data
            $this->template->assign_block_vars('faq_block', [
                'BLOCK_TITLE'    => $this->language->lang('ABBC3_FAQ_TITLE'),
    Severity: Minor
    Found in core/bbcodes_help.php - About 1 hr to fix

      Method update_schema has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function update_schema()
          {
              return array(
                  'drop_tables'    => array(
                      $this->table_prefix . 'clicks',
      Severity: Minor
      Found in migrations/v310_m2_remove_schema.php - About 1 hr to fix

        Function bbvideo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function bbvideo(Configurator $configurator)
            {
                if (!isset($configurator->BBCodes['bbvideo']))
                {
                    return;
        Severity: Minor
        Found in core/bbcodes_config.php - About 45 mins 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

        Missing class import via use statement (line '115', column '14').
        Open

                return new \acp_bbcodes();
        Severity: Minor
        Found in core/bbcodes_installer.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '104', column '15').
        Open

                        throw new \RuntimeException($this->language->lang('FORM_INVALID'), E_USER_WARNING);
        Severity: Minor
        Found in controller/acp_controller.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '149', column '14').
        Open

                    throw new \RuntimeException(implode('<br>', $this->errors), E_USER_WARNING);
        Severity: Minor
        Found in controller/acp_controller.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Remove error control operator '@' on line 224.
        Open

            protected function valid_url($url)
            {
                $headers = function_exists('get_headers') ? @get_headers($url) : false;
                return !$headers || stripos($headers[0], '200 OK') !== false;
            }
        Severity: Minor
        Found in controller/acp_controller.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

        Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

        Missing class import via use statement (line '152', column '13').
        Open

                throw new \RuntimeException($this->language->lang('CONFIG_UPDATED'), E_USER_NOTICE);
        Severity: Minor
        Found in controller/acp_controller.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Function clear_reparsers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function clear_reparsers()
            {
                /** @var \phpbb\textreparser\manager $reparser_manager */
                $reparser_manager = $this->container->get('text_reparser.manager');
        
        
        Severity: Minor
        Found in migrations/v336_m17_unparse.php - About 25 mins 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

        Avoid unused local variables such as '$tag'.
        Open

                    foreach ($configurator->MediaEmbed->defaultSites as $tagName => $tag)
        Severity: Minor
        Found in core/bbcodes_config.php by phpmd

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

        The method __construct has 10 parameters. Consider reducing the number of parameters to less than 10.
        Open

            public function __construct(cache $cache, config $config, db_text $db_text, db $db, ext_manager $ext_manager, language $language, request $request, template $template, $parser_key, $renderer_key)
            {
                $this->cache = $cache;
                $this->config = $config;
                $this->config_text = $db_text;
        Severity: Minor
        Found in controller/acp_controller.php by phpmd

        Avoid unused local variables such as '$reparser'.
        Open

                foreach ($reparsers as $name => $reparser)
        Severity: Minor
        Found in migrations/v336_m17_unparse.php by phpmd

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

        Avoid unused local variables such as '$ext'.
        Open

                    foreach ($icons as $path => $ext)
        Severity: Minor
        Found in core/bbcodes_display.php by phpmd

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

        Definition for rule 'multiline-comment-style' was not found
        Open

        var requestRunning = false;
        Severity: Minor
        Found in styles/all/template/js/abbc3.js by eslint

        For more information visit Source: http://eslint.org/docs/rules/

        Parsing error: The keyword 'const' is reserved
        Open

        const abbc3mainBox = document.querySelector("#abbc3_buttons");

        For more information visit Source: http://eslint.org/docs/rules/

        Severity
        Category
        Status
        Source
        Language