Showing 2,096 of 2,096 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
private function renderLabelValuePair( $fieldName, $valueHtml ) {
$html = Html::openElement( 'tr' );
$html .= Html::element( 'th', [ 'class' => 'wb-quantity-' . $fieldName ],
$this->getFieldLabel( $fieldName )->text() );
- 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 112.
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 getParamSettings(): array {
return [
self::PROPERTY_ID_PATH_PARAM => [
self::PARAM_SOURCE => 'path',
ParamValidator::PARAM_TYPE => 'string',
- 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 112.
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 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' );
}
Method createEntity
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createEntity( $entityType, EntityId $customId = null, $assignFreshId = self::ASSIGN_FRESH_ID ): EntityDocument {
if ( $customId ) {
$entityType = $customId->getEntityType();
} elseif ( !$entityType ) {
$this->errorReporter->dieError(
Method validateDataValue
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateDataValue( DataValue $dataValue, $dataTypeId ) {
try {
$dataValueType = $this->dataTypeFactory->getType( $dataTypeId )->getDataValueType();
} catch ( OutOfBoundsException $ex ) {
return Result::newError( [
Method initFormats
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function initFormats() {
if ( $this->mimeTypes !== null && $this->fileExtensions !== null ) {
return;
}
Method execute
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( PatchPropertyLabelsRequest $request ): PatchPropertyLabelsResponse {
$deserializedRequest = $this->useCaseValidator->validateAndDeserialize( $request );
$propertyId = $deserializedRequest->getPropertyId();
$this->assertPropertyExists->execute( $propertyId );
Method throwUseCaseError
has 39 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] );
Similar blocks of code found in 2 locations. Consider refactoring. Open
function ( model, toolbar, view, removeView, startEditingCallback ) {
this._model = model;
this._toolbar = toolbar;
this._view = view;
this._removeView = removeView;
- 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 66.
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
function ( formatValueCaller, additionalOptions, dataTypeId, propertyId, outputType ) {
this._formatValueCaller = formatValueCaller;
this._options = additionalOptions;
this._dataTypeId = dataTypeId;
this._propertyId = propertyId;
- 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 66.
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
private addStopEditingHook( store: Store<Application> ): void {
this.mwHooks( 'wikibase.statement.stopEditing' ).add( ( guid: string ) => {
store.dispatch( STOP_EDIT, guid );
} );
}
- 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 66.
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
private addStartEditingHook( store: Store<Application> ): void {
this.mwHooks( 'wikibase.statement.startEditing' ).add( ( guid: string ) => {
store.dispatch( START_EDIT, guid );
} );
}
- 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 66.
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 updateVariation
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateVariation: function () {
var value = this.value(),
propertyId = value ? value.property : null,
snakType = value ? value.snaktype : null,
VariationConstructor = snakType ? variations.getVariation( snakType ) : null;