superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

        this.authenticateXMPP = (jid, transactionId) => urls.resource('auth_xmpp')
            .then((url) => $http.post(url, {jid: jid, transactionId: transactionId}))
            .then(this.setToken);
Severity: Major
Found in scripts/core/auth/basic-auth-adapter.ts and 1 other location - About 1 hr to fix
scripts/core/auth/basic-auth-adapter.ts on lines 31..33

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 72.

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 2 locations. Consider refactoring.
Open

interface IProps {
    container: React.ComponentType<IEditorComponentContainerProps>;
    config: IDropdownConfigRemoteSource;
    value: IDropdownValue;
    language: string;
scripts/apps/authoring-react/fields/dropdown/dropdown-tree/editor.tsx on lines 5..12

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 72.

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 2 locations. Consider refactoring.
Open

        this.authenticate = (username, password) => urls.resource('auth_db')
            .then((url) => $http.post(url, {username: username, password: password}))
            .then(this.setToken);
Severity: Major
Found in scripts/core/auth/basic-auth-adapter.ts and 1 other location - About 1 hr to fix
scripts/core/auth/basic-auth-adapter.ts on lines 54..56

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 72.

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 2 locations. Consider refactoring.
Open

    if (backward) {
        newSelection = selection.merge({
            anchorOffset: selection.getEndOffset(),
            anchorKey: selection.getEndKey(),
            focusOffset: selection.getEndOffset(),
Severity: Major
Found in scripts/core/editor3/helpers/selection/selectionIterator.ts and 1 other location - About 1 hr to fix
scripts/core/editor3/helpers/selection/selectionIterator.ts on lines 22..30

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 72.

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 2 locations. Consider refactoring.
Open

        const str2 = (() => {
            if (value2 == null) {
                return '';
            }

Severity: Major
Found in scripts/apps/authoring-react/fields/editor3/difference.tsx and 1 other location - About 1 hr to fix
scripts/apps/authoring-react/fields/editor3/difference.tsx on lines 12..24

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 72.

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 2 locations. Consider refactoring.
Open

        const str1 = (() => {
            if (value1 == null) {
                return '';
            }

Severity: Major
Found in scripts/apps/authoring-react/fields/editor3/difference.tsx and 1 other location - About 1 hr to fix
scripts/apps/authoring-react/fields/editor3/difference.tsx on lines 26..38

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 72.

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

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

    render() {
        const {gettext} = superdeskApi.localization;

        return (
            <React.Fragment>
Severity: Minor
Found in scripts/extensions/sams/src/components/assets/assetEditorPanel.tsx - About 1 hr to fix

    Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(config) {
        var webpackConfig = makeConfig(grunt);
    
        // in karma, entry is read from files prop
        webpackConfig.entry = null;
    Severity: Minor
    Found in karma.conf.js - About 1 hr to fix

      Function assetsReducer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

                render() {
                    const {item} = this.props;
                    const {readOnly} = that.props;
                    const {removeItem} = that;
        
        
        Severity: Minor
        Found in scripts/apps/authoring-react/fields/package-items/editor.tsx - About 1 hr to fix

          Function getEditor3Field has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function getEditor3Field()
          : ICustomFieldType<IEditor3ValueOperational, IEditor3ValueStorage, IEditor3Config, IUserPreferences> {
              const field: ICustomFieldType<IEditor3ValueOperational, IEditor3ValueStorage, IEditor3Config, IUserPreferences> = {
                  id: EDITOR_3_FIELD_TYPE,
                  label: gettext('Editor3 (authoring-react)'),
          Severity: Minor
          Found in scripts/apps/authoring-react/fields/editor3/index.tsx - About 1 hr to fix

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

                    render() {
                        const {item} = this.props;
                        const {readOnly} = that.props;
                        const {removeItem} = that;
            
            
            Severity: Minor
            Found in scripts/apps/authoring-react/fields/linked-items/editor.tsx - About 1 hr to fix

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

                  render() {
                      const {label, helperText, editable, required} = this.props;
              
                      return (
                          <div>
              Severity: Minor
              Found in scripts/apps/authoring/authoring/article-url-fields.tsx - About 1 hr to fix

                Function SearchContainer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function SearchContainer() {
                    const FILTERS_PANEL_PREFERENCES_KEY = 'search:filters_panel_open';
                    var filtersPanelPreferences = {
                        [FILTERS_PANEL_PREFERENCES_KEY]: {
                            'type': 'bool',
                Severity: Minor
                Found in scripts/apps/search/directives/SearchContainer.ts - About 1 hr to fix

                  Function ItemSearchbar has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function ItemSearchbar($location, $document, asset) {
                      return {
                          scope: true,
                          templateUrl: asset.templateUrl('apps/search/views/item-searchbar.html'),
                          link: function(scope, elem) {
                  Severity: Minor
                  Found in scripts/apps/search/directives/ItemSearchbar.ts - About 1 hr to fix

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

                        render() {
                            const {items, markupV2} = this.props;
                    
                            return (
                                <React.Fragment>

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

                          render() {
                              const {
                                  component,
                                  field,
                                  profileName,
                      Severity: Minor
                      Found in scripts/core/ui/components/Form/Field.tsx - About 1 hr to fix

                        Function getSpellchecker has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function getSpellchecker(language: string): ISpellchecker {
                            const spellcheck = ng.get('spellcheck');
                            const spellcheckerName = ({
                                fr: 'grammalecte',
                                nl: 'leuven_dutch',

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

                                  link: function(scope, element, attrs, controller) {
                                      scope.$watch('list', (list) => {
                                          if (!list) {
                                              return false;
                                          }
                          Severity: Minor
                          Found in scripts/core/directives/SliderDirective.ts - About 1 hr to fix

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

                                render() {
                                    const {item, allItems, options} = this.props;
                            
                                    const checkbox = (
                                        <SelectBoxWithoutMutation
                            Severity: Minor
                            Found in scripts/core/ArticlesListV2MultiSelect.tsx - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language