Showing 1,432 of 2,096 total issues
Method stringParse
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function stringParse( $value ) {
$date = $this->parseDate( $value );
$precision = TimeValue::PRECISION_YEAR;
$time = [ $this->parseFormattedNumber( $date['year'] ), 0, 0, 0, 0, 0 ];
Method getSnakFormatter
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSnakFormatter( $format, FormatterOptions $options ) {
$options->defaultOption( SnakFormatter::OPT_ON_ERROR, SnakFormatter::ON_ERROR_WARN );
$this->valueFormatterFactory->applyLanguageDefaults( $options );
$lang = $options->getOption( ValueFormatter::OPT_LANG );
Function formatSnak
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function formatSnak( Snak $snak ) {
if ( $snak instanceof PropertyValueSnak ) {
$value = $snak->getDataValue();
// FIXME: All usage tracking is technically misplaced here, as it repeats knowledge from
- 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 dumpEntities
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function dumpEntities( array $entityIds, int &$dumpCount ): void {
$toLoad = [];
foreach ( $entityIds as $entityId ) {
if ( $this->idMatchesFilters( $entityId ) ) {
$toLoad[] = $entityId;
- 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 getChangeOps
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getChangeOps( Fingerprint $fingerprint ) {
$changeOpFactory = $this->changeOpFactory;
$changeOps = [];
if ( $this->label !== '' ) {
- 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 formatArg
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function formatArg( $arg ) {
try {
if ( $arg instanceof Snak ) {
return $this->snakFormatter->formatSnak( $arg );
} elseif ( $arg instanceof EntityId ) {
- 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 internalDoHtmlPageLinkRendererEnd
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function internalDoHtmlPageLinkRendererEnd(
LinkRenderer $linkRenderer,
Title $target,
&$text,
array &$customAttribs,
- 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 addStatement
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function addStatement( EntityId $entityId, Statement $statement, $isBest ) {
$statementLName = $this->vocabulary->getStatementLName( $statement );
$entityRepository = $this->vocabulary->getEntityRepositoryName( $entityId );
- 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 buildIndexedAliasesChangeOps
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function buildIndexedAliasesChangeOps( array $indexedAliases ) {
$aliasesChangeOps = new ChangeOps();
foreach ( $indexedAliases as $langCode => $serializations ) {
$aliasesToSet = [];
- 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 getEntityRevision
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getEntityRevision(
EntityId $entityId,
$revisionId = 0,
$mode = LookupConstants::LATEST_FROM_REPLICA
) {
- 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 __construct
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( iterable $snaks, array $certainPropertyIds ) {
foreach ( $certainPropertyIds as $certainPropertyId ) {
/** @var PropertyId $certainPropertyId */
'@phan-var PropertyId $certainPropertyId';
if ( $certainPropertyId !== null ) {
- 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 prefetchTerms
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function prefetchTerms(
array $entityIds,
array $termTypes,
array $languageCodes
) {
- 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 getEntityTermsView
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
SELF.prototype.getEntityTermsView = function ( startEditingCallback, value, $entitytermsview ) {
var controller;
var startEditingController = function () {
return controller.startEditing();
};
Function plot
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function plot( el, historyData ) {
const traces = [];
const annotations = [];
for ( const fileName in historyData ) {
Function installModule
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function installModule (store, rootState, path, module, hot) {
var isRoot = !path.length;
var namespace = store._modules.getNamespace(path);
// register in namespace map
Method getRankedSearchResults
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRankedSearchResults(
$text,
$languageCode,
$entityType,
$limit,
Method run
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(): bool {
// TODO: for v2 of this job, we could actually get all the newest revision from the DB,
// calculate the change_info ourselves and thus make wb_changes table obsolete?
$repoSettings = WikibaseRepo::getSettings();
Method getMediaWikiPermissionsToCheck
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getMediaWikiPermissionsToCheck( $action, $entityType ) {
if ( $action === self::ACTION_MW_CREATE ) {
$entityTypeSpecificCreatePermission = $entityType . '-create';
$permissions = [ 'read', 'edit', 'createpage' ];
Method executeInternal
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function executeInternal(): void {
$params = $this->extractRequestParams();
$statement = $this->getStatementFromParams( $params );
$guid = $statement->getGuid();
Method validate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate( $value ): Result {
if ( !is_string( $value ) ) {
throw new InvalidArgumentException( 'Expected a string' );
}