wikimedia/mediawiki-extensions-MobileFrontend

View on GitHub

Showing 166 of 183 total issues

Avoid too many return statements within this method.
Open

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

    Avoid too many return statements within this method.
    Open

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

      Avoid too many return statements within this method.
      Open

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

        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 method.
            Open

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

              Avoid too many return statements within this method.
              Open

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

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

                    getThumbnail( $a ) {
                        const notSelector = '.' + EXCLUDE_THUMBNAIL_CLASS_SELECTORS.join( ',.' ),
                            $lazyImage = $a.find( '.lazy-image-placeholder' ),
                            href = $a.attr( 'href' ),
                            url = href && new URL( href, location.href ),
                Severity: Minor
                Found in src/mobile.startup/PageHTMLParser.js - About 25 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 preRender has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    preRender() {
                        // Mapping existing props to Codex props used in IconButton
                        let action = 'default';
                        if ( this.options.progressive ) {
                            action = 'progressive';
                Severity: Minor
                Found in src/mobile.startup/Button.js - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    onSaveComplete: function ( newRevId, redirectUrl, tempUserCreated ) {
                        const
                            self = this;
                
                        this.saved = true;
                Severity: Minor
                Found in src/mobile.editor.overlay/EditorOverlayBase.js - About 25 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 isIos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    isIos: memoize( function ( version ) {
                        const ua = this.userAgent,
                            ios = /ipad|iphone|ipod/i.test( ua );
                
                        if ( ios && version ) {
                Severity: Minor
                Found in src/mobile.startup/Browser.js - About 25 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 toggle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                Toggler.prototype.toggle = function ( $heading, fromSaved ) {
                    if ( !fromSaved && $heading.hasClass( 'collapsible-heading-disabled' ) ) {
                        return false;
                    }
                
                
                Severity: Minor
                Found in src/mobile.startup/Toggler.js - About 25 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 VisualEditorOverlay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function VisualEditorOverlay( options ) {
                    const surfaceReady = util.Deferred();
                
                    EditorOverlayBase.call( this,
                        util.extend( {
                Severity: Minor
                Found in src/mobile.editor.overlay/VisualEditorOverlay.js - About 25 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 _resizeEditor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    _resizeEditor: function () {
                        let scrollTop, container, $scrollContainer;
                
                        if ( !this.$scrollContainer ) {
                            container = OO.ui.Element.static
                Severity: Minor
                Found in src/mobile.editor.overlay/SourceEditorOverlay.js - About 25 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 onSpecialPageBeforeExecute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function onSpecialPageBeforeExecute( $special, $subpage ) {
                        $isMobileView = $this->mobileContext->shouldDisplayMobileView();
                        $taglines = $this->mobileContext->getConfig()->get( 'MFSpecialPageTaglines' );
                        $name = $special->getName();
                
                
                Severity: Minor
                Found in includes/MobileFrontendHooks.php - About 25 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 onPostLoginRedirect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function onPostLoginRedirect( &$returnTo, &$returnToQuery, &$type ) {
                        $context = $this->mobileContext;
                
                        if ( !$context->shouldDisplayMobileView() ) {
                            return;
                Severity: Minor
                Found in includes/MobileFrontendHooks.php - About 25 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 makeHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function makeHeader( headingOrView, headerActions, headerCancel, additionalClassNames ) {
                    const heading = typeof headingOrView === 'string' ? headingOrView : undefined,
                        templateData = {
                            hasActions: headerActions && headerActions.length,
                            isHidden: false,
                Severity: Minor
                Found in src/mobile.startup/headers.js - About 25 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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function ( options ) {
                    const isWatched = options.isWatched,
                        watchstar = __non_webpack_require__( 'mediawiki.page.watch.ajax' ).watchstar,
                        action = isWatched ? 'unwatch' : 'watch',
                        iconProps = {
                Severity: Minor
                Found in src/mobile.startup/watchstar/watchstar.js - About 25 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 _enableArrowImages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    _enableArrowImages: function ( thumbs ) {
                        const offset = this.galleryOffset;
                        let lastThumb, nextThumb;
                
                        if ( this.galleryOffset === undefined ) {
                Severity: Minor
                Found in src/mobile.mediaViewer/ImageCarousel.js - About 25 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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    constructor( options ) {
                        const title = options.title || '';
                        util.extend( this, {
                            id: options.id || 0,
                            // FIXME: Deprecate title property as it can be derived from titleObj
                Severity: Minor
                Found in src/mobile.startup/Page.js - About 25 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

                Severity
                Category
                Status
                Source
                Language