Showing 3,654 of 3,654 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
componentDidMount() {
document.addEventListener('keydown', this.handleKeydown);
document.addEventListener('click', this.handleClickOutside);
if (this.dom.root) {
- 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 730.
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
componentDidMount() {
document.addEventListener('keydown', this.handleKeydown);
document.addEventListener('click', this.handleClickOutside);
if (this.dom.root) {
- 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 730.
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 AuthoringDirective
has a Cognitive Complexity of 210 (exceeds 5 allowed). Consider refactoring. Open
export function AuthoringDirective(
superdesk,
authoringWorkspace: AuthoringWorkspaceService,
notify,
desks,
- 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 AuthoringDirective
has 742 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function AuthoringDirective(
superdesk,
authoringWorkspace: AuthoringWorkspaceService,
notify,
desks,
Function link
has 738 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function($scope, elem, attrs) {
$scope.loading = false;
$scope.tabsPinned = false;
var _closing;
Function constructor
has 667 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
this.lock = element(by.css('[ng-click="lock()"]'));
this.correct_button = element(by.buttonText('correct'));
this.kill_button = element(by.buttonText('kill'));
this.close_button = element(by.buttonText('Close'));
Function SearchService
has a Cognitive Complexity of 155 (exceeds 5 allowed). Consider refactoring. Open
export function SearchService($location, session, multi,
preferencesService, moment, sortService) {
const PARAMETERS = getParameters();
const EXCLUDE_FACETS = getExcludeFacets();
- 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 getInlineToolbarActions
has 630 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getInlineToolbarActions(
options: IExposedFromAuthoring<IArticle>,
action?: IAuthoringActionType,
): IAuthoringOptions<IArticle> {
const {
File authoring-react.tsx
has 1195 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import {
IArticle,
IAuthoringFieldV2,
IContentProfileV2,
File metadata.ts
has 1148 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash';
import PreferedCvItemsConfigDirective from './PreferedCvItemsConfigDirective';
import MetaPlaceDirective from './MetaPlaceDirective';
import {getVocabularySelectionTypes} from '../../vocabularies/constants';
import {gettext} from 'core/utils';
Function getAutoTaggingComponent
has 572 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getAutoTaggingComponent(superdesk: ISuperdesk, label: string) {
const {preferences} = superdesk;
const {httpRequestJsonLocal} = superdesk;
const {gettext, gettextPlural} = superdesk.localization;
const {memoize, generatePatch, arrayToTree} = superdesk.utilities;
Function MonitoringGroup
has a Cognitive Complexity of 139 (exceeds 5 allowed). Consider refactoring. Open
export function MonitoringGroup(
cards,
api,
authoringWorkspace: AuthoringWorkspaceService,
$timeout,
- 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 AuthoringService
has 557 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function AuthoringService(
$q,
$location,
api,
lock,
Function constructor
has 544 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
this.config = element(by.className('aggregate-settings'));
this.label = element(by.model('widget.configuration.label'));
this.openMonitoring = function() {
Function IngestSourcesContent
has 520 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function IngestSourcesContent(ingestSources, api, $location,
modal, $filter, privileges) {
return {
templateUrl: 'scripts/apps/ingest/views/settings/ingest-sources-content.html',
link: function($scope) {
Function link
has 515 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function($scope) {
$scope.waitForDirectiveReady = function() {
return Promise.all([
ingestSources.fetchAllFeedingServicesAllowed(),
]);
File ui.ts
has 999 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable max-len */
/* tslint:disable:max-line-length */
import _, {difference, filter, mapValues, sortBy, union, without} from 'lodash';
import moment from 'moment-timezone';
File monitoring_spec.ts
has 997 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable newline-per-chained-call */
import {element, browser, by, protractor, ElementFinder} from 'protractor';
import {monitoring} from './helpers/monitoring';
Function SearchService
has 498 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function SearchService($location, session, multi,
preferencesService, moment, sortService) {
const PARAMETERS = getParameters();
const EXCLUDE_FACETS = getExcludeFacets();
Similar blocks of code found in 2 locations. Consider refactoring. Open
export const genre: IFieldAdapter<IArticle> = {
getFieldV2: (fieldEditor, fieldSchema) => {
const multiple = isMultipleV2('genre');
const fieldConfig: IDropdownConfigVocabulary = {
- 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 431.
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