wikimedia/mediawiki-extensions-MobileFrontend

View on GitHub

Showing 191 of 191 total issues

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

    public function execute() {
        $services = MediaWikiServices::getInstance();

        $config = $this->getConfig();
        $resultObj = $this->getResult();
Severity: Minor
Found in includes/Api/ApiWebappManifest.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 domParseMobile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

    protected function getRevisionCommentHTML( RevisionRecord $rev, $user, $unhide ) {
        if ( RevisionRecord::userCanBitfield(
            $rev->getVisibility(),
            RevisionRecord::DELETED_COMMENT,
            $user
Severity: Minor
Found in includes/specials/MobileSpecialPageFeed.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 preRender has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    preRender() {
        // Mapping existing props to Codex props used in IconButton
        var 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 handleCaptcha has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    handleCaptcha: function ( details ) {
        var self = this,
            $input = this.$el.find( '.captcha-word' );

        if ( this.captchaShown ) {
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 VisualEditorOverlay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function VisualEditorOverlay( options ) {
    var 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 isIos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    isIos: memoize( function ( version ) {
        var 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 isNonLeadParagraph has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function isNonLeadParagraph( $xPath, $node ) {
        if (
            $node->nodeType === XML_ELEMENT_NODE &&
            /** @phan-suppress-next-line PhanUndeclaredProperty DOMNode vs. DOMElement */
            $node->tagName === 'p' &&
Severity: Minor
Found in includes/Transforms/MoveLeadParagraphTransform.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 getPageImageHtml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getPageImageHtml( $size, $useBackgroundImage = false ) {
        if ( !$this->file ) {
            return '';
        }
        // FIXME: Use more generic classes - no longer restricted to lists
Severity: Minor
Found in includes/Models/MobilePage.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 getUsernameText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getUsernameText( $rev, $user, $unhide ) {
        $revUser = $rev->getUser( RevisionRecord::FOR_THIS_USER, $user );
        if ( $revUser && $revUser->isRegistered() ) {
            $username = $revUser->getName();
        } else {
Severity: Minor
Found in includes/specials/MobileSpecialPageFeed.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

Severity
Category
Status
Source
Language