superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function getMimetypeHumanReadable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function getMimetypeHumanReadable(mimetype?: string): string {
    const {gettext} = superdeskApi.localization;

    if (mimetype == null || mimetype.length === 0) {
        return '';
Severity: Minor
Found in scripts/extensions/sams/src/utils/assets.ts - About 45 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 startApp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function startApp(
    extensions: Array<IExtensionLoader>,
    customUiComponents: IConfigurableUiComponents,
    customAlgorithms: IConfigurableAlgorithms = {},
) {
Severity: Minor
Found in scripts/index.ts - About 45 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 04001 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    '04001': (_error) => {
        for (let error of Object.keys(_error.errors!)) {
            for (let key of _error.errors![error]) {
                if (key === 'unique') {
                    return superdeskApi.localization.gettext('Error[{{number}}]: {{error}} not unique', {
Severity: Minor
Found in scripts/extensions/sams/src/utils/api.ts - About 45 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 makeConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function makeConfig(grunt) {
    var appConfigPath = path.join(process.cwd(), 'superdesk.config.js');

    if (process.env.SUPERDESK_CONFIG) {
        appConfigPath = path.join(process.cwd(), process.env.SUPERDESK_CONFIG);
Severity: Minor
Found in webpack.config.js - About 45 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 AdminPublishSettingsService has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function AdminPublishSettingsService(api) {
    var _fetch = function(endpoint, criteria) {
        return api[endpoint].query(criteria);
    };

Severity: Minor
Found in scripts/apps/publish/services/AdminPublishSettingsService.ts - About 45 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 canPublish has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function canPublish(item: IArticle): boolean {
    if (
        sdApi.user.hasPrivilege('publish') !== true
        || item.flags?.marked_for_not_publication === true
        || item.state === 'draft'
Severity: Minor
Found in scripts/api/article.ts - About 45 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 ContentProfilesController has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function ContentProfilesController($scope: IScope, $location, notify, content, modal, $q) {
Severity: Minor
Found in scripts/apps/workspace/content/controllers/ContentProfilesController.ts - About 45 mins to fix

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

        render() {
            const {gettext} = this.props.superdesk.localization;
            const {getClass} = this.props.superdesk.utilities.CSS;
            const degree = this.state.transformations.degree + 'deg';
            const videoRef = this.videoRef.current;
    Severity: Minor
    Found in scripts/extensions/videoEditor/src/VideoEditor.tsx - About 45 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 WorkspaceService has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    export function WorkspaceService(api, desks, session, preferences, $q, modal) {
    Severity: Minor
    Found in scripts/apps/workspace/services/WorkspaceService.ts - About 45 mins to fix

      Function getEntity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          getEntity: (id) => {
              return authoringStorageIArticle.getEntity(id).then(({saved, autosaved}) => {
                  const newItem = {...saved};
      
                  newItem.flags.marked_for_sms = false;
      Severity: Minor
      Found in scripts/apps/authoring-react/data-layer.ts - About 45 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 componentDidUpdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          componentDidUpdate(_prevProps, prevState: IState<T>) {
              const {authoringStorage} = this.props;
              const state = this.state;
      
              if (
      Severity: Minor
      Found in scripts/apps/authoring-react/authoring-react.tsx - About 45 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 handleKeyUp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          handleKeyUp(event: KeyboardEvent) {
              const matchingKeyBinding: string | null = Object.keys(this.props.keyBindings).find((hotkey) => {
                  const split = hotkey.split('+');
                  const altRequired = split.includes('alt');
                  const shiftRequired = split.includes('shift');
      Severity: Minor
      Found in scripts/apps/authoring-react/with-keybindings.tsx - About 45 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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          save(state: IStateLoaded<T>): Promise<T> {
              const {authoringStorage} = this.props;
      
              if ((this.props.validateBeforeSaving ?? true) === true) {
                  const {profile} = state;
      Severity: Minor
      Found in scripts/apps/authoring-react/authoring-react.tsx - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
      Open

          render() {
              const {value1, value2, config} = this.props;
      
              const values1 = (() => {
                  if (value1 == 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 getFieldsData has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          item: T,
          fields: Map<string, IAuthoringFieldV2>,
          fieldsAdapter: IFieldsAdapter<T>,
          authoringStorage: IAuthoringStorage<T>,
          storageAdapter: IStorageAdapter<T>,
      Severity: Minor
      Found in scripts/apps/authoring-react/authoring-react.tsx - About 45 mins to fix

        Function runTansa has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export function runTansa(contentProfile: IContentProfileV2, fieldsData: Map<string, unknown>) {
            // Disable tansa for all text fields.
            Array.from(document.querySelectorAll(
                'input[type="text"], textarea, [contenteditable]',
            )).forEach((el) => {
        Severity: Minor
        Found in scripts/apps/authoring-react/editor3-tansa-integration.tsx - About 45 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 AggregateSettings has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        export function AggregateSettings(desks, workspaces, session, preferencesService, WizardHandler, $filter) {
        Severity: Minor
        Found in scripts/apps/monitoring/directives/AggregateSettings.ts - About 45 mins to fix

          Function getInlineToolbarActions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              getInlineToolbarActions(
                  {
                      item,
                      hasUnsavedChanges,
                      save,
          Severity: Minor
          Found in scripts/apps/authoring-react/multi-edit-modal.tsx - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
          Open

              render() {
                  const {attachment, differenceType} = this.props;
          
                  const change = ((): IChange | null => {
                      if (differenceType === 'added') {
          Severity: Minor
          Found in scripts/apps/authoring-react/fields/attachments/difference-row.tsx - About 45 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 getFieldContainer has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              useHeaderLayout: boolean,
              canBeToggled: boolean,
              field: IAuthoringFieldV2,
              toggledOn: boolean,
              toggleField: (fieldId: string) => void,
          Severity: Minor
          Found in scripts/apps/authoring-react/authoring-section/get-field-container.tsx - About 45 mins to fix
            Severity
            Category
            Status
            Source
            Language