Showing 51 of 158 total issues

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

    private function updateTemplateCalls( $fact, $propTplIndex, $oldTemplateCalls, $wikiText ) {
        $prop = $fact['p'];
        $newVal = $fact['o'];

        if ( array_key_exists( $prop, $propTplIndex ) ) {
Severity: Minor
Found in classes/RDFIO_SMWPageWriter.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

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in specials/SpecialSPARQLEndpoint.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return;
    Severity: Major
    Found in specials/SpecialSPARQLEndpoint.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return array( $uri, '' );
      Severity: Major
      Found in classes/parsers/RDFIO_URIToWikiTitleConverter.php - About 30 mins to fix

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

            public function getEquivURIsForURI( $uri ) {
                $equivUris = array();
        
                $query = 'SELECT ?equivUri WHERE { { <' . $uri . '> <' . self::EQUIV_URI . '> ?equivUri } UNION { <' . $uri . '> <' . self::EQUIV_PROPERTY_URI . '> ?equivUri } }';
                $results = $this->arc2store->query( $query );
        Severity: Minor
        Found in classes/RDFIO_ARC2StoreWrapper.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 abbreviateParserNSPrefixes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            function abbreviateParserNSPrefixes( $uri, $nsPrefixes ) {
                foreach ( $nsPrefixes as $namespace => $prefix ) {
                    $nslength = strlen( $namespace );
                    $basepart = '';
                    $localpart = '';
        Severity: Minor
        Found in classes/parsers/RDFIO_URIToWikiTitleConverter.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

            function execute( $par ) {
                unset( $par ); // Needed to suppress warning about unused variable which we include just for consistency.
        
                // Require rdfio-import permission for the current user
                if ( !$this->userCanExecute( $this->getUser() ) ) {
        Severity: Minor
        Found in specials/SpecialSPARQLImport.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

            function execute( $par ) {
                unset( $par ); // Needed to suppress warning about unused variable which we include just for consistency.
        
                // Require rdfio-admin permission for the current user
                if ( !$this->userCanExecute( $this->getUser() ) ) {
        Severity: Minor
        Found in specials/SpecialRDFIOAdmin.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 extendQueryPatternsWithEquivUriLinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function extendQueryPatternsWithEquivUriLinks( $patterns ) {
                $patternIdx = 0;
                foreach ( $patterns as $pattern ) {
                    $equivUriUris = array(
                        's' => $this->storewrapper->getEquivURIURI(),
        Severity: Minor
        Found in specials/SpecialSPARQLEndpoint.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 ) {
                unset( $par ); // Needed to suppress warning about unused variable which we include just for consistency.
        
                // Require rdfio-sparql permission for the current user
                if ( !$this->userCanExecute( $this->getUser() ) ) {
        Severity: Minor
        Found in specials/SpecialSPARQLEndpoint.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 buildPropertyTemplateParamIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function buildPropertyTemplateParamIndex( $newFacts, $allTemplateFacts ) {
                // Build the index
                $propTplIndex = array();
                foreach ( $newFacts  as $fact ) {
                    $prop = $fact['p'];
        Severity: Minor
        Found in classes/RDFIO_SMWPageWriter.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