wikimedia/mediawiki-core

View on GitHub
resources/src/mediawiki.page.preview.js

Summary

Maintainability
D
2 days
Test Coverage

File mediawiki.page.preview.js has 506 lines of code (exceeds 250 allowed). Consider refactoring.
Open

( function () {
    var api = new mw.Api();

    /**
     * Show the edit summary.
Severity: Major
Found in resources/src/mediawiki.page.preview.js - About 1 day to fix

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

        function doPreview( config ) {
            config = $.extend( {
                $previewNode: $( '#wikiPreview' ),
                $diffNode: $( '#wikiDiff' ),
                $formNode: $( '#editform' ),
    Severity: Major
    Found in resources/src/mediawiki.page.preview.js - About 4 hrs to fix

      Function showTemplates has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function showTemplates( templates ) {
              // The .templatesUsed div can be empty, if no templates are in use.
              // In that case, we have to create the required structure.
              var $parent = $( '.templatesUsed' );
      
      
      Severity: Major
      Found in resources/src/mediawiki.page.preview.js - About 2 hrs to fix

        Function handleParseResponse has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function handleParseResponse( config, response ) {
                var $content;
        
                // Js config variables and modules.
                if ( response.parse.jsconfigvars ) {
        Severity: Minor
        Found in resources/src/mediawiki.page.preview.js - About 1 hr to fix

          Function getRestrictionsText has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function getRestrictionsText( restrictions ) {
                  var msg = '';
                  if ( !restrictions ) {
                      return $.Deferred().resolve( msg );
                  }
          Severity: Minor
          Found in resources/src/mediawiki.page.preview.js - About 1 hr to fix

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

                function getParseRequest( config, section ) {
                    var params = {
                        formatversion: 2,
                        action: 'parse',
                        summary: config.summary,
            Severity: Minor
            Found in resources/src/mediawiki.page.preview.js - About 1 hr to fix

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

                  function getDiffRequest( config, section, pageExists ) {
                      var contents = config.$textareaNode.textSelection( 'getContents' ),
                          sectionTitle = config.summary;
              
                      if ( section === 'new' ) {
              Severity: Minor
              Found in resources/src/mediawiki.page.preview.js - About 1 hr to fix

                There are no issues that match your filters.

                Category
                Status