superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function MediaFieldsController has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function MediaFieldsController($q, metadata) {
    function getCV(field) {
        const cv = metadata.cvs.find((_cv) => _cv._id === field || _cv.schema_field === field);

        if (cv == null && field === 'subject') {
Severity: Minor
Found in scripts/apps/authoring/media/media-fields-controller.ts - About 1 hr 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 MetaWordsListDirective has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function MetaWordsListDirective() {
    return {
        scope: {
            item: '=',
            field: '@',
Severity: Minor
Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr 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 SearchController has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function SearchController($location, searchProviderService) {
    const SUPERDESK = 'local';
    const INTERNAL = ['archive', 'published', 'ingest', 'archived'];
    const DEFAULT_CONFIG = Object.assign({}, {
        ingest: true,
Severity: Minor
Found in scripts/apps/search/controllers/SearchController.ts - About 1 hr 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 ItemContainer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const ItemContainer: React.StatelessComponent<any> = (props) => {
    const item = props.item;
    const desk = props.desk || null;
    let label;
    let value;
Severity: Minor
Found in scripts/apps/search/components/ItemContainer.tsx - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const planningComponents = [IMasterDeskTab.assignments];

        const tabs = Object.values(IMasterDeskTab).filter((tab) =>
            this.props.isPlaningActive ? tab : !planningComponents.includes(tab),
Severity: Minor
Found in scripts/apps/master-desk/components/HeaderComponent.tsx - About 1 hr 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 closeAuthoring has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    closeAuthoring: (original: IArticle, hasUnsavedChanges, save, unlock, cancelAutoSave, doClose) => {
        if (!isArticleLockedInCurrentSession(original)) {
            return Promise.resolve().then(() => doClose());
        }

Severity: Minor
Found in scripts/apps/authoring-bridge/authoring-api-common.ts - About 1 hr 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 TasksService has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function TasksService(desks, $rootScope, api, datetimeHelper) {
    this.statuses = [
        {_id: 'todo', name: gettext('To Do')},
        {_id: 'in_progress', name: gettext('In Progress')},
        {_id: 'done', name: gettext('Done')},
Severity: Minor
Found in scripts/apps/dashboard/workspace-tasks/tasks.ts - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const activity = this.props.activity;

        const invoke = typeof activity.dropdown === 'function' || typeof activity.dropdown === 'object';

Severity: Minor
Found in scripts/apps/search/components/actions-menu/Item.tsx - About 1 hr 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 SavedSearchEditOwnSubscription has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function SavedSearchEditOwnSubscription(asset, session, api) {
    return {
        scope: {
            savedSearch: '=',
            cancelEditingSubscription: '=',
Severity: Minor
Found in scripts/apps/search/directives/SavedSearchEditOwnSubscription.ts - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const padding = 20;
        const extraButtons = this.props.getExtraButtons?.() ?? null;

        const query: ISuperdeskQuery = getQueryWithFilters(
Severity: Minor
Found in scripts/core/ArticlesListByQueryWithFilters.tsx - About 1 hr 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 getFilteredOptionList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    getFilteredOptionList(currentParent?, searchList?) {
        if (this.props.multiLevel) {
            let filteredList;

            if (searchList) {

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

const Button: React.StatelessComponent<any> = ({
    className,
    onClick,
    icon,
    title,
Severity: Minor
Found in scripts/core/ui/components/Button.tsx - About 1 hr 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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    constructor(props: IProps<T>) {
        super(props);

        this.state = {
            search: '',
Severity: Minor
Found in scripts/core/ui/components/select2.tsx - About 1 hr 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 registerExtensions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function registerExtensions(
    extensionLoaders: Array<IExtensionLoader>,
    superdesk,
    modal,
    privileges,
Severity: Minor
Found in scripts/core/register-extensions.tsx - About 1 hr 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 AuthExpiredInterceptor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function AuthExpiredInterceptor(session, $q, $injector, $browser, _) {
    function handleAuthExpired(response) {
        $browser.$$completeOutstandingRequest(angular.noop);
        session.expire();
        return session.getIdentity().then(() => {
Severity: Minor
Found in scripts/core/auth/auth.ts - About 1 hr 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 generateHtml has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function generateHtml(
    store: Store<IEditorStore, AnyAction>,
    item: IArticle,
    pathToValue: string,
) {
Severity: Minor
Found in scripts/core/editor3/directive.tsx - About 1 hr 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 startEditing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    startEditing(id: string) {
        if (this.state.editItem != null) {
            this.modal.alert({
                headerText: gettext('Warning'),
                bodyText: gettext(
Severity: Minor
Found in scripts/core/ui/components/ListPage/generic-list-page.tsx - About 1 hr 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 getRangeAndTextForStyleInRawState has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function getRangeAndTextForStyleInRawState(rawEditorState, highlightId) {
    let highlightedText = '';

    for (const {inlineStyleRanges, text} of rawEditorState.blocks) {
        for (const {offset, length, style} of inlineStyleRanges) {
Severity: Minor
Found in scripts/core/editor3/helpers/highlights.ts - About 1 hr 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 stickElements has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function stickElements(target, source, preferredPosition) {
    const targetRect = target.getBoundingClientRect();

    source.style.position = 'absolute';

Severity: Minor
Found in scripts/core/helpers/dom/stickElements.ts - About 1 hr 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 getSuggestionData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function getSuggestionData(editorState, styleName) {
    const type = getHighlightType(styleName);
    const {selection, highlightedText} = getRangeAndTextForStyle(editorState, styleName);

    const data = {
Severity: Minor
Found in scripts/core/editor3/helpers/highlights.ts - About 1 hr 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