Showing 158 of 158 total issues
Avoid excessively long variable names like $rdfiogQueryByEquivURIs. Keep variable name length under 20. Open
global $rdfiogQueryByEquivURIs, $rdfiogOutputEquivUris;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $rdfiogTitleProperties. Keep variable name length under 20. Open
global $rdfiogTitleProperties;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $rdfiogTitleProperties. Keep variable name length under 20. Open
global $rdfiogTitleProperties;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $rdfiogTitleProperties. Keep variable name length under 20. Open
global $rdfiogTitleProperties;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
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' );
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() ) ) {
Method import
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function import( $wikiPages ) {
// ----------------------------------------------------------------------
// 1. Loop over wiki pages
// ----------------------------------------------------------------------
Method import
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function import( $limit = 25, $offset = 0 ) {
$wOut = $this->getOutput();
$wRequest = $this->getRequest();
$externalSparqlUrl = $wRequest->getText( 'extsparqlurl' );
Method executeReadOnlyQuery
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function executeReadOnlyQuery( $options ) {
$wikiOut = $this->getOutput();
$outputSer = $this->passSparqlToARC2AndGetSerializedOutput();
Function execute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$outPath = $this->getOption( 'out', '' );
// Serialize to selected output format
$format = $this->getOption( 'format', 'rdfxml' );
- Read upRead up
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 create
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create() {
$wikiPageData = array(
'Category:RDFIO Data Source' => array(
'title' => 'RDFIO Data Source',
Method toEquivUrisInTriples
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function toEquivUrisInTriples( $triples, $propUrisFilter = null ) {
$equivUriCache = array();
foreach ( $triples as $tripleidx => $triple ) {
Method getExampleRDFXMLData
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getExampleRDFXMLData() {
return '<rdf:RDF\\n\
xmlns:rdf=\\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\\"\\n\
xmlns:cd=\\"http://www.recshop.fake/cd#\\"\\n\
xmlns:countries=\\"http://www.countries.org/onto/\\"\\n\
Function executeReadOnlyQuery
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function executeReadOnlyQuery( $options ) {
$wikiOut = $this->getOutput();
$outputSer = $this->passSparqlToARC2AndGetSerializedOutput();
- Read upRead up
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 33 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-import permission for the current user
if ( !$this->userCanExecute( $this->getUser() ) ) {
Method getJsCode
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getJsCode() {
$jsCode = '
<script type="text/javascript">
function pasteExampleRDFXMLData(textFieldId) {
var textfield = document.getElementById(textFieldId);
Method execute
has 32 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-import permission for the current user
if ( !$this->userCanExecute( $this->getUser() ) ) {
Method updateData
has 31 lines of code (exceeds 25 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() );
Method showImportedTriples
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showImportedTriples( $triples ) {
$output = "";
$styleCss = <<<EOD
table .rdfio- th {
font-weight: bold;
Method extendQueryPatternsWithEquivUriLinks
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function extendQueryPatternsWithEquivUriLinks( $patterns ) {
$patternIdx = 0;
foreach ( $patterns as $pattern ) {
$equivUriUris = array(
's' => $this->storewrapper->getEquivURIURI(),