Showing 158 of 158 total issues

Method getExampleTurtleData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getExampleTurtleData() {
        $exampleData = <<<EOT
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\\n\
@prefix cd: <http://www.recshop.fake/cd#> .\\n\
@prefix countries: <http://www.countries.org/onto/> .\\n\
Severity: Minor
Found in specials/SpecialRDFImport.php - About 1 hr to fix

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

        protected function getHTMLForm( $buttonText, $limit, $offset ) {
            global $wgArticlePath;
            $wRequest = $this->getRequest();
            $wUser = $this->getUser();
    
    
    Severity: Minor
    Found in specials/SpecialSPARQLImport.php - About 1 hr to fix

      Method splitURI has 29 lines of code (exceeds 25 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

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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          if ( array_key_exists( $objUri, $equivUriCache ) ) {
                              $triples[$tripleidx]['o'] = $equivUriCache[$objUri];
                          } else {
                              $objEquivUris = $this->getEquivURIsForURI( $objUri );
                              if ( count( $objEquivUris ) > 0 ) {
          Severity: Minor
          Found in classes/RDFIO_ARC2StoreWrapper.php and 1 other location - About 1 hr to fix
          classes/RDFIO_ARC2StoreWrapper.php on lines 50..58

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      if ( array_key_exists( $subjUri, $equivUriCache ) ) {
                          $triples[$tripleidx]['s'] = $equivUriCache[$subjUri];
                      } else {
                          $subjEquivUris = $this->getEquivURIsForURI( $subjUri );
                          if ( count( $subjEquivUris ) > 0 ) {
          Severity: Minor
          Found in classes/RDFIO_ARC2StoreWrapper.php and 1 other location - About 1 hr to fix
          classes/RDFIO_ARC2StoreWrapper.php on lines 79..87

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              public function updateData( SMWSemanticData $data ) {
                  // NOTE: Should doDataUpdate() be used instead? (See SMWStore class)
                  $exportData = SMWExporter::getInstance()->makeExportData( $data );
                  $subjectUri = SMWExporter::getInstance()->expandURI( $exportData->getSubject()->getUri() );
          
          
          Severity: Minor
          Found in stores/SMW_ARC2Store.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

          Avoid variables with short names like $o. Configured minimum length is 3.
          Open

                      $o = $triple['o'];
          Severity: Minor
          Found in classes/RDFIO_RDFImporter.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $ns. Configured minimum length is 3.
          Open

                  $ns = Title::newFromDBkey( $this->getTitle() )->getNamespace();
          Severity: Minor
          Found in classes/RDFIO_WikiPage.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $p. Configured minimum length is 3.
          Open

                      $p = $triple['p'];
          Severity: Minor
          Found in classes/RDFIO_RDFImporter.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $s. Configured minimum length is 3.
          Open

                      $s = $triple['s'];
          Severity: Minor
          Found in classes/RDFIO_RDFImporter.php by phpmd

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Function getURIForEquivURI has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getURIForEquivURI( $equivUri, $isProperty = false ) {
                  $uri = '';
                  if ( $isProperty ) {
                      $equivUriUri = self::EQUIV_PROPERTY_URI;
                  } else {
          Severity: Minor
          Found in classes/RDFIO_ARC2StoreWrapper.php - About 45 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

          The class SPARQLEndpoint has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
          Open

          class SPARQLEndpoint extends RDFIOSpecialPage {
              protected $sparqlendpoint;
              protected $storewrapper;
          
              public function __construct() {
          Severity: Minor
          Found in specials/SpecialSPARQLEndpoint.php by phpmd

          CouplingBetweenObjects

          Since: 1.1.0

          A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

          Example

          class Foo {
              /**
               * @var \foo\bar\X
               */
              private $x = null;
          
              /**
               * @var \foo\bar\Y
               */
              private $y = null;
          
              /**
               * @var \foo\bar\Z
               */
              private $z = null;
          
              public function setFoo(\Foo $foo) {}
              public function setBar(\Bar $bar) {}
              public function setBaz(\Baz $baz) {}
          
              /**
               * @return \SplObjectStorage
               * @throws \OutOfRangeException
               * @throws \InvalidArgumentException
               * @throws \ErrorException
               */
              public function process(\Iterator $it) {}
          
              // ...
          }

          Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

              function showImportedTriples( $triples ) {
                  $output = "";
                  $styleCss = <<<EOD
                          table .rdfio- th {
                              font-weight: bold;
          Severity: Minor
          Found in classes/RDFIO_RDFImporter.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

          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

          Missing class import via use statement (line '18', column '14').
          Open

                      throw new PermissionsError( 'rdfio-import', array( 'rdfio-specialpage-access-permission-missing' ) );
          Severity: Minor
          Found in specials/SpecialRDFImport.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '80', column '24').
          Open

                  $smwPageWriter = new RDFIOSMWPageWriter();
          Severity: Minor
          Found in classes/RDFIO_RDFImporter.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '131', column '14').
          Open

                      throw new RDFIOARC2StoreException( $error );
          Severity: Minor
          Found in stores/SMW_ARC2Store.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '78', column '14').
          Open

                      throw new RDFIOException( 'Import source is not selected!' );
          Severity: Minor
          Found in specials/SpecialRDFImport.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '13', column '29').
          Open

                  $this->storewrapper = new RDFIOARC2StoreWrapper();
          Severity: Minor
          Found in specials/SpecialSPARQLEndpoint.php by phpmd

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Severity
          Category
          Status
          Source
          Language