superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function stickElements has 44 lines of code (exceeds 25 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

    Function link has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            link: function(scope, elem, attrs) {
                var UP = -1,
                    DOWN = 1;
    
                function fetchSelectedItem(itemId) {
    Severity: Minor
    Found in scripts/core/list/list.ts - About 1 hr to fix

      Function createEditorStore has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function createEditorStore(
          props: IProps,
          spellcheck,
          isReact = false,
      ): Store<IEditorStore> {
      Severity: Minor
      Found in scripts/core/editor3/store/index.ts - About 1 hr to fix

        Function DeskNotifications has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        export function DeskNotifications(desks, deskNotifications, authoringWorkspace: AuthoringWorkspaceService, $timeout) {
            return {
                scope: {stage: '=stage'},
                templateUrl: 'scripts/apps/monitoring/views/desk-notifications.html',
                link: function(scope) {
        Severity: Minor
        Found in scripts/apps/monitoring/directives/DeskNotifications.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 LegalArchiveService has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        export function LegalArchiveService(api, $location, moment, sortService) {
            var DEFAULT_PER_PAGE = 25;
        
            this.default_items = Object.freeze({_meta: {max_results: DEFAULT_PER_PAGE, page: 1, total: 1}});
        
        
        Severity: Minor
        Found in scripts/apps/legal-archive/services/LegalArchiveService.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 MacrosController has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function MacrosController($scope, macros, desks, autosave, $rootScope, storage, editorResolver) {
            let expandedGroup = storage.getItem('expandedGroup') || [];
        
            $scope.loading = true;
        
        
        Severity: Minor
        Found in scripts/apps/authoring/macros/macros.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 RelatedItemController has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function RelatedItemController(
            $scope,
            api,
            BaseWidgetController,
            notify,
        Severity: Minor
        Found in scripts/apps/archive/related-item-widget/relatedItem.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 AuthoringThemesService has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        export function AuthoringThemesService(storage, preferencesService) {
            var service: any = {};
        
            service.availableThemes = {
                fonts: [
        Severity: Minor
        Found in scripts/apps/authoring/authoring/services/AuthoringThemesService.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 14 (exceeds 5 allowed). Consider refactoring.
        Open

            render() {
                const props = this.props;
        
                if (props.item.state != null) {
                    let title = getStateLabel(props.item.state);
        Severity: Minor
        Found in scripts/apps/search/components/fields/state.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 InputArray has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        export const InputArray: React.StatelessComponent<any> = ({
            field,
            value,
            onChange,
            addButtonComponent,
        Severity: Minor
        Found in scripts/core/ui/components/Form/InputArray/index.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 14 (exceeds 5 allowed). Consider refactoring.
        Open

            render() {
                const {children} = this.props;
        
                const childrenEmpty =
                    typeof children === 'undefined'
        Severity: Minor
        Found in scripts/core/ui/components/drop-zone-3.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 14 (exceeds 5 allowed). Consider refactoring.
        Open

            render() {
                const {
                    field,
                    value,
                    checkedValue,
        Severity: Minor
        Found in scripts/core/ui/components/Form/Checkbox.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 editor3StateToHtml has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        export const editor3StateToHtml = (
            contentState: ContentState,
            disabled: Array<string> = [], // A set of disabled elements (ie. ['table'] will ignore
        ): string => {
            const annotationsByStyleName = getAnnotationsFromContentState(contentState)
        Severity: Minor
        Found in scripts/core/editor3/html/to-html/editor3StateToHtml.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 removeDeleteParagraphSuggestions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        const removeDeleteParagraphSuggestions = (editorState) => {
            const selection = editorState.getSelection();
            let content = editorState.getCurrentContent();
            let block = content.getBlockForKey(selection.getStartKey());
            let offset = 0;
        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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if (this.clickCount === 1) {
                    // Tell React to keep this `event` item around for processing
                    // inside the `window.setTimeout` callback function
                    event.persist();
                    this.singleClickTimer = window.setTimeout(() => {
        Severity: Major
        Found in scripts/extensions/sams/src/ui/grid/GridItem.tsx and 1 other location - About 1 hr to fix
        scripts/extensions/sams/src/ui/list/ListItem.tsx on lines 41..53

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 70.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if (search.name && search.name !== '') {
                    const regExp = new RegExp(search.name, 'i');
        
                    filteredItems = filteredItems.filter((item) => item.name.match(regExp));
                }
        Severity: Major
        Found in scripts/apps/publish/filters/index.ts and 1 other location - About 1 hr to fix
        scripts/apps/products/filters/index.ts on lines 22..26

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 70.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if (search.name && search.name !== '') {
                    const regExp = new RegExp(search.name, 'i');
        
                    filteredItems = filteredItems.filter((item) => item.name.match(regExp));
                }
        Severity: Major
        Found in scripts/apps/products/filters/index.ts and 1 other location - About 1 hr to fix
        scripts/apps/publish/filters/index.ts on lines 22..26

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 70.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                                    <Button
                                        text={gettext('toggle primary')}
                                        onClick={() => {
                                            this.setState({primaryColumnShown: !this.state.primaryColumnShown});
                                        }}
        scripts/apps/authoring-react/compare-articles/compare-articles.tsx on lines 142..148
        scripts/apps/authoring-react/compare-articles/compare-articles.tsx on lines 150..156

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 70.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if (this.clickCount === 1) {
                    // Tell React to keep this `event` item around for processing
                    // inside the `window.setTimeout` callback function
                    event.persist();
                    this.singleClickTimer = window.setTimeout(() => {
        Severity: Major
        Found in scripts/extensions/sams/src/ui/list/ListItem.tsx and 1 other location - About 1 hr to fix
        scripts/extensions/sams/src/ui/grid/GridItem.tsx on lines 29..41

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 70.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                                    <Button
                                        text={gettext('toggle secondary')}
                                        onClick={() => {
                                            this.setState({secondaryColumnShown: !this.state.secondaryColumnShown});
                                        }}
        scripts/apps/authoring-react/compare-articles/compare-articles.tsx on lines 134..140
        scripts/apps/authoring-react/compare-articles/compare-articles.tsx on lines 150..156

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 70.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language