wikimedia/mediawiki-extensions-MobileFrontend

View on GitHub

Showing 166 of 183 total issues

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

    onBeforeExit: function ( exit, cancel ) {
        const self = this;
        if ( this.hasChanged() && !this.switching ) {
            if ( !this.windowManager ) {
                this.windowManager = OO.ui.getWindowManager();
Severity: Minor
Found in src/mobile.editor.overlay/EditorOverlayBase.js - 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

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

    private function shouldDisplayMobileViewInternal() {
        // May be overridden programmatically
        if ( $this->forceMobileView ) {
            return true;
        }
Severity: Minor
Found in includes/MobileContext.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

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

function createPromoCampaign(
    onShow,
    actions,
    campaignName,
    campaignActive,
Severity: Minor
Found in src/mobile.startup/promoCampaign/promoCampaign.js - 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

Function getStructuredLanguages has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        languages,
        variants,
        frequentlyUsedLanguages,
        showSuggestedLanguages,
        deviceLanguage
Severity: Minor
Found in src/mobile.languages.structured/util.js - About 35 mins to fix

    Function exports has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    module.exports = function searchHeader( placeholderMsg, action, onInput, defaultSearchPage, autocapitalize ) {
    Severity: Minor
    Found in src/mobile.startup/search/searchHeader.js - About 35 mins to fix

      Function reveal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      Toggler.prototype.reveal = function ( id ) {
          let $target;
          // jQuery will throw for hashes containing certain characters which can break toggling
          try {
              $target = this.$container.find( '#' + escapeSelector( id ) );
      Severity: Minor
      Found in src/mobile.startup/Toggler.js - About 35 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

      Function _processMatch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          _processMatch( match ) {
              const self = this;
      
              if ( match ) {
                  if ( match.overlay ) {
      Severity: Minor
      Found in src/mobile.startup/OverlayManager.js - About 35 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

      Function getContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          getContent: function () {
              let options;
      
              const self = this;
      
      
      Severity: Minor
      Found in src/mobile.editor.overlay/EditorGateway.js - About 35 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

      Function getLastModifiedMessage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function getLastModifiedMessage( ts, username, gender, historyUrl ) {
          const linkAll = typeof historyUrl === 'undefined',
              keys = {
                  seconds: 'mobile-frontend-last-modified-with-user-seconds',
                  minutes: 'mobile-frontend-last-modified-with-user-minutes',
      Severity: Minor
      Found in src/mobile.startup/time.js - About 35 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

      Function onOutputPageBeforeHTML has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function onOutputPageBeforeHTML( $out, &$text ) {
              // This hook can be executed more than once per page view if the page content is composed from
              // multiple sources! Anything that doesn't depend on $text should use onBeforePageDisplay.
      
              $context = $this->mobileContext;
      Severity: Minor
      Found in includes/MobileFrontendHooks.php - About 35 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

      Function onSaveComplete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          onSaveComplete: function ( newRevId, redirectUrl ) {
              EditorOverlayBase.prototype.onSaveComplete.apply( this, arguments );
      
              // The parent class changes the location hash in a setTimeout, so wait
              // for that to happen before reloading.
      Severity: Minor
      Found in src/mobile.editor.overlay/SourceEditorOverlay.js - About 35 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

      Function _positionImage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          _positionImage: function () {
              const $window = util.getWindow();
      
              this.adjustDetails();
              // with a hidden details box we have a little bit more space, we just need to use it
      Severity: Minor
      Found in src/mobile.mediaViewer/ImageCarousel.js - About 35 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

      Function identifyLeadParagraph has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function identifyLeadParagraph( $body ) {
          // Keep in sync with MoveLeadParagraphTransform::isNotEmptyNode()
          function isNotEmptyNode( node ) {
              // Ignore VE whitespace characters
              return !/^[\s↵➞]*$/.test( node.textContent );
      Severity: Minor
      Found in src/mobile.editor.overlay/identifyLeadParagraph.js - About 35 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

      Function filterLanguages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          filterLanguages: function ( searchQuery, searchOrigin ) {
              const filteredList = [];
      
              if ( searchQuery ) {
                  this.options.languages.forEach( function ( language ) {
      Severity: Minor
      Found in src/mobile.languages.structured/LanguageSearcher.js - About 35 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

      Function onSkinAddFooterLinks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function onSkinAddFooterLinks( Skin $skin, string $key, array &$footerLinks ) {
              $context = $this->mobileContext;
              if ( $key === 'places' ) {
                  if ( $context->shouldDisplayMobileView() ) {
                      $terms = MobileFrontendSkinHooks::getTermsLink( $skin );
      Severity: Minor
      Found in includes/MobileFrontendHooks.php - About 35 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

      Function hasEditNoticesFeatureConflict has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private function hasEditNoticesFeatureConflict( Config $config, User $user ): bool {
              $gadgetName = $config->get( 'MFEditNoticesConflictingGadgetName' );
              if ( !$gadgetName ) {
                  return false;
              }
      Severity: Minor
      Found in includes/MobileFrontendHooks.php - About 35 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 too many return statements within this method.
      Open

                  return true;
      Severity: Major
      Found in includes/MobileContext.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return false;
        Severity: Major
        Found in includes/MobileContext.php - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return $heading.nextUntil( $nextHeading, selector );
          Severity: Major
          Found in src/mobile.startup/PageHTMLParser.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return 'SourceEditor';
            Severity: Major
            Found in src/mobile.init/editor.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language