Showing 3,654 of 3,654 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
<div>
<Button
text={gettext('Print')}
icon="print"
iconOnly
- 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
<div>
<Button
text={gettext('Print')}
icon="print"
iconOnly
- 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
File rundowns-list.tsx
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as React from 'react';
import {WithSizeObserver, ContentListItem, Label, IconButton, Menu, Alert} from 'superdesk-ui-framework/react';
import {IRundown, IRundownFilters, IRundownItem, IRundownTemplate, IShow} from '../interfaces';
File DesksFactory.ts
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash';
import {gettext} from 'core/utils';
import {IDesk} from 'superdesk-api';
import {logger} from 'core/services/logger';
import {dispatchCustomEvent} from 'core/get-superdesk-api-implementation';
Function SearchWidgetCtrl
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function SearchWidgetCtrl($scope, packages: IPackagesService, api, search) {
$scope.selected = null;
$scope.multiSelected = [];
$scope.query = null;
$scope.highlight = null;
Function getPlaceAdapter
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getPlaceAdapter(): IFieldAdapter<IArticle> {
const useGeoNamesApi = sdApi.config.featureEnabled('places_autocomplete');
if (useGeoNamesApi) {
return {
Function render
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const planningComponents = [IMasterDeskTab.assignments];
const tabs = Object.values(IMasterDeskTab).filter((tab) =>
this.props.isPlaningActive ? tab : !planningComponents.includes(tab),
File ArticleEditDirective.ts
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash';
import {IArticle} from 'superdesk-api';
import {FIELD_KEY_SEPARATOR} from 'core/editor3/helpers/fieldsMeta';
import {getLabelNameResolver} from 'apps/workspace/helpers/getLabelForFieldId';
import {getMediaTypes} from 'apps/vocabularies/constants';
Function PieChartDashboard
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function PieChartDashboard(colorSchemes) {
return {
replace: true,
scope: {
terms: '=',
Function ItemAssociationDirective
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ItemAssociationDirective(renditions, notify) {
return {
scope: {
rel: '=',
fieldName: '=',
Function ItemGlobalSearch
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ItemGlobalSearch(
session, api, notify, keyboardManager, asset, authoringWorkspace: AuthoringWorkspaceService, authoring,
) {
return {
scope: {repo: '=', context: '='},
Function link
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope, element, attrs) {
scope.features = features;
scope.changePassword = false;
scope.methods = {
Identical blocks of code found in 2 locations. Consider refactoring. Open
function handleUnsavedRundownChanges(
mode: IRundownItemActionNext,
skipUnsavedChangesCheck: boolean,
onSuccess: () => void,
) {
- 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
export function handleUnsavedRundownChanges(
mode: ICreate | IEdit | IPreview | null,
skipUnsavedChangesCheck: boolean,
onSuccess: () => void,
) {
- 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
File VideoEditorThumbnail.tsx
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as React from 'react';
import {IArticle, ISuperdesk} from 'superdesk-api';
import {IErrorMessage, ICrop, IVideoProject} from './interfaces';
import {pick} from 'lodash';
Function confirmSendingPackages
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function confirmSendingPackages(items: Array<IArticle>): Promise<void> {
const packages = items.filter(({type}) => type === 'composite');
if (packages.length < 1) {
return Promise.resolve();
Function UserSelectList
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function UserSelectList($filter, api) {
return {
scope: {
exclude: '=?',
onchoose: '&',
Function AuthoringThemesService
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function AuthoringThemesService(storage, preferencesService) {
var service: any = {};
service.availableThemes = {
fonts: [
File setEditorPanel.tsx
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
// External Modules
import * as React from 'react';
import {connect} from 'react-redux';
import {Dispatch} from 'redux';
import {cloneDeep, isEqual} from 'lodash';
Function IngestRoutingAction
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
export function IngestRoutingAction(desks, macros, subscribersService, metadata) {
return {
scope: {
rule: '=',
ruleHandler: '=',
- 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"