wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function getOffsetDate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getOffsetDate( $year, $month, $day = -1 ) {
        // Given an optional year, month, and day, we need to generate a timestamp
        // to use as "WHERE rev_timestamp <= result"
        // Examples: year = 2006      equals < 20070101 (+000000)
        // year=2005, month=1         equals < 20050201
Severity: Minor
Found in includes/pager/ReverseChronologicalPager.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 onView has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function onView() {
        $this->getOutput()->addModuleStyles( [
            'mediawiki.interface.helpers.styles',
            'mediawiki.action.styles',
        ] );
Severity: Minor
Found in includes/actions/InfoAction.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 getNewtalks has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNewtalks() {
        if ( $this->hideNewTalkMessagesForCurrentSession() ) {
            return '';
        }

Severity: Minor
Found in includes/skins/Skin.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 getDefaultModules has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDefaultModules() {
        $out = $this->getOutput();
        $user = $this->getUser();

        // Modules declared in the $modules literal are loaded
Severity: Minor
Found in includes/skins/Skin.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 onView has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function onView() {
        $out = $this->getOutput();
        $request = $this->getRequest();
        $config = $this->context->getConfig();
        $services = MediaWikiServices::getInstance();
Severity: Minor
Found in includes/actions/HistoryAction.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 validate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate( $values, $alldata ) {
        if ( isset( $this->mParams['required'] )
            && $this->mParams['required'] !== false
            && !$values
        ) {
Severity: Minor
Found in includes/htmlform/fields/HTMLFormFieldCloner.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 validate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate( $value, $alldata ) {
        if ( $this->mParams['interwiki'] && $this->mParams['relative'] ) {
            // relative and interwiki cannot be used together, because we don't have a way to know about
            // namespaces used by the other wiki (and it might actually be a non-wiki link, too).
            throw new InvalidArgumentException( 'relative and interwiki may not be used together' );
Severity: Minor
Found in includes/htmlform/fields/HTMLTitleTextField.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 __construct has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct( $params ) {
        $params += [
            'require-match' => false,
        ];

Severity: Minor
Found in includes/htmlform/fields/HTMLAutoCompleteSelectField.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 generateSkinOptions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function generateSkinOptions( User $user, IContextSource $context, array $validSkinNames ) {
        $ret = [];

        $mptitle = Title::newMainPage();
        $previewtext = $context->msg( 'skin-preview' )->escaped();
Severity: Minor
Found in includes/preferences/DefaultPreferencesFactory.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 translateBlockExpiry has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function translateBlockExpiry( $str, UserIdentity $user = null, $now = 0 ) {
        $duration = $this->getBlockDurations();
        $show = array_search( $str, $duration, true );
        if ( $show !== false ) {
            return trim( $show );
Severity: Minor
Found in includes/language/Language.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 mergeItem has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function mergeItem( $key, &$value, $fallbackValue ) {
        if ( $value !== null ) {
            if ( $fallbackValue !== null ) {
                if ( in_array( $key, self::MERGEABLE_MAP_KEYS ) ) {
                    $value += $fallbackValue;
Severity: Minor
Found in includes/language/LocalisationCache.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 saveSites has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveSites( array $sites ) {
        if ( !$sites ) {
            return true;
        }

Severity: Minor
Found in includes/site/DBSiteStore.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 makeFilteredData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function makeFilteredData() {
        $this->mFilteredExifData = [];

        foreach ( $this->mRawExifData as $section => $data ) {
            if ( !array_key_exists( $section, $this->mExifTags ) ) {
Severity: Minor
Found in includes/media/Exif.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 canBypassForm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function canBypassForm( &$button_name ) {
        $button_name = null;
        if ( $this->isContinued() ) {
            return false;
        }
Severity: Minor
Found in includes/specialpage/LoginSignupSpecialPage.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 fixContradictoryOptions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function fixContradictoryOptions( FormOptions $opts ) {
        $fixed = $this->fixBackwardsCompatibilityOptions( $opts );

        foreach ( $this->filterGroups as $filterGroup ) {
            if ( $filterGroup instanceof ChangesListBooleanFilterGroup ) {
Severity: Minor
Found in includes/specialpage/ChangesListSpecialPage.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 getForm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getForm( array $pagerOptions ) {
        if ( $this->including() ) {
            // Do not show a form when special page is included in wikitext
            return '';
        }
Severity: Minor
Found in includes/specialpage/ContributionsSpecialPage.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 execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $user = $this->getUser();
        if ( !$user->isRegistered()
            || ( $user->isTemp() && !$user->isAllowed( 'editmywatchlist' ) )
        ) {
Severity: Minor
Found in includes/api/ApiWatch.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 stripMetadata has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public static function stripMetadata( $data ) {
        if ( is_array( $data ) || is_object( $data ) ) {
            $isObj = is_object( $data );
            if ( $isObj ) {
                $data = (array)$data;
Severity: Minor
Found in includes/api/ApiResult.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 execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $this->useTransactionalTimeLimit();

        $params = $this->extractRequestParams();

Severity: Minor
Found in includes/api/ApiUndelete.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 execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $params = $this->extractRequestParams();
        $user = $this->getUser();

        // make sure the user is allowed
Severity: Minor
Found in includes/api/ApiTag.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

Severity
Category
Status
Source
Language