Showing 51 of 158 total issues

File SpecialSPARQLEndpoint.php has 390 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

class SPARQLEndpoint extends RDFIOSpecialPage {
    protected $sparqlendpoint;
    protected $storewrapper;
Severity: Minor
Found in specials/SpecialSPARQLEndpoint.php - About 5 hrs to fix

    Function toEquivUrisInTriples has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        function toEquivUrisInTriples( $triples, $propUrisFilter = null ) {
    
            $equivUriCache = array();
    
            foreach ( $triples as $tripleidx => $triple ) {
    Severity: Minor
    Found in classes/RDFIO_ARC2StoreWrapper.php - About 3 hrs 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 convert has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        public function convert( $arc2Triples, $arc2ResourceIndex, $arc2NSPrefixes ) {
            // Instatiate wiki title converters (converting from URI and related RDF data to Wiki Title)
            $uriToTitleConv = new RDFIOURIToWikiTitleConverter( $arc2Triples, $arc2ResourceIndex, $arc2NSPrefixes );
            $uriToPropTitleConv = new RDFIOURIToPropertyTitleConverter( $arc2Triples, $arc2ResourceIndex, $arc2NSPrefixes );
    
    
    Severity: Minor
    Found in classes/parsers/RDFIO_ARC2ToWikiConverter.php - About 3 hrs 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

    Method convert has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function convert( $arc2Triples, $arc2ResourceIndex, $arc2NSPrefixes ) {
            // Instatiate wiki title converters (converting from URI and related RDF data to Wiki Title)
            $uriToTitleConv = new RDFIOURIToWikiTitleConverter( $arc2Triples, $arc2ResourceIndex, $arc2NSPrefixes );
            $uriToPropTitleConv = new RDFIOURIToPropertyTitleConverter( $arc2Triples, $arc2ResourceIndex, $arc2NSPrefixes );
    
    
    Severity: Major
    Found in classes/parsers/RDFIO_ARC2ToWikiConverter.php - About 3 hrs to fix

      Method getHTMLForm has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getHTMLForm( $query = '' ) {
              $wRequest = $this->getRequest();
              $wUser = $this->getUser();
              $uriResolverURI = SpecialPage::getTitleFor( 'URIResolver' )->getFullURL() . '/';
              $defaultQuery = "@PREFIX w : <$uriResolverURI> .\n\nSELECT *\nWHERE { ?s ?p ?o }\nLIMIT 25";
      Severity: Major
      Found in specials/SpecialSPARQLEndpoint.php - About 3 hrs to fix

        Function execute has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function execute() {
                $inFile = $this->getOption( 'in', '' );
                $chunksize = intval( $this->getOption( 'chunksize', 0 ) );
                $chunksleep = floatval( $this->getOption( 'chunksleep', 0.0 ) );
                $offset = intval( $this->getOption( 'offset', 0 ) );
        Severity: Minor
        Found in maintenance/importRdf.php - About 3 hrs 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

        File SpecialRDFImport.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        class RDFImport extends RDFIOSpecialPage {
        
            function __construct() {
        Severity: Minor
        Found in specials/SpecialRDFImport.php - About 2 hrs to fix

          Function import has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function import( $limit = 25, $offset = 0 ) {
                  $wOut = $this->getOutput();
                  $wRequest = $this->getRequest();
          
                  $externalSparqlUrl = $wRequest->getText( 'extsparqlurl' );
          Severity: Minor
          Found in specials/SpecialSPARQLImport.php - About 2 hrs 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

          Method getHTMLFormContent has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getHTMLFormContent( $requestData, $user, $extraFormContent = '' ) {
                  $textfieldHiddenHTML = '';
                  $urlChecked = ( $requestData->importSource === 'url' );
                  $textfieldChecked = ( $requestData->importSource === 'textfield' );
          
          
          Severity: Major
          Found in specials/SpecialRDFImport.php - About 2 hrs to fix

            Method execute has 57 lines of code (exceeds 25 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: Major
            Found in specials/SpecialRDFIOAdmin.php - About 2 hrs to fix

              Function importData has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  function importData( RDFIORequestData $requestData ) {
                      $rdfImporter = new RDFIORDFImporter();
                      if ( $requestData->importSource === 'url' ) {
                          if ( $requestData->externalRdfUrl === '' ) {
                              throw new RDFIOException( 'URL field is empty!' );
              Severity: Minor
              Found in specials/SpecialRDFImport.php - About 2 hrs 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 import has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function import( $wikiPages ) {
              
                      // ----------------------------------------------------------------------
                      //  1. Loop over wiki pages
                      // ----------------------------------------------------------------------
              Severity: Minor
              Found in classes/RDFIO_SMWPageWriter.php - About 2 hrs 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 applyGlobalSettingForPropertiesToUseAsWikiTitle has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  function applyGlobalSettingForPropertiesToUseAsWikiTitle( $uri ) {
                      global $rdfiogTitleProperties;
              
                      $title = '';
              
              
              Severity: Minor
              Found in classes/parsers/RDFIO_URIToWikiTitleConverter.php - About 2 hrs 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 splitURI has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function splitURI( $uri ) {
                      global $rdfiogBaseURIs;
                      /* ADAPTED FROM ARC2 WITH SOME MODIFICATIONS
                       * the following namespaces may lead to conflated URIs,
                       * we have to set the split position manually
              Severity: Minor
              Found in classes/parsers/RDFIO_URIToWikiTitleConverter.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 15 (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/SpecialRDFImport.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

              Method execute has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function execute() {
                      $inFile = $this->getOption( 'in', '' );
                      $chunksize = intval( $this->getOption( 'chunksize', 0 ) );
                      $chunksleep = floatval( $this->getOption( 'chunksleep', 0.0 ) );
                      $offset = intval( $this->getOption( 'offset', 0 ) );
              Severity: Minor
              Found in maintenance/importRdf.php - About 1 hr to fix

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

                    private function toEquivURIsInSparqlResults( $sparqlResult ) {
                        $rows = $sparqlResult['result']['rows'];
                        $vars = $sparqlResult['result']['variables'];
                        foreach ( $rows as $rowid => $row ) {
                            foreach ( $vars as $var ) {
                Severity: Minor
                Found in specials/SpecialSPARQLEndpoint.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

                Method import has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function import( $wikiPages ) {
                
                        // ----------------------------------------------------------------------
                        //  1. Loop over wiki pages
                        // ----------------------------------------------------------------------
                Severity: Minor
                Found in classes/RDFIO_SMWPageWriter.php - About 1 hr to fix

                  Method execute has 41 lines of code (exceeds 25 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 1 hr to fix

                    Method execute has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function execute() {
                            $outPath = $this->getOption( 'out', '' );
                            // Serialize to selected output format
                            $format = $this->getOption( 'format', 'rdfxml' );
                    
                    
                    Severity: Minor
                    Found in maintenance/exportRdf.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language