superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

const BlockRendererComponent: React.StatelessComponent<any> = (props) => {
    const {block, contentState} = props;
    const entityKey = block.getEntityAt(0);

    if (!entityKey) {
Severity: Minor
Found in scripts/core/editor3/components/blockRenderer.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 getInitialContent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function getInitialContent(props): ContentState {
    // support standalone instance of editor3 which is not connected to item field
    if (props.editorState != null) {
        var contentState = convertFromRaw(
            props.editorState instanceof Array
Severity: Minor
Found in scripts/core/editor3/store/index.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 {
            readOnly,
            locked,
            showToolbar,
Severity: Minor
Found in scripts/core/editor3/components/Editor3Component.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 setDeleteSuggestionForCharacter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const setDeleteSuggestionForCharacter = (editorState, data) => {
    const selection = editorState.getSelection();

    const paragraphStyle = Highlights.getHighlightStyleAtOffset(editorState, paragraphSuggestionTypes, selection, -1);

Severity: Minor
Found in scripts/core/editor3/reducers/suggestions.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() {
        this.ingestRepo = element(by.id('ingest-collection'));
        this.archiveRepo = element(by.id('archive-collection'));
        this.publishedRepo = element(by.id('published-collection'));
        this.archivedRepo = element(by.id('archived-collection'));
Severity: Minor
Found in e2e/client/specs/helpers/search.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 UserNotificationsService has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function UserNotificationsService(
    $rootScope,
    $timeout,
    api,
    session,
Severity: Minor
Found in scripts/core/menu/notifications/notifications.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 activate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    activate: () => {
        const result: IExtensionActivationResult = privileges.hasPrivilege('rundowns')
            ? {
                contributions: {
                    pages: privileges.hasPrivilege('rundowns')
Severity: Minor
Found in scripts/extensions/broadcasting/src/extension.ts - About 1 hr to fix

    Function clear has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              clear = function clear(id, key) {
                var zap = function zap(what) {
                  if (isDefined(what[id][key])) {
                    delete what[id][key];
                    if (Object.keys(what[id]).length === 0) {
    Severity: Minor
    Found in scripts/libs/angular-history/history.js - About 1 hr to fix

      Function uploadFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          uploadFile(item: IUploadItem, onProgress: (event: ProgressEvent) => void): Promise<Partial<IAssetItem>> {
              const {gettext} = superdeskApi.localization;
              const {notify} = superdeskApi.ui;
      
              const data = new FormData();
      Severity: Minor
      Found in scripts/extensions/sams/src/components/assets/uploadAssetModal.tsx - About 1 hr to fix

        Function onPrepare has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            onPrepare: function() {
                execSync(
                    `
                        echo "chrome version:" && $CHROME_BIN --version
                        echo "\n"
        Severity: Minor
        Found in e2e/client/protractor.conf.js - About 1 hr to fix

          Function extractTranslations has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function extractTranslations(clientDir) {
              for (const {extensionRootPath} of getExtensionDirectoriesSync(clientDir)) {
                  const package = JSON.parse(fs.readFileSync(path.join(extensionRootPath, 'package.json'), 'utf-8'));
                  const paths = _.get(package, 'superdeskExtension.translations-extract-paths');
          
          
          Severity: Minor
          Found in build-tools/src/extensions/extract-translations.js - About 1 hr to fix

            Function exportHighlight has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function exportHighlight(id: IArticle['_id'], hasUnsavedChanges: boolean): Promise<void> {
                const request = () => {
                    return httpRequestJsonLocal<void>({
                        method: 'POST',
                        path: '/generate_highlights',
            Severity: Minor
            Found in scripts/api/highlights.ts - About 1 hr to fix

              Function workspaceReducer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function workspaceReducer(
                  state: IWorkspaceState = initialState,
                  action: IWorkspaceActionTypes,
              ): IWorkspaceState {
                  switch (action.type) {
              Severity: Minor
              Found in scripts/extensions/sams/src/store/workspace/reducers.ts - About 1 hr to fix

                Function openDeleteConfirmationModal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function openDeleteConfirmationModal(assetName?: string, asset_length?: number): Promise<boolean> {
                    const {gettext} = superdeskApi.localization;
                    const {confirm} = superdeskApi.ui;
                
                    const el = document.createElement('div');
                Severity: Minor
                Found in scripts/extensions/sams/src/store/assets/actions.ts - About 1 hr to fix

                  Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      render() {
                          return (
                              <AuthoringWidgetLayout
                                  header={(
                                      <AuthoringWidgetHeading
                  Severity: Minor
                  Found in scripts/apps/authoring-react/article-widgets/demo-widget.tsx - About 1 hr to fix

                    Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        render() {
                            const config: IDropdownConfig = this.props.config ?? {
                                source: 'vocabulary',
                                vocabularyId: null,
                                multiple: false,

                      Function onTrigger has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          onTrigger: () => {
                              const article = getLatestItem();
                      
                              Promise.all([
                                  httpRequestJsonLocal<IRestApiResponse<IArticle>>({
                      Severity: Minor
                      Found in scripts/apps/authoring-react/authoring-integration-wrapper.tsx - About 1 hr to fix

                        Function initializeEditor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            initializeEditor() {
                                if (this.state.ready === true) {
                                    this.setState({ready: false});
                                }
                        
                        
                        Severity: Minor
                        Found in scripts/apps/authoring-react/fields/editor3/editor.tsx - About 1 hr to fix

                          Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              constructor(api, $location, sort, search, metadata) {
                                  this.api = api;
                                  this.$location = $location;
                                  this.sort = sort;
                                  this.sortOptions = [
                          Severity: Minor
                          Found in scripts/apps/contacts/services/ContactsService.ts - About 1 hr to fix

                            Function getCount has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                        function getCount() {
                                            var criteria = {
                                                source: {
                                                    query: {
                                                        filtered: {
                            Severity: Minor
                            Found in scripts/apps/ingest/directives/IngestUserDashboard.ts - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language