Showing 2,096 of 2,096 total issues
Function newFromEntityDiff
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
public function newFromEntityDiff( Diff $entityDiff ) {
$labelChanges = [];
$descriptionChanges = [];
$statementChanges = [];
$siteLinkChanges = [];
- 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
Function validateDatabaseSourceConfigFields
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
private function validateDatabaseSourceConfigFields( $sourceData, $sourceName ) {
if ( !is_string( $sourceData['repoDatabase'] ) && $sourceData['repoDatabase'] !== false ) {
throw new InvalidArgumentException(
'Symbolic database name of entity source "' . $sourceName . '" should be a string or false.'
);
- 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
Function setAliases
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setAliases: function ( aliases, tempUserWatcher ) {
var deferred = $.Deferred(),
self = this,
language = aliases.getLanguageCode(),
initialAliases = this._getInitialAliases( language );
Function drawSnakTypeSelector
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
drawSnakTypeSelector: function () {
if ( this.options.locked.snaktype && this.$snakTypeSelector.contents().length ) {
return;
}
Function exports
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
Function get
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get: (_target, prop) => {
if (this.target) {
return this.target[prop];
}
else if (prop === 'on') {
Method getEntityId
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getEntityId( $pageTitle, $globalSiteId ) {
$globalSiteId = $globalSiteId ?: $this->siteId;
$entityId = null;
if ( $globalSiteId === $this->siteId ) {
Method __construct
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct(
EntityChangeLookup $changeLookup,
EntityChangeFactory $changeFactory,
RecentChangeFactory $rcFactory,
TitleFactory $titleFactory,
Method onSkinAfterBottomScripts
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function onSkinAfterBottomScripts( Skin $skin, &$html ) {
$services = MediaWikiServices::getInstance();
$enabledNamespaces = WikibaseClient::getSettings( $services )
->getSetting( 'pageSchemaNamespaces' );
Method getRedirectForEntityId
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getRedirectForEntityId( EntityId $entityId, $forUpdate = '' ) {
try {
$title = $this->entityTitleLookup->getTitleForId( $entityId );
} catch ( \Exception $ex ) {
// TODO: Catch more specific type of exception once EntityTitleStoreLookup contract is clarified
Method getTrackedExtensions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getTrackedExtensions(): array {
$extensions = [
'WikibaseManifest' => 'WBM',
'EntitySchema' => 'ENS',
'PropertySuggester' => 'PS',
Method getAllowedParams
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getAllowedParams(): array {
return [
'datatype' => [
ParamValidator::PARAM_TYPE => $this->dataTypeFactory->getTypeIds(),
ParamValidator::PARAM_REQUIRED => false,
Method getAllowedParams
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getAllowedParams(): array {
return array_merge(
[
'claim' => [
ParamValidator::PARAM_TYPE => 'string',
Method getExamplesMessages
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getExamplesMessages(): array {
$query = 'action=' . $this->getModuleName();
$hello = new StringValue( 'hello' );
$acme = new StringValue( 'http://acme.org' );
$einsteinDob = new TimeValue(
Method verifyValid
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function verifyValid( Item $item ): bool {
$params = $this->getParams();
$siteId = $params['siteId'];
$page = $params['title'];
Method execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute(): void {
$this->getMain()->setCacheMode( 'public' );
$params = $this->extractRequestParams();
$this->requireMaxOneParameter( $params, 'property', 'datatype' );
Method getAllowedParams
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getAllowedParams(): array {
return array_merge(
[
'statement' => [
ParamValidator::PARAM_TYPE => 'string',
Method execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute() {
if ( !ExtensionRegistry::getInstance()->isLoaded( 'WikibaseRepository' ) ) {
$this->fatalError(
"You need to have Wikibase enabled in order to use this "
. "maintenance script!\n\n",
Method getDataTypeIdForProperty
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getDataTypeIdForProperty( PropertyId $propertyId ) {
$dataTypeId = null;
$info = $this->infoLookup->getPropertyInfo( $propertyId );
if ( $info !== null && isset( $info[PropertyInfoLookup::KEY_DATA_TYPE] ) ) {
Method splitNamespaceAndSlot
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function splitNamespaceAndSlot( $namespaceAndSlot ) {
if ( is_int( $namespaceAndSlot ) ) {
return [ $namespaceAndSlot, SlotRecord::MAIN ];
}