Showing 2,096 of 2,096 total issues
Function generateDump
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function generateDump( EntityIdPager $idPager ): void {
$dumpCount = 0;
$this->preDump();
- 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 getTermsSerializationWithFallbackInfo
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getTermsSerializationWithFallbackInfo(
array $serialization,
array $termFallbackChains
) {
$newSerialization = $serialization;
- 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 __construct
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $mainModule,
string $moduleName,
StringNormalizer $stringNormalizer,
LanguageFallbackChainFactory $languageFallbackChainFactory,
SiteLinkGlobalIdentifiersProvider $siteLinkGlobalIdentifiersProvider,
Function collectNewAndOldTerms
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function collectNewAndOldTerms( ChangeOpFingerprintResult $changeOpsResult ): array {
$traversable = $this->makeRecursiveTraversable( $changeOpsResult );
$newTerms = [];
$oldTerms = [];
- 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 __construct
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
EntityDataUriManager $uriManager,
HTMLCacheUpdater $htmlCacheUpdater,
EntityIdParser $entityIdParser,
EntityRevisionLookup $entityRevisionLookup,
EntityRedirectLookup $entityRedirectLookup,
Function next
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function next() {
$id = null;
while ( $id === null ) {
$this->reader->next();
- 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 cleanupGregorianValue
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function cleanupGregorianValue( $dateValue, $precision ) {
try {
[ $minus, $y, $m, $d, $time ] = $this->parseDateValue( $dateValue );
} catch ( IllegalValueException $e ) {
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
Method factory
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
Language $contentLanguage,
HttpRequestFactory $httpRequestFactory,
IBufferingStatsdDataFactory $statsdDataFactory,
UserOptionsLookup $userOptionsLookup,
EntityContentFactory $entityContentFactory,
Function addSiteLinks
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function addSiteLinks( Item $item ) {
$id = $item->getId();
$entityLName = $this->vocabulary->getEntityLName( $id );
$entityRepoName = $this->vocabulary->getEntityRepositoryName( $id );
- 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 equals
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function equals( Content $that = null ) {
if ( $that === $this ) {
return true;
}
- 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 execute
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
if ( !WikibaseSettings::isRepoEnabled() ) {
$this->fatalError( "You need to have Wikibase enabled in order to use this maintenance script!" );
}
$format = $this->getOption( 'format', 'json' );
- 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 getTermMatchQueries
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getTermMatchQueries(
IReadableDatabase $dbr,
TermIndexSearchCriteria $mask,
string $entityType,
$termType = 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 assertConfigArrayWellFormed
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function assertConfigArrayWellFormed( array $sourceConfig ) {
Assert::parameterElementType( 'array', $sourceConfig, '$sourceConfig' );
foreach ( $sourceConfig as $sourceName => $sourceData ) {
if ( !is_string( $sourceName ) ) {
- 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 __construct
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
EntityIdParser $entityIdParser,
EntityIdComposer $entityIdComposer,
Deserializer $dataValueDeserializer,
NameTableStore $slotRoleStore,
DataAccessSettings $dataAccessSettings,
Similar blocks of code found in 2 locations. Consider refactoring. Open
public async trackSavingErrorsFallingBackToGenericView(): Promise<void> {
for ( const error of this.state.applicationErrors ) {
this.store.$services.get( 'tracker' ).trackSavingUnknownError( error.type );
}
}
- 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 70.
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 async trackErrorsFallingBackToGenericView(): Promise<void> {
for ( const error of this.state.applicationErrors ) {
this.store.$services.get( 'tracker' ).trackUnknownError( error.type );
}
}
- 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 70.
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 show
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
show: function () {
var self = this;
// eslint-disable-next-line no-jquery/no-sizzle
if ( this._tipsy.$tip && this._tipsy.$tip.is( ':visible' ) ) {
Function show
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
show: function () {
var self = this;
// eslint-disable-next-line no-jquery/no-sizzle
if ( this._tipsy.$tip && this._tipsy.$tip.is( ':visible' ) ) {
Function _create
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
_create: function () {
var self = this,
widgetName = this.widgetName,
$menu = this._buildMenu().appendTo( document.body ).hide();
Method getRevisionHeader
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRevisionHeader( RevisionRecord $rev, $complete = '' ) {
//NOTE: This must be kept in sync with the parent implementation.
// Perhaps some parts could be factored out to reduce code duplication.
$lang = $this->getLanguage();