wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 1,432 of 2,096 total issues

File SpecialSetLabelDescriptionAliases.php has 368 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Wikibase\Repo\Specials;

use InvalidArgumentException;
Severity: Minor
Found in repo/includes/Specials/SpecialSetLabelDescriptionAliases.php - About 4 hrs to fix

    Method parseDateFormat has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function parseDateFormat( $format ) {
            $length = strlen( $format );
    
            $number = $this->getNumberPattern();
            $notFollowedByNumber = '(?!' . $number . ')';
    Severity: Major
    Found in repo/includes/Parsers/DateFormatParser.php - About 4 hrs to fix

      Function ddb0 has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      /***/ (function(module, exports, __webpack_require__) {
      
      var global = __webpack_require__("da84");
      var DOMIterables = __webpack_require__("fdbc");
      var ArrayIteratorMethods = __webpack_require__("e260");
      Severity: Minor
      Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - 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

      RepoHooks has 36 functions (exceeds 20 allowed). Consider refactoring.
      Open

      final class RepoHooks {
      
          /**
           * Handler for the BeforePageDisplay hook, that conditionally adds the wikibase
           * mobile styles and injects the wikibase.ui.entitysearch module replacing the
      Severity: Minor
      Found in repo/includes/RepoHooks.php - About 4 hrs to fix

        File EditEntityAction.php has 359 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          File EntityDataRequestHandler.php has 359 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace Wikibase\Repo\LinkedData;
          
          use HttpError;
          Severity: Minor
          Found in repo/includes/LinkedData/EntityDataRequestHandler.php - About 4 hrs to fix

            Function mergeParams has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

                private mergeParams<action1 extends ApiAction, action2 extends ApiAction>(
                    params1: ApiParams<action1>,
                    params2: ApiParams<action2>,
                ): ApiParams<action1&action2>|false {
                    const paramNames = new Set( [
            Severity: Minor
            Found in client/data-bridge/src/data-access/BatchingApi.ts - 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

            File wikibase.ui.entityViewInit.js has 350 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * @license GPL-2.0-or-later
             * @author H. Snater < mediawiki@snater.com >
             * @author Daniel Werner < daniel.a.r.werner@gmail.com >
             * @author Adrian Heine <adrian.heine@wikimedia.de>
            Severity: Minor
            Found in repo/resources/wikibase.ui.entityViewInit.js - About 4 hrs to fix

              File actions.ts has 347 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { DataValue } from '@wmde/wikibase-datamodel-types';
              import ApiErrors from '@/data-access/error/ApiErrors';
              import SavingError from '@/data-access/error/SavingError';
              import { Store } from 'vuex';
              import Application, { InitializedApplicationState, SavingState } from '@/store/Application';
              Severity: Minor
              Found in client/data-bridge/src/store/actions.ts - About 4 hrs to fix

                File Resources.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                declare( strict_types = 1 );
                
                use MediaWiki\MediaWikiServices;
                Severity: Minor
                Found in repo/resources/Resources.php - About 4 hrs to fix

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

                  /***/ (function(module, exports, __webpack_require__) {
                  
                  var global = __webpack_require__("da84");
                  var createNonEnumerableProperty = __webpack_require__("9112");
                  var has = __webpack_require__("5135");
                  Severity: Minor
                  Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - 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 draw has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          draw: function () {
                              var self = this,
                                  newValue = this._newDataValue;
                  
                              function _render() {
                  Severity: Major
                  Found in view/resources/jquery/wikibase/snakview/snakview.variations.Value.js - About 4 hrs to fix

                    File SpecialSetSiteLink.php has 342 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace Wikibase\Repo\Specials;
                    
                    use InvalidArgumentException;
                    Severity: Minor
                    Found in repo/includes/Specials/SpecialSetSiteLink.php - About 4 hrs to fix

                      File SpecialNewItem.php has 340 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        Method writePropertyPredicates has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function writePropertyPredicates( $localName, $repositoryName, $propertyRdfType, $normalizedPropertyRdfType ) {
                                $this->writer->say( RdfVocabulary::NS_ONTOLOGY, 'directClaim' )->is(
                                    $this->vocabulary->propertyNamespaceNames[$repositoryName][RdfVocabulary::NSP_DIRECT_CLAIM],
                                    $localName
                                );
                        Severity: Major
                        Found in repo/includes/Rdf/PropertySpecificComponentsRdfBuilder.php - About 4 hrs to fix

                          Method writePropertyPredicates has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function writePropertyPredicates( $localName, $repositoryName, $propertyRdfType, $normalizedPropertyRdfType ) {
                                  $this->writer->say( RdfVocabulary::NS_ONTOLOGY, 'directClaim' )->is(
                                      $this->vocabulary->propertyNamespaceNames[$repositoryName][RdfVocabulary::NSP_DIRECT_CLAIM],
                                      $localName
                                  );
                          Severity: Major
                          Found in repo/includes/Rdf/PropertyStubRdfBuilder.php - About 4 hrs to fix

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

                                public function __construct(
                                    array $conceptUris,
                                    array $dataUris,
                                    EntitySourceDefinitions $entitySourceDefinitions,
                                    array $rdfTurtleNodePrefixes,
                            Severity: Major
                            Found in repo/includes/Rdf/RdfVocabulary.php - About 4 hrs to fix

                              Function filterEntitySerializationUsingLangCodes has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function filterEntitySerializationUsingLangCodes( array $serialization ) {
                                      if ( $this->filterLangCodes ) {
                                          if ( array_key_exists( 'labels', $serialization ) ) {
                                              foreach ( $serialization['labels'] as $langCode => $languageArray ) {
                                                  if ( !in_array( $langCode, $this->filterLangCodes ) ) {
                              Severity: Minor
                              Found in client/includes/Serializer/ClientEntitySerializer.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 filterEntitySerializationUsingLangCodes has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function filterEntitySerializationUsingLangCodes(
                                      array $serialization,
                                      array $langCodes
                                  ) {
                                      if ( $langCodes ) {
                              Severity: Minor
                              Found in repo/includes/Api/ResultBuilder.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

                              File jquery.wikibase.sitelinkview.js has 335 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /**
                               * @license GPL-2.0-or-later
                               * @author H. Snater < mediawiki@snater.com >
                               */
                              ( function ( wb ) {
                              Severity: Minor
                              Found in view/resources/jquery/wikibase/jquery.wikibase.sitelinkview.js - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language