Showing 2,096 of 2,096 total issues
Method getChangedAspects
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getChangedAspects( EntityChange $change ) {
$aspects = [];
$diffAspects = $change->getCompactDiff();
if ( $diffAspects->getSiteLinkChanges() !== [] ) {
Method generateOpHtml
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateOpHtml( array $path, DiffOp $op ) {
if ( $op->isAtomic() ) {
$localizedPath = $path;
$html = $this->generateDiffHeaderHtml( implode( ' / ', $localizedPath ) );
Method generateNewId
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateNewId( IDatabase $database, $type, $retry = true ) {
$database->startAtomic( __METHOD__ );
$currentId = $database->newSelectQueryBuilder()
->select( 'id_value' )
Method getAllowedParams
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getAllowedParams(): array {
return array_merge(
[
'claim' => [
ParamValidator::PARAM_TYPE => 'string',
Method validateTermSerialization
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateTermSerialization( $serialization, $languageCode ) {
$this->assertArray(
$serialization,
'An array was expected, but not found in term serialization for the language code ' . $languageCode
);
Method processUnit
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function processUnit( $unit ) {
$this->output( "Processing $unit...\n" );
$query = <<<QUERY
SELECT * WHERE {
{
Method validateAndDeserialize
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateAndDeserialize( UseCaseRequest $request ): DeserializedRequestAdapter {
$requestObjectId = spl_object_id( $request );
if ( array_key_exists( $requestObjectId, $this->validRequestResults ) ) {
return $this->validRequestResults[$requestObjectId];
}
Method execute
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( ReplaceStatementRequest $request ): ReplaceStatementResponse {
$deserializedRequest = $this->validator->validateAndDeserialize( $request );
$statementId = $deserializedRequest->getStatementId();
$statement = $deserializedRequest->getStatement();
$editMetadata = $deserializedRequest->getEditMetadata();
Method __construct
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( array $fields = [] ) {
Assert::parameter(
!array_diff( array_keys( $fields ), self::FIELD_NAMES ),
'$fields',
'must only contain the following keys: termType, termLanguage, termText'
Method newFromEntityDiff
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function newFromEntityDiff( Diff $entityDiff ) {
$labelChanges = [];
$descriptionChanges = [];
$statementChanges = [];
$siteLinkChanges = [];
Identical blocks of code found in 2 locations. Consider refactoring. Open
private function getLuaFunctionCallTracker(): LuaFunctionCallTracker {
if ( !$this->luaFunctionCallTracker ) {
$mwServices = MediaWikiServices::getInstance();
$settings = WikibaseClient::getSettings( $mwServices );
- 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 111.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
private function getLuaFunctionCallTracker(): LuaFunctionCallTracker {
if ( !$this->luaFunctionCallTracker ) {
$mwServices = MediaWikiServices::getInstance();
$settings = WikibaseClient::getSettings( $mwServices );
- 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 111.
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
Method __construct
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
Article $article,
IContextSource $context,
PermissionManager $permissionManager,
RevisionLookup $revisionLookup,
TempUserCreator $tempUserCreator,
Method __construct
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
array $tags,
SpecialPageCopyrightView $specialPageCopyrightView,
EntityNamespaceLookup $entityNamespaceLookup,
SummaryFormatter $summaryFormatter,
EntityTitleLookup $entityTitleLookup,
Method __construct
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $mainModule,
string $moduleName,
DeserializerFactory $deserializerFactory,
ApiErrorReporter $errorReporter,
StatementChangeOpFactory $statementChangeOpFactory,
Method __construct
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
array $tags,
SpecialPageCopyrightView $copyrightView,
SummaryFormatter $summaryFormatter,
EntityTitleLookup $entityTitleLookup,
MediaWikiEditEntityFactory $editEntityFactory,
Method factory
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $apiMain,
string $moduleName,
SiteLookup $siteLookup,
IBufferingStatsdDataFactory $stats,
ApiHelperFactory $apiHelperFactory,
Method __construct
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $mainModule,
string $moduleName,
ApiErrorReporter $errorReporter,
Deserializer $statementDeserializer,
StatementChangeOpFactory $statementChangeOpFactory,
Method factory
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
InterwikiLookup $interwikiLookup,
SpecialPageFactory $specialPageFactory,
EntityExistenceChecker $entityExistenceChecker,
EntityIdParser $entityIdParser,
EntityLinkFormatterFactory $entityLinkFormatterFactory,
Method __construct
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
FingerprintChangeOpFactory $fingerprintChangeOpFactory,
StatementChangeOpFactory $statementChangeOpFactory,
SiteLinkChangeOpFactory $siteLinkChangeOpFactory,
TermChangeOpSerializationValidator $termChangeOpSerializationValidator,
SiteLinkBadgeChangeOpSerializationValidator $badgeChangeOpSerializationValidator,