wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub
includes/Search/FullTextResultsType.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method transformElasticsearchResult has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function transformElasticsearchResult( ElasticaResultSet $result ) {
        // Should we make this a concrete class?
        return new class(
            $this->titleHelper,
            $this->fetchPhaseBuilder,
Severity: Major
Found in includes/Search/FullTextResultsType.php - About 2 hrs to fix

    Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

                    TitleHelper $titleHelper,
                    FetchPhaseConfigBuilder $builder,
                    ElasticaResultSet $results,
                    $searchContainedSyntax,
                    array $extraFieldsToExtract,
    Severity: Minor
    Found in includes/Search/FullTextResultsType.php - About 45 mins to fix

      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              FetchPhaseConfigBuilder $fetchPhaseBuilder,
              $searchContainedSyntax,
              TitleHelper $titleHelper,
              array $extraFieldsToExtract = [],
              bool $deduplicate = false
      Severity: Minor
      Found in includes/Search/FullTextResultsType.php - About 35 mins to fix

        Function transformOneResult has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                    protected function transformOneResult( \Elastica\Result $result ) {
                        $source = $result->getSource();
                        if ( $source['namespace'] === NS_FILE ) {
                            if ( in_array( $source['title'], $this->fileTitles ) ) {
                                if ( $this->deduplicate ) {
        Severity: Minor
        Found in includes/Search/FullTextResultsType.php - About 35 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

        There are no issues that match your filters.

        Category
        Status