wikimedia/mediawiki-extensions-Flow

View on GitHub

Showing 681 of 907 total issues

File TemplateHelper.php has 469 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Flow;

use Closure;
Severity: Minor
Found in includes/TemplateHelper.php - About 7 hrs to fix

    Method buildActions has 165 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function buildActions( FormatterRow $row ) {
            global $wgThanksSendToBots;
    
            $user = $this->permissions->getUser();
            $workflow = $row->workflow;
    Severity: Major
    Found in includes/Formatter/RevisionFormatter.php - About 6 hrs to fix

      Function execute has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      Open

          public function execute() {
              global $wgLang;
      
              $this->dbFactory = Container::get( 'db.factory' );
              $this->workflowLoaderFactory = Container::get( 'factory.loader.workflow' );
      Severity: Minor
      Found in maintenance/FlowFixInconsistentBoards.php - About 6 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 execute has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          public function execute() {
              // Reflection hackery: make setContentRaw() callable
              $this->setContentRawMethod = new ReflectionMethod( AbstractRevision::class, 'setContentRaw' );
              $this->setContentRawMethod->setAccessible( true );
      
      
      Severity: Minor
      Found in maintenance/FlowReserializeRevisionContent.php - About 6 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

      File OptInController.php has 423 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Flow\Import;
      
      use DateTime;
      Severity: Minor
      Found in includes/Import/OptInController.php - About 6 hrs to fix

        Function __module10__ has 149 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var __module10__ = (function(__dependency1__) {
          "use strict";
          var __exports__;
          var Visitor = __dependency1__;
        
        
        Severity: Major
        Found in modules/libs/handlebars-v3.0.0.js - About 5 hrs to fix

          UrlGenerator has 43 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class UrlGenerator {
              /**
               * @var CachingObjectMapper
               */
              private $workflowMapper;
          Severity: Minor
          Found in includes/UrlGenerator.php - About 5 hrs to fix

            File flow-component-events.js has 408 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*!
             * Contains the code which registers and handles event callbacks.
             * In addition, it contains some common callbacks (eg. apiRequest)
             * @todo Find better places for a lot of the callbacks that have been placed here
             */
            Severity: Minor
            Found in modules/engine/components/common/flow-component-events.js - About 5 hrs to fix

              Method formatApi has 144 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function formatApi( FormatterRow $row, IContextSource $ctx, $action = 'view' ) {
                      $this->permissions->setUser( $ctx->getUser() );
              
                      if ( !$this->permissions->isAllowed( $row->revision, $action ) ) {
                          LoggerFactory::getInstance( 'Flow' )->debug(
              Severity: Major
              Found in includes/Formatter/RevisionFormatter.php - About 5 hrs to fix

                File mw.flow.ui.EditorWidget.js has 398 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* global ve */
                ( function () {
                    /**
                     * Flow editor widget
                     *
                Severity: Minor
                Found in modules/flow/ui/widgets/editor/mw.flow.ui.EditorWidget.js - About 5 hrs to fix

                  Function mwUiTooltipShow has 133 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function mwUiTooltipShow( target, content, options ) {
                              var $target = $( target ),
                                  // Find previous tooltip for this el
                                  $tooltip = $target.data( '$tooltip' ),
                  
                  
                  Severity: Major
                  Found in modules/engine/misc/mw-ui.enhance.js - About 5 hrs to fix

                    Function anonymous has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
                    
                      var $0 = $$.length - 1;
                      switch (yystate) {
                      case 1: return $$[$0-1]; 
                    Severity: Major
                    Found in modules/libs/handlebars-v3.0.0.js - About 5 hrs to fix

                      Function __module15__ has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      var __module15__ = (function(__dependency1__) {
                        "use strict";
                        var __exports__;
                        var isArray = __dependency1__.isArray;
                      
                      
                      Severity: Major
                      Found in modules/libs/handlebars-v3.0.0.js - About 5 hrs to fix

                        Function buildLinks has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function buildLinks( FormatterRow $row ) {
                                $workflow = $row->workflow;
                                $revision = $row->revision;
                                $title = $workflow->getArticleTitle();
                                $action = $revision->getChangeType();
                        Severity: Minor
                        Found in includes/Formatter/RevisionFormatter.php - About 4 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 processParam has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function processParam(
                                $param,
                                $revision,
                                UUID $workflowId,
                                IContextSource $ctx,
                        Severity: Major
                        Found in includes/Formatter/RevisionFormatter.php - About 4 hrs to fix

                          Function template has 119 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function template(templateSpec, env) {
                              /* istanbul ignore next */
                              if (!env) {
                                throw new Exception("No environment passed to template");
                              }
                          Severity: Major
                          Found in modules/libs/handlebars-v3.0.0.js - About 4 hrs to fix

                            Function registerDefaultHelpers has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              function registerDefaultHelpers(instance) {
                                instance.registerHelper('helperMissing', function(/* [args, ]options */) {
                                  if(arguments.length === 1) {
                                    // A missing field in a {{foo}} constuct.
                                    return undefined;
                            Severity: Major
                            Found in modules/libs/handlebars-v3.0.0.js - About 4 hrs to fix

                              Function validateOptions has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function validateOptions( $options ) {
                                      static $validUnaryOptions = [
                                          'UNIQUE',
                                          'EXPLAIN',
                                      ];
                              Severity: Minor
                              Found in includes/Data/Storage/DbStorage.php - About 4 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 anonymous has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
                              
                              
                                function strip(start, end) {
                                  return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end);
                              Severity: Major
                              Found in modules/libs/handlebars-v3.0.0.js - About 4 hrs to fix

                                Method onNukeGetNewPages has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function onNukeGetNewPages( $username, $pattern, $namespace, $limit, &$pages ) {
                                        if ( $namespace && $namespace !== NS_TOPIC ) {
                                            // not interested in any Topics
                                            return true;
                                        }
                                Severity: Major
                                Found in includes/Hooks.php - About 4 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language