superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function StreamController has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function StreamController($scope, api, $rootScope, desks) {
    $scope.desk = null;
    $scope.activities = null;
    $scope.pageLength = 10;
    $scope.max_results = $scope.pageLength;
Severity: Minor
Found in scripts/apps/stream/controllers/StreamController.ts - About 35 mins to fix

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 MultieditDropdownDirective has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function MultieditDropdownDirective(workqueue, multiEdit, $route) {
    return {
        templateUrl: 'scripts/apps/authoring/multiedit/views/sd-multiedit-dropdown.html',
        link: function(scope) {
            scope.current = $route.current.params.item;
Severity: Minor
Found in scripts/apps/authoring/multiedit/multiedit.ts - About 35 mins to fix

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 select has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    select(item: IArticle, event) {
        // Don't select item / open preview when a button is clicked.
        // The button can be three dots menu, bulk actions checkbox, a button to preview existing highlights etc.
        if (isButtonClicked(event)) {
            return;
Severity: Minor
Found in scripts/apps/search/components/ItemList.tsx - About 35 mins to fix

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 loadPlanningModals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    loadPlanningModals() {
        const session = ng.get('session');
        const superdesk = ng.get('superdesk');
        const activityService: IActivityService = ng.get('activityService');

Severity: Minor
Found in scripts/apps/search/components/Item.tsx - About 35 mins to fix

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 SearchPanel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function SearchPanel($location,
    desks,
    privileges,
    asset,
    metadata,
Severity: Minor
Found in scripts/apps/search/directives/SearchPanel.ts - About 35 mins to fix

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 gettextReact has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const gettextReact = (
    text: string,
    params: {[placeholder: string]: string | number | React.ComponentType},
): Array<JSX.Element> => {
    let matches: Array<{index: number, str: string, placeholder: string}> = [];
Severity: Minor
Found in scripts/core/utils.tsx - About 35 mins to fix

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 getTabLabel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function getTabLabel(id: IArticleActionInteractive) {
    if (id === 'send_to') {
        return gettext('Send to');
    } else if (id === 'fetch_to') {
        return gettext('Fetch to');
Severity: Minor
Found in scripts/core/interactive-article-actions-panel/index-ui.tsx - About 35 mins to fix

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 saveOrUpdateSavedSearch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function saveOrUpdateSavedSearch(api, savedSearchOriginal: ISavedSearch, savedSearchChanged: ISavedSearch) {
    if (savedSearchChanged.filter != null && savedSearchChanged.filter.query != null) {
        savedSearchChanged.filter.query = mapFiltersClientToServer(savedSearchChanged.filter.query);
    }

Severity: Minor
Found in scripts/apps/search/SavedSearch.ts - About 35 mins to fix

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 SavedSearches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function SavedSearches($rootScope, api, session, modal, notify, asset, $location,
    desks, privileges, savedSearch): ng.IDirective {
    return {
        templateUrl: asset.templateUrl('apps/search/views/saved-searches.html'),
        scope: {},
Severity: Minor
Found in scripts/apps/search/directives/SavedSearches.ts - About 35 mins to fix

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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const items: Array<{id: string; label: string}> = this.props.formField.component_parameters.items;

        if (this.props.previewOutput) {
            if (this.props.value == null) {

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 scrollListItemIfNeeded has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const scrollListItemIfNeeded = (selectedIndex, listRefElement) => {
    if (listRefElement.children.length > 0) {
        const activeElement = listRefElement.children[selectedIndex];

        if (activeElement) {
Severity: Minor
Found in scripts/core/ui/components/utils.ts - About 35 mins to fix

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 getInitialPublishingDateOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function getInitialPublishingDateOptions(items: Array<IArticle>): IPublishingDateOptions {
    return {
        embargo: items.length === 1 && items[0].embargo != null
            ? fromServerDateFormat(items[0].embargo) ?? null
            : null,

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 addTag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    addTag(tag) {
        if (tag) {
            const valueText = get(tag, this.props.valueKey, tag);

            // If the tag is not currently in the list of tags
Severity: Minor
Found in scripts/core/ui/components/Form/SelectTagInput/index.tsx - About 35 mins to fix

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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const renditions = this.props.item.renditions;
        const guid = this.props.item.guid;

        if (renditions == null) {
Severity: Minor
Found in scripts/core/ui/components/video.tsx - About 35 mins to fix

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 DatepickerDirective has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function DatepickerDirective($document) {
    return {
        scope: {
            dt: '=ngModel',
            disabled: '=ngDisabled',
Severity: Minor
Found in scripts/core/ui/ui.ts - About 35 mins to fix

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 hasNextSelection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function hasNextSelection(editorState, selection, backward = false) {
    const currentSelection = editorState.getSelection();
    const content = editorState.getCurrentContent();
    const startBlock = content.getBlockForKey(selection.getStartKey());
    const endBlock = content.getBlockForKey(selection.getEndKey());
Severity: Minor
Found in scripts/core/editor3/helpers/selection/selectionIterator.ts - About 35 mins to fix

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 mediaQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function mediaQuery($window, authoringWorkspace: AuthoringWorkspaceService) {
    return {
        scope: {
            minWidth: '=',
            maxWidth: '=',
Severity: Minor
Found in scripts/core/ui/ui.ts - About 35 mins to fix

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 getDraftCharacterListForSelection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function getDraftCharacterListForSelection(
    editorState: EditorState,
    selection: SelectionState,
): List<CharacterMetadata> {
    // including all blocks
Severity: Minor
Found in scripts/core/editor3/helpers/getDraftCharacterListForSelection.ts - About 35 mins to fix

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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const {noBorder, noPadding, grow, justifyContent, ellipsisAndGrow, children, bold = false, title} = this.props;
        const cssClasses = [];
        var styles: CSSProperties = {};

Severity: Minor
Found in scripts/core/components/ListItem.tsx - About 35 mins to fix

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 setAddSuggestionForCharacter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const setAddSuggestionForCharacter = (editorState, data, text, inlineStyle = null) => {
    const crtInlineStyle = inlineStyle || editorState.getCurrentInlineStyle();
    const selection = editorState.getSelection();
    const beforeStyle =
        Highlights.getHighlightStyleAtOffset(editorState, changeSuggestionsTypes, selection, -1) as string;
Severity: Minor
Found in scripts/core/editor3/reducers/suggestions.tsx - About 35 mins to fix

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

Severity
Category
Status
Source
Language