superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const {gettext} = superdeskApi.localization;
        const allowedStates = this.props.allowedStates ?? [
            ASSET_STATE.DRAFT,
            ASSET_STATE.INTERNAL,
Severity: Minor
Found in scripts/extensions/sams/src/components/assets/assetEditor.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const {gettext, gettextPlural} = superdeskApi.localization;
        const {numberToString} = superdeskApi.helpers;

        const items = this.getMenuItems();
Severity: Minor
Found in scripts/extensions/sams/src/components/workspaceSubnav.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        if (this.state.loading) {
            return 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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const {config} = this.props;
        const Container = this.props.container;
        const values: Array<string> | Array<number> = (() => {
            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 PackageItemPreview has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function PackageItemPreview(api, lock, superdesk, authoringWorkspace: AuthoringWorkspaceService, $sce,
    desks, vocabularies) {
    return {
        scope: {
            item: '=',
Severity: Minor
Found in scripts/apps/packaging/directives/PackageItemPreview.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 FilterSearchController has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function FilterSearchController($scope, contentFilters, notify, $filter) {
    $scope.filterCondition = null;
    $scope.operatorLookup = {};
    $scope.valueLookup = {};
    $scope.valueFieldLookup = {};
Severity: Minor
Found in scripts/apps/content-filters/controllers/FilterSearchController.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const {contact, onChange, readOnly, errors, contactType} = this.props;

        const contactLabel = contactType === 'person' ? gettext('Role') : gettext('Point of contact');
        const isRequired = get(this.state, 'requiredField', false);
Severity: Minor
Found in scripts/apps/contacts/components/Form/ProfileDetail.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 TemplatesDirective has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function TemplatesDirective(notify, api, templates, modal, desks, weekdays, content, $filter, session, _) {
Severity: Major
Found in scripts/apps/templates/directives/TemplatesDirective.ts - About 1 hr to fix

    Function MediaMetadata has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    export function MediaMetadata(userList, archiveService, metadata, $timeout) {
        return {
            scope: {
                item: '=',
            },
    Severity: Minor
    Found in scripts/apps/archive/directives/MediaMetadata.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 TextWithMentions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    export const TextWithMentions: React.FunctionComponent<IProps> = ({message}) => {
        const n = message.length;
    
        const r = []; // array of components to render
        let m; // regexp match
    Severity: Minor
    Found in scripts/apps/users/components/TextWithMentions.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 UploadController has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        $scope,
        $q,
        upload,
        api,
        archiveService,
    Severity: Major
    Found in scripts/apps/archive/controllers/UploadController.ts - About 1 hr to fix

      Function UserListDirective has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      export function UserListDirective(keyboardManager, usersService, asset, session) {
          return {
              templateUrl: asset.templateUrl('apps/users/views/user-list-item.html'),
              scope: {
                  roles: '=',
      Severity: Minor
      Found in scripts/apps/users/directives/UserListDirective.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 isAllowedMediaType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      export function isAllowedMediaType(scope, event) {
          const {allowAudio, allowPicture, allowVideo} = scope;
          const VALID_MEDIA_TYPES = ['Files'];
      
          if (allowAudio) {

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

      export function AuthoringContainerDirective(authoringWorkspace: AuthoringWorkspaceService) {
          function AuthoringContainerController() {
              var self = this;
      
              this.state = {};

      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 MetadataCtrl has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          $scope, desks, metadata, privileges, datetimeHelper, userList,
          preferencesService, archiveService, moment, content) {
      Severity: Major
      Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

        Function handleKey has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            handleKey(event) {
                if (querySelectorParent(event.target, 'button', {self: true}) != null) {
                    // don't execute key bindings when a button inside the list item is focused.
                    return;
                }
        Severity: Minor
        Found in scripts/apps/search/components/ItemList.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 getAuthoringField has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export function getAuthoringField(
            fieldId: string,
            item: IArticle,
            customFieldsVocabularies: Array<IVocabulary>,
        ): IAuthoringField {
        Severity: Minor
        Found in scripts/apps/authoring/preview/getAuthoringField.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 DashboardController has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            $scope,
            desks,
            dashboardWidgets,
            api,
            session,
        Severity: Major
        Found in scripts/apps/dashboard/controllers/DashboardController.ts - About 1 hr to fix

          Function SavedSearches has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          export function SavedSearches($rootScope, api, session, modal, notify, asset, $location,
              desks, privileges, savedSearch): ng.IDirective {
          Severity: Major
          Found in scripts/apps/search/directives/SavedSearches.ts - About 1 hr to fix

            Function arrayToTree has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            export function arrayToTree<T>(
                itemsFlat: Array<T>,
                getId: (item: T) => string,
                getParentId: (item: T) => string | undefined | null,
            ): {result: Array<ITreeNode<T>>, errors: Array<T>} {
            Severity: Minor
            Found in scripts/core/helpers/tree.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