wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 1,432 of 2,096 total issues

Function createEntityView has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function createEntityView( entity, $entityview ) {
        var currentRevision, revisionStore, entityChangersFactory,
            viewFactoryArguments, ViewFactoryFactory, viewFactory, entityView,
            repoConfig = mw.config.get( 'wbRepo' ),
            repoApiUrl = repoConfig.url + repoConfig.scriptPath + '/api.php',
Severity: Major
Found in repo/resources/wikibase.ui.entityViewInit.js - About 3 hrs to fix

    Function hydrateLanguageLabelInputForm has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var hydrateLanguageLabelInputForm = function () {
            var $lang, fields, fieldCount, langWidget;
    
            $lang = $( document.getElementsByName( 'lang' ) ).closest( '.oo-ui-inputWidget' );
            if ( $lang.length === 0 ) {

      Function coalesceRuns has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private function coalesceRuns( EntityId $entityId, array $changes ) {
              $coalesced = [];
      
              $currentRun = [];
              $currentUser = null;
      Severity: Minor
      Found in client/includes/Changes/ChangeRunCoalescer.php - About 3 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 handleRequest has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handleRequest( $doc, WebRequest $request, OutputPage $output ) {
              // No matter what: The response is always public
              $output->getRequest()->response()->header( 'Access-Control-Allow-Origin: *' );
      
              $revision = 0;
      Severity: Minor
      Found in repo/includes/LinkedData/EntityDataRequestHandler.php - About 3 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 stringParse has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function stringParse( $value ) {
              $date = $this->parseDate( $value );
              $precision = TimeValue::PRECISION_YEAR;
              $time = [ $this->parseFormattedNumber( $date['year'] ), 0, 0, 0, 0, 0 ];
      
      
      Severity: Minor
      Found in repo/includes/Parsers/DateFormatParser.php - About 3 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 getFormFields has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getFormFields(): array {
              $formFields = [
                  self::FIELD_LANG => [
                      'name' => self::FIELD_LANG,
                      'class' => HTMLContentLanguageField::class,
      Severity: Major
      Found in repo/includes/Specials/SpecialNewItem.php - About 3 hrs to fix

        File CachingPrefetchingTermLookup.php has 301 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare( strict_types = 1 );
        
        namespace Wikibase\Lib\Store;
        Severity: Minor
        Found in lib/includes/Store/CachingPrefetchingTermLookup.php - About 3 hrs to fix

          File HtmlPageLinkRendererEndHookHandler.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          declare( strict_types = 1 );
          
          namespace Wikibase\Repo\Hooks;
          Severity: Minor
          Found in repo/includes/Hooks/HtmlPageLinkRendererEndHookHandler.php - About 3 hrs to fix

            File WikiPageEntityStore.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace Wikibase\Repo\Store\Sql;
            
            use InvalidArgumentException;
            Severity: Minor
            Found in repo/includes/Store/Sql/WikiPageEntityStore.php - About 3 hrs to fix

              Function validateModifiedStatements has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function validateModifiedStatements(
                      array $originalSerialization,
                      StatementList $originalStatements,
                      array $serialization,
                      string $basePath = ''
              Severity: Minor
              Found in repo/rest-api/src/Application/Validation/StatementsValidator.php - About 3 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

              EditEntity has 26 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class EditEntity extends ModifyEntity {
              
                  public const PARAM_DATA = 'data';
              
                  public const PARAM_CLEAR = 'clear';
              Severity: Minor
              Found in repo/includes/Api/EditEntity.php - About 3 hrs to fix

                Item has 26 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Item implements
                    StatementListProvidingEntity,
                    FingerprintProvider,
                    StatementListHolder,
                    LabelsProvider,
                Severity: Minor
                Found in lib/packages/wikibase/data-model/src/Entity/Item.php - About 3 hrs to fix

                  Function 7dd0 has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  /***/ (function(module, exports, __webpack_require__) {
                  
                  "use strict";
                  
                  var $ = __webpack_require__("23e7");
                  Severity: Major
                  Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 2 hrs to fix

                    Function exports has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    /******/ (function(modules) { // webpackBootstrap
                    /******/     // The module cache
                    /******/     var installedModules = {};
                    /******/
                    /******/     // The require function
                    Severity: Minor
                    Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.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

                    File ChangeLineFormatter.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    declare( strict_types = 1 );
                    
                    namespace Wikibase\Client\RecentChanges;
                    Severity: Minor
                    Found in client/includes/RecentChanges/ChangeLineFormatter.php - About 2 hrs to fix

                      File SqlStore.php has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace Wikibase\Repo\Store\Sql;
                      
                      use MediaWiki\HookContainer\HookContainer;
                      Severity: Minor
                      Found in repo/includes/Store/Sql/SqlStore.php - About 2 hrs to fix

                        File jquery.ui.ooMenu.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        ( function () {
                            'use strict';
                        
                            /**
                             * jQuery.ui.ooMenu provides an object-oriented menu structure. Menu items are managed using
                        Severity: Minor
                        Found in client/resources/jquery.ui/jquery.ui.ooMenu.js - About 2 hrs to fix

                          File EntityUsageTable.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          
                          declare( strict_types = 1 );
                          
                          namespace Wikibase\Client\Usage\Sql;
                          Severity: Minor
                          Found in client/includes/Usage/Sql/EntityUsageTable.php - About 2 hrs to fix

                            Method getForm has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function getForm( EntityDocument $entity = null ) {
                                    if ( $this->page === null ) {
                                        $this->page = $this->site === null ? '' : $this->getSiteLink( $entity, $this->site );
                                    }
                                    if ( !$this->badges ) {
                            Severity: Major
                            Found in repo/includes/Specials/SpecialSetSiteLink.php - About 2 hrs to fix

                              File templates.php has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              
                              namespace Wikibase;
                              
                              /**
                              Severity: Minor
                              Found in view/resources/templates.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language