wikimedia/mediawiki-extensions-MobileFrontend

View on GitHub

Showing 166 of 183 total issues

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

    handleCaptcha: function ( details ) {
        const 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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $services = MediaWikiServices::getInstance();
        $urlUtils = $services->getUrlUtils();

        $config = $this->getConfig();
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 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 extendSearchParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function extendSearchParams( feature ) {
    const displayWikibaseDescriptions = mw.config.get( 'wgMFDisplayWikibaseDescriptions' ) || {
            // These must be defined, as these are all the features that this can be used on.
            // If not defined, all these features will see their API calls broken
            search: true,
Severity: Minor
Found in src/mobile.startup/extendSearchParams.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 onCustomEditor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function onCustomEditor( $article, $user ) {
        $req = $article->getContext()->getRequest();
        $title = $article->getTitle();
        if (
            !$req->getVal( 'mfnoscript' ) &&
Severity: Minor
Found in includes/MobileFrontendEditorHooks.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

Severity
Category
Status
Source
Language