wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 1,432 of 2,096 total issues

Function showCopyrightTooltip has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function showCopyrightTooltip( $entityview, $origin, gravity, viewName ) {
        if ( !mw.config.exists( 'wbCopyright' ) ) {
            return;
        }

Severity: Major
Found in repo/resources/wikibase.ui.entityViewInit.js - About 4 hrs to fix

    File WikibaseValueFormatterBuilders.php has 335 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File jquery.wikibase.sitelinklistview.js has 333 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.sitelinklistview.js - About 4 hrs to fix

        Function f30a has 97 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        /***/ (function(module, __webpack_exports__, __webpack_require__) {
        
        "use strict";
        /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ApiProxy; });
        /* harmony import */ var _const__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("b774");
        Severity: Major
        Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 3 hrs to fix

          Function _drawEditMode has 94 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  _drawEditMode: function () {
                      var self = this,
                          pageNameInputOptions = {},
                          dir = $( document.documentElement ).prop( 'dir' );
          
          
          Severity: Major
          Found in view/resources/jquery/wikibase/jquery.wikibase.sitelinkview.js - About 3 hrs to fix

            Function parseDateFormat has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                private function parseDateFormat( $format ) {
                    $length = strlen( $format );
            
                    $number = $this->getNumberPattern();
                    $notFollowedByNumber = '(?!' . $number . ')';
            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

            MediaWikiEditEntity has 30 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class MediaWikiEditEntity implements EditEntity {
            
                private EntityRevisionLookup $entityRevisionLookup;
                private EntityTitleStoreLookup $titleLookup;
                private EntityStore $entityStore;
            Severity: Minor
            Found in repo/includes/EditEntity/MediaWikiEditEntity.php - About 3 hrs to fix

              Method appModule has 90 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function appModule() {
                      $clientSettings = WikibaseClient::getSettings();
                      return new FileModule(
                          [
                              'scripts' => [
              Severity: Major
              Found in client/includes/DataBridge/DataBridgeResourceLoaderModules.php - About 3 hrs to fix

                Method attemptSave has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function attemptSave( EntityDocument $newEntity, string $summary, $flags, $token, $watch = null, array $tags = [] ) {
                        $this->checkReadOnly( $newEntity ); // throws, exception formatted by MediaWiki (cf. MWExceptionRenderer::getExceptionTitle)
                        $this->checkEntityId( $newEntity->getId() ); // throws internal error (unexpected condition)
                
                        $watch = $this->getDesiredWatchState( $watch );
                Severity: Major
                Found in repo/includes/EditEntity/MediaWikiEditEntity.php - About 3 hrs to fix

                  Function 4d64 has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                  /***/ (function(module, exports, __webpack_require__) {
                  
                  var toIndexedObject = __webpack_require__("fc6a");
                  var toLength = __webpack_require__("50c4");
                  var toAbsoluteIndex = __webpack_require__("23cb");
                  Severity: Minor
                  Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - 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 getStatus has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getStatus( WebRequest $req, RevisionRecord $latestRevision ): Status {
                          if ( $req->getCheck( 'restore' ) ) { // nearly the same as undoafter without undo
                              $olderRevision = $this->revisionLookup->getRevisionById( $req->getInt( 'restore' ) );
                  
                              if ( !$olderRevision ) {
                  Severity: Minor
                  Found in repo/includes/Actions/EditEntityAction.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

                  File SearchEntities.php has 315 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Method getLocalizedYear has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function getLocalizedYear( $isoTimestamp, $precision ) {
                            preg_match( '/^(\D*)(\d*)/', $isoTimestamp, $matches );
                            [ , $sign, $year ] = $matches;
                            $isBCE = $sign === '-';
                    
                    
                    Severity: Major
                    Found in lib/includes/Formatters/MwTimeIsoFormatter.php - About 3 hrs to fix

                      File jquery.wikibase.entitytermsview.js has 313 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.entitytermsview.js - About 3 hrs to fix

                        File PatchedPropertyValidator.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php declare( strict_types=1 );
                        
                        namespace Wikibase\Repo\RestApi\Application\UseCases\PatchProperty;
                        
                        use LogicException;

                          Function f30a has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                          Open

                          /***/ (function(module, __webpack_exports__, __webpack_require__) {
                          
                          "use strict";
                          /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ApiProxy; });
                          /* harmony import */ var _const__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("b774");
                          Severity: Minor
                          Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - 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 initFormats has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function initFormats() {
                                  if ( $this->mimeTypes !== null && $this->fileExtensions !== null ) {
                                      return;
                                  }
                          
                          
                          Severity: Minor
                          Found in repo/includes/LinkedData/EntityDataFormatProvider.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 constructor has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              constructor(plugin, hook) {
                                  this.target = null;
                                  this.targetQueue = [];
                                  this.onQueue = [];
                                  this.plugin = plugin;
                          Severity: Major
                          Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 3 hrs to fix

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

                            /**
                             * 'tag-a-data' jQuery widget
                             *
                             * 'tag-a-data' is based on the original jQuery extension 'tag-it' v2.0 (06/2011) by
                             *   Levy Carneiro Jr.
                            Severity: Minor
                            Found in view/resources/jquery/ui/jquery.ui.tagadata.js - About 3 hrs to fix

                              File GetEntities.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              
                              declare( strict_types = 1 );
                              
                              namespace Wikibase\Repo\Api;
                              Severity: Minor
                              Found in repo/includes/Api/GetEntities.php - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language