wikimedia/mediawiki-extensions-MobileFrontend

View on GitHub

Showing 166 of 183 total issues

Method getLineHtml has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getLineHtml( MobilePage $mp ) {
        $thumb = $mp->getSmallThumbnailHtml( true );
        $title = $mp->getTitle();
        if ( !$thumb ) {
            $thumb = Html::rawElement( 'div', [
Severity: Minor
Found in includes/specials/SpecialMobileEditWatchlist.php - About 1 hr to fix

    Function Drawer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Drawer( props ) {
        this.drawerClassName = props.className || '';
        this.collapseIcon = new IconButton( {
            icon: 'expand',
            additionalClassNames: 'cancel',
    Severity: Minor
    Found in src/mobile.startup/Drawer.js - About 1 hr to fix

      Function postRender has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          postRender() {
              const self = this,
                  searchResults = new SearchResultsView( {
                      searchContentLabel: mw.msg( 'mobile-frontend-search-content' ),
                      noResultsMsg: mw.msg( 'mobile-frontend-search-no-results' ),
      Severity: Minor
      Found in src/mobile.startup/search/SearchOverlay.js - About 1 hr to fix

        Function switchToSourceEditor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            switchToSourceEditor: function ( dataPromise ) {
                const self = this,
                    SourceEditorOverlay = this.SourceEditorOverlay,
                    options = this.getOptionsForSwitch();
                this.log( {
        Severity: Minor
        Found in src/mobile.editor.overlay/VisualEditorOverlay.js - About 1 hr to fix

          Function findChildInSectionLead has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              findChildInSectionLead( sectionIndex, selector ) {
                  let $heading, $nextHeading;
          
                  const headingSelector = HEADING_SELECTOR;
          
          
          Severity: Minor
          Found in src/mobile.startup/PageHTMLParser.js - About 1 hr to fix

            Function onSaveComplete has 30 lines of code (exceeds 25 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 1 hr to fix

              Function SearchOverlay has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function SearchOverlay( params ) {
                  const header = searchHeader(
                          params.placeholderMsg,
                          params.action || mw.config.get( 'wgScript' ),
                          ( query ) => this.performSearch( query ),
              Severity: Minor
              Found in src/mobile.startup/search/SearchOverlay.js - About 1 hr to fix

                Function onSaveBegin has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    onSaveBegin: function () {
                        const self = this,
                            options = {
                                summary: this.getEditSummary()
                            };
                Severity: Minor
                Found in src/mobile.editor.overlay/SourceEditorOverlay.js - About 1 hr to fix

                  Method onRequestContextCreateSkin has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function onRequestContextCreateSkin( $context, &$skin ) {
                          $mobileContext = $this->mobileContext;
                  
                          $mobileContext->doToggling();
                          if ( !$mobileContext->shouldDisplayMobileView() ) {
                  Severity: Minor
                  Found in includes/MobileFrontendHooks.php - About 1 hr to fix

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

                        action,
                        promoCampaign,
                        mwMessage,
                        mwUtil,
                        toast,
                    Severity: Major
                    Found in src/mobile.startup/amcOutreach/amcOutreachDrawer.js - About 1 hr to fix

                      Method getResourceLoaderMFConfigVars has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function getResourceLoaderMFConfigVars() {
                              $vars = [];
                              $config = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Config' );
                              $mfScriptPath = $config->get( 'MFScriptPath' );
                              $pageProps = $config->get( 'MFQueryPropModules' );
                      Severity: Minor
                      Found in includes/MobileFrontendHooks.php - About 1 hr to fix

                        Function init has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function init( $container ) {
                        
                            // T360781 - since this is invoked via hook, the value of $container is not guaranteed.
                            // If undefined, return early since no further work can be done on $container.
                            if ( !( $container[ 0 ] instanceof HTMLElement ) ) {
                        Severity: Minor
                        Found in src/mobile.init/lazyLoadedImages.js - About 1 hr to fix

                          Function getStructuredLanguages has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              getStructuredLanguages: function (
                                  languages,
                                  variants,
                                  frequentlyUsedLanguages,
                                  showSuggestedLanguages,
                          Severity: Minor
                          Found in src/mobile.languages.structured/util.js - About 1 hr 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 onEditLinkClick has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function onEditLinkClick( elem, ev, router ) {
                              let section;
                              if ( $( EDITSECTION_SELECTOR ).length === 0 ) {
                                  // If section edit links are not available, the only edit link
                                  // should allow editing the whole page (T232170)
                          Severity: Minor
                          Found in src/mobile.init/editor.js - About 1 hr 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 scrollToLeadParagraph has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              scrollToLeadParagraph: function () {
                                  let editLead, editLeadView, readLead, offset, initialCursorOffset;
                          
                                  const
                                      currentPageHTMLParser = this.options.currentPageHTMLParser,
                          Severity: Minor
                          Found in src/mobile.editor.overlay/VisualEditorOverlay.js - About 1 hr 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 domParseMobile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function domParseMobile( OutputPage $out, $html = '' ) {
                                  $services = MediaWikiServices::getInstance();
                                  /** @var FeaturesManager $featuresManager */
                                  $featuresManager = $services->getService( 'MobileFrontend.FeaturesManager' );
                                  /** @var MobileContext $context */
                          Severity: Minor
                          Found in includes/ExtMobileFrontend.php - About 1 hr 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 delegateEvents has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              delegateEvents( events ) {
                                  let match, key, method;
                                  events = events || this.options.events;
                                  if ( events ) {
                                      // Remove current events before re-binding them
                          Severity: Minor
                          Found in src/mobile.startup/View.js - About 1 hr 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 parseBlockInfo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports = function parseBlockInfo( blockinfo ) {
                              const blockInfo = {
                                  partial: blockinfo.blockpartial || false,
                                  noCreateAccount: blockinfo.blocknocreate || false,
                                  anonOnly: blockinfo.blockanononly === undefined ? true : blockinfo.blockanononly,
                          Severity: Minor
                          Found in src/mobile.editor.overlay/parseBlockInfo.js - About 1 hr 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 submitSettingsForm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function submitSettingsForm() {
                                  $request = $this->getRequest();
                                  $user = $this->getUser();
                          
                                  if ( $user->isRegistered() && !$user->matchEditToken( $request->getVal( 'token' ) ) ) {
                          Severity: Minor
                          Found in includes/specials/SpecialMobileOptions.php - About 1 hr 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 getUserPageContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected static function getUserPageContent( IContextSource $output,
                                  User $pageUser, Title $title
                              ) {
                                  /** @var MobileContext $context */
                                  $context = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
                          Severity: Minor
                          Found in includes/ExtMobileFrontend.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language