Showing 3,654 of 3,654 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
scope.setStageInfo = function(_id) {
var item = scope.editGroups[_id];
if (!item.type) {
item._id = _id;
- 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 101.
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 link
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope, elem, attrs) {
var ARROW_UP = 38, ARROW_DOWN = 40, ENTER = 13;
scope.selected = null;
scope.search = null;
Function MultiActionBar
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function MultiActionBar(
asset,
multi,
superdesk,
keyboardManager,
Function render
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {children} = this.props;
const childrenEmpty =
typeof children === 'undefined'
Function handleKeyCommand
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleKeyCommand(command) {
const author = getCurrentAuthor();
const {editorState, onChange, singleLine, suggestingMode} = this.props;
const {
onCreateSplitParagraphSuggestion,
Function IngestRoutingContent
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function IngestRoutingContent(api, notify, modal, contentFilters, $filter) {
return {
templateUrl: 'scripts/apps/ingest/views/settings/ingest-routing-content.html',
link: function(scope) {
let _orig = null, _origRule = null, _new = false;
- 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 26 arguments (exceeds 4 allowed). Consider refactoring. Open
superdesk,
authoringWorkspace: AuthoringWorkspaceService,
notify,
desks,
authoring,
Function SaveSearch
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function SaveSearch($location, asset, api, notify, $rootScope) {
return {
templateUrl: asset.templateUrl('apps/search/views/save-search.html'),
link: function(scope, _elem) {
scope.edit = 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 getRightRangeAndTextForStyle
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function getRightRangeAndTextForStyle(editorState, style) {
/* eslint-disable complexity */
const type = getHighlightTypeFromStyleName(style);
const selection = editorState.getSelection();
const content = editorState.getCurrentContent();
- 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 ContactList
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ContactList(
$timeout,
$filter,
search,
datetime,
Function DeskeditBasic
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function DeskeditBasic(desks, WizardHandler, metadata, $filter, notify) {
return {
link: function(scope) {
scope.limits = limits;
scope.deskTypes = [];
Function constructor
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
this.list = element.all(by.repeater('dictionary in dictionaries'));
this.name = element(by.model('dictionary.name'));
this.languageId = element(by.model('dictionary.language_id'));
Function render
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {gettext, longFormatDateTime, getRelativeOrAbsoluteDateTime} = superdeskApi.localization;
const {config} = superdeskApi.instance;
const actions = getDropdownItemsForActions(this.props.asset, this.props.actions);
const mimetype = getMimetypeHumanReadable(this.props.asset.mimetype);
Function render
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {field, item, required} = this.props;
const value = item[field.key] || '';
const valueObj = item[field.key] ?? {};
const disabled = !item.is_active;
Function DictionaryConfigController
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function DictionaryConfigController($scope, dictionaries, session, modal, notify) {
$scope.dictionaries = null;
$scope.origDictionary = null;
$scope.dictionary = null;
File get-bulk-actions.tsx
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {IArticle} from 'superdesk-api';
import {sdApi} from 'api';
import {dispatchInternalEvent} from 'core/internal-events';
import ng from 'core/services/ng';
import {getArticleLabel, gettext} from 'core/utils';
Function SearchMenuController
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function SearchMenuController(
$rootScope, $scope, $filter, $location, $route, searchProviderService, api, savedSearch,
privileges,
) {
let providerLabels = {};
Function link
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope) {
const PARAMETERS = getParameters();
scope.cvs = metadata.search_cvs;
const urlParams = scope.urlParams || PARAMETERS;
Similar blocks of code found in 3 locations. Consider refactoring. Open
this.eventListenersToRemoveBeforeUnmounting.push(
addWebsocketEventListener(
'resource:updated',
(event: IWebsocketMessage<IResourceUpdateEvent>) => {
const {resource, _id, fields} = event.extra;
- 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 99.
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 3 locations. Consider refactoring. Open
this.eventListenersToRemoveBeforeUnmounting.push(
addWebsocketEventListener(
'resource:updated',
(event: IWebsocketMessage<IResourceUpdateEvent>) => {
const {resource, _id, fields} = event.extra;
- 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 99.
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