wikimedia/mediawiki-core

View on GitHub

Showing 11,498 of 11,498 total issues

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

    protected function saveNamespaces() {
        $user = $this->getUser();
        $request = $this->getRequest();

        if ( $user->isRegistered() &&
Severity: Minor
Found in includes/specials/SpecialSearch.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 filterDataForSubmit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function filterDataForSubmit( $data ) {
        foreach ( $this->mFlatFields as $fieldname => $field ) {
            if ( $field instanceof HTMLNestedFilterable ) {
                $info = $field->mParams;
                $prefix = $info['prefix'] ?? $fieldname;
Severity: Minor
Found in includes/specials/forms/PreferencesFormOOUI.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 getCellAttrs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getCellAttrs( $field, $value ) {
        $attr = [];
        if ( $field === 'am_title' ) {
            if ( $this->mCurrentRow->am_customised ) {
                $attr += [ 'rowspan' => '2' ];
Severity: Minor
Found in includes/specials/pagers/AllMessagesTablePager.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 getFormFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getFormFields() {
        $config = $this->getConfig();
        $fields = [];

        if ( !$config->get( MainConfigNames::EnableUserEmail ) ) {
Severity: Minor
Found in includes/specials/SpecialMute.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 getPageHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPageHeader() {
        $self = explode( '/', $this->getTitle()->getPrefixedDBkey(), 2 )[0];

        $groupOptions = [ $this->msg( 'group-all' )->text() => '' ];
        foreach ( $this->getAllGroups() as $group => $groupText ) {
Severity: Minor
Found in includes/specials/pagers/UsersPager.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(
        IContextSource $context,
        Language $contentLanguage,
        LanguageFactory $languageFactory,
        LinkRenderer $linkRenderer,
Severity: Minor
Found in includes/specials/pagers/AllMessagesTablePager.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 parseParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function parseParams( string $par ) {
        # Get parameters
        $parms = explode( '/', $par, 2 );
        $symsForAll = [ '*', 'all' ];
        if ( $parms[0] !== '' &&
Severity: Minor
Found in includes/specials/SpecialLog.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 formatRow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function formatRow( $row ) {
        $userName = $row->user_name;

        $ulinks = Linker::userLink( $row->user_id, $userName );
        $ulinks .= Linker::userToolLinks(
Severity: Minor
Found in includes/specials/pagers/ActiveUsersPager.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 doBatchLookups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function doBatchLookups( $list ) {
        $batch = $this->linkBatchFactory->newLinkBatch();
        foreach ( $list as $file ) {
            $batch->addObj( $file->getTitle() );
            if ( $file->isLocal() ) {
Severity: Minor
Found in includes/specials/SpecialFileDuplicateSearch.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 showActivateDeactivateForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function showActivateDeactivateForm( $tag, $activate ) {
        $actionStr = $activate ? 'activate' : 'deactivate';

        $authority = $this->getAuthority();
        if ( !$authority->isAllowed( 'managechangetags' ) ) {
Severity: Minor
Found in includes/specials/SpecialTags.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 getQueryInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getQueryInfo() {
        $dbr = $this->getDatabaseProvider()->getReplicaDatabase();

        $field = 'el_to_domain_index';
        $extraFields = [
Severity: Minor
Found in includes/specials/SpecialLinkSearch.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 showList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function showList( $isbn ) {
        $out = $this->getOutput();

        $isbn = self::cleanIsbn( $isbn );
        # Hook to allow extensions to insert additional HTML,
Severity: Minor
Found in includes/specials/SpecialBookSources.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 getIntroText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getIntroText() {
        $days = $this->getConfig()->get( MainConfigNames::ActiveUserDays );

        $intro = $this->msg( 'activeusers-intro' )->numParams( $days )->parse();

Severity: Minor
Found in includes/specials/SpecialActiveUsers.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 getPagingQueries has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPagingQueries() {
        $queries = parent::getPagingQueries();
        if ( $this->mUserName !== null ) {
            # Append the username to the query string
            foreach ( $queries as &$query ) {
Severity: Minor
Found in includes/specials/pagers/ImageListPager.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 accesskey has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function accesskey( $name, $localizer = null ) {
        if ( !isset( self::$accesskeycache[$name] ) ) {
            if ( !$localizer ) {
                $localizer = self::getContextFromMain();
            }
Severity: Minor
Found in includes/linker/Linker.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 logException has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function logException(
        Throwable $e,
        $catcher = self::CAUGHT_BY_OTHER,
        $extraData = []
    ) {
Severity: Minor
Found in includes/exception/MWExceptionHandler.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 getFormFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getFormFields() {
        $resetRoutes = $this->getConfig()->get( MainConfigNames::PasswordResetRoutes );
        $a = [];
        if ( isset( $resetRoutes['username'] ) && $resetRoutes['username'] ) {
            $a['Username'] = [
Severity: Minor
Found in includes/specials/SpecialPasswordReset.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( $par ) {
        $context = new DerivativeContext( $this->getContext() );

        $this->setHeaders();
        $this->outputHeader();
Severity: Minor
Found in includes/specials/SpecialNewFiles.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 getFieldNames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getFieldNames() {
        if ( !$this->mFieldNames ) {
            $this->mFieldNames = [
                'img_timestamp' => $this->msg( 'listfiles_date' )->text(),
                'img_name' => $this->msg( 'listfiles_name' )->text(),
Severity: Minor
Found in includes/specials/pagers/ImageListPager.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 prepareErrorPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepareErrorPage( $pageTitle = null, $htmlTitle = false ) {
        if ( $pageTitle !== null || $htmlTitle !== false ) {
            wfDeprecated( __METHOD__ . ' with explicit arguments', '1.41' );
            if ( $pageTitle !== null ) {
                $this->setPageTitle( $pageTitle );
Severity: Minor
Found in includes/Output/OutputPage.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