wikimedia/mediawiki-extensions-MobileFrontend

View on GitHub

Showing 183 of 183 total issues

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