wikimedia/mediawiki-extensions-Wikibase

View on GitHub
repo/includes/Rdf/RdfBuilder.php

Summary

Maintainability
C
1 day
Test Coverage

RdfBuilder has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class RdfBuilder implements EntityRdfBuilder, EntityStubRdfBuilder, EntityMentionListener {

    /**
     * A list of entities mentioned/touched to or by this builder.
     * The prefixed entity IDs are used as keys in the array, the value 'true'
Severity: Minor
Found in repo/includes/Rdf/RdfBuilder.php - About 2 hrs to fix

    Method resolveMentionedEntities has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function resolveMentionedEntities(): void {
            $hasRedirect = false;
    
            $this->markStubEntityDataForPrefetching( $this->entitiesResolved );
    
    
    Severity: Minor
    Found in repo/includes/Rdf/RdfBuilder.php - About 1 hr to fix

      Method addEntityPageProps has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function addEntityPageProps( EntityDocument $entity ): void {
              if ( !$this->shouldProduce( RdfProducer::PRODUCE_PAGE_PROPS ) ) {
                  return;
              }
              $pagePropertyDefs = $this->getPagePropertyDefs();
      Severity: Minor
      Found in repo/includes/Rdf/RdfBuilder.php - About 1 hr to fix

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

                RdfVocabulary $vocabulary,
                EntityRdfBuilderFactory $entityRdfBuilderFactory,
                int $flavor,
                RdfWriter $writer,
                DedupeBag $dedupeBag,
        Severity: Major
        Found in repo/includes/Rdf/RdfBuilder.php - About 1 hr to fix

          Function resolveMentionedEntities has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function resolveMentionedEntities(): void {
                  $hasRedirect = false;
          
                  $this->markStubEntityDataForPrefetching( $this->entitiesResolved );
          
          
          Severity: Minor
          Found in repo/includes/Rdf/RdfBuilder.php - About 55 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 addEntityPageProps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function addEntityPageProps( EntityDocument $entity ): void {
                  if ( !$this->shouldProduce( RdfProducer::PRODUCE_PAGE_PROPS ) ) {
                      return;
                  }
                  $pagePropertyDefs = $this->getPagePropertyDefs();
          Severity: Minor
          Found in repo/includes/Rdf/RdfBuilder.php - About 55 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 markStubEntityDataForPrefetching has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function markStubEntityDataForPrefetching( array $entityIds ): void {
                  foreach ( $entityIds as $id ) {
                      if ( !( $id instanceof EntityId ) ) {
                          continue;
                      }
          Severity: Minor
          Found in repo/includes/Rdf/RdfBuilder.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