Showing 2,096 of 2,096 total issues
Method createEntityChangeOp
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createEntityChangeOp( array $changeRequest ) {
$this->assertArray( $changeRequest['sitelinks'], 'List of sitelinks must be an array' );
$siteLinksChangeOps = new ChangeOps();
$sites = $this->siteLinkTargetProvider->getSiteList( $this->siteLinkGroups );
Method convertToFormattableSummary
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function convertToFormattableSummary( EditSummary $editSummary ): FormatableSummary {
switch ( true ) {
case $editSummary instanceof PatchPropertyEditSummary:
return $this->wholeEntityEditSummaryConverter->newSummaryForPropertyPatch( $editSummary );
Method execute
has 36 lines of code (exceeds 25 allowed). Consider refactoring. 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 validate
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate(
?string $itemId,
string $siteId,
array $sitelink,
string $basePath = ''
Method execute
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
if ( WikibaseRepo::getSettings()
->getSetting( 'enablePopulateWithRandomEntitiesAndTermsScript' ) !== true
) {
$this->output(
Method throwUseCaseError
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function throwUseCaseError( ValidationError $validationError ): void {
$context = $validationError->getContext();
switch ( $validationError->getCode() ) {
case LanguageCodeValidator::CODE_INVALID_LANGUAGE_CODE:
throw UseCaseError::newPatchResultInvalidKey( '', $context[LanguageCodeValidator::CONTEXT_LANGUAGE_CODE] );
Method execute
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( PatchPropertyDescriptionsRequest $request ): PatchPropertyDescriptionsResponse {
$deserializedRequest = $this->useCaseValidator->validateAndDeserialize( $request );
$propertyId = $deserializedRequest->getPropertyId();
$this->assertPropertyExists->execute( $propertyId );
Method format
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function format( $value ) {
if ( !( $value instanceof TimeValue ) ) {
throw new InvalidArgumentException( 'Data value type mismatch. Expected a TimeValue.' );
}
Method toStandardUnits
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toStandardUnits( UnboundedQuantityValue $value ) {
$fromUnit = $value->getUnit();
if ( $fromUnit === '1' ) {
// Won't convert unitless values
Method saveLinksOfItem
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveLinksOfItem( Item $item ): bool {
//First check whether there's anything to update
$newLinks = $item->getSiteLinkList()->toArray();
$oldLinks = $this->getSiteLinksForItem( $item->getId() );
Similar blocks of code found in 2 locations. Consider refactoring. Open
'WikibaseClient.TermFallbackCacheFactory' => function ( MediaWikiServices $services ): TermFallbackCacheFactory {
$settings = WikibaseClient::getSettings( $services );
return new TermFallbackCacheFactory(
$settings->getSetting( 'sharedCacheType' ),
WikibaseClient::getLogger( $services ),
- Read upRead up
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 109.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
'WikibaseRepo.TermFallbackCacheFactory' => function ( MediaWikiServices $services ): TermFallbackCacheFactory {
$settings = WikibaseRepo::getSettings( $services );
return new TermFallbackCacheFactory(
$settings->getSetting( 'sharedCacheType' ),
WikibaseRepo::getLogger( $services ),
- Read upRead up
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 109.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function __construct(
EntityTitleStoreLookup $titleLookup,
EntityRevisionLookup $entityLookup,
EntityStore $entityStore,
EntityPermissionChecker $permissionChecker,
- Read upRead up
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 109.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function __construct(
FingerprintChangeOpFactory $fingerprintChangeOpFactory,
StatementChangeOpFactory $statementChangeOpFactory,
SiteLinkChangeOpFactory $siteLinkChangeOpFactory,
TermChangeOpSerializationValidator $termChangeOpSerializationValidator,
- Read upRead up
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 109.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function 3f4e
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setupDevtoolsPlugin", function() { return setupDevtoolsPlugin; });
/* harmony import */ var _env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("abc5");
- 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 termFallbackResolver
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
wikibase.view.termFallbackResolver = ( function ( wb ) {
'use strict';
var SELF = {};
- 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 7c73
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__("825a");
var defineProperties = __webpack_require__("37e8");
var enumBugKeys = __webpack_require__("7839");
- 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 getSiteLinkMessage
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function getSiteLinkMessage( $action, Diff $siteLinkDiff, Title $title = null ) {
if ( $siteLinkDiff->isEmpty() ) {
return 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 findImplicitUsages
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function findImplicitUsages( array $entityIds ): array {
$numericItemIds = [];
foreach ( $entityIds as $entityId ) {
if ( $entityId instanceof ItemId ) {
$numericItemIds[] = $entityId->getNumericId();
- 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 getEntityIds
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getEntityIds( array $sites, array $titles, $normalize ) {
$ids = [];
$numSites = count( $sites );
$numTitles = count( $titles );
- 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"