superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

    render() {
        const {gettext} = superdeskApi.localization;
        const {set, storageDestination, count} = this.props;

        if (set?._id == null) {
Severity: Major
Found in scripts/extensions/sams/src/components/sets/setPreviewPanel.tsx - About 3 hrs to fix

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

        render() {
            const {getClass} = this.props;
            const video = this.props.video;
            const left = video ? `${(this.state.trim.start / video.duration) * 100}%` : '0%';
            const right = video ? `${(1 - this.state.trim.end / video.duration) * 100}%` : '0%';
    Severity: Major
    Found in scripts/extensions/videoEditor/src/VideoTimeline/VideoTimeline.tsx - About 3 hrs to fix

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

          render() {
              const hasComments = this.state.comments?.length > 0;
      
              const widgetBody: JSX.Element = hasComments
                  ? (

        Function initSelectedFacets has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function initSelectedFacets(urlParams) {
                let promises = $q.all([desks.initialize(), subscribersService.initialize()]);
        
                return promises.then((result) => {
                    tags.selectedFacets = {};
        Severity: Major
        Found in scripts/apps/search/services/TagService.ts - About 3 hrs to fix

          Function SaveSearch has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function SaveSearch($location, asset, api, notify, $rootScope) {
              return {
                  templateUrl: asset.templateUrl('apps/search/views/save-search.html'),
                  link: function(scope, _elem) {
                      scope.edit = null;
          Severity: Major
          Found in scripts/apps/search/directives/SaveSearch.ts - About 3 hrs to fix

            Function init has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        function init(loadData?) {
                            var params = $location.search();
            
                            scope.query = params.q;
                            scope.flags = false;
            Severity: Major
            Found in scripts/apps/search/directives/SearchParameters.ts - About 3 hrs to fix

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

                      link: function(scope: IScope) {
                          const getSelectedItems = () => multi.getItems();
                          const unselectAll = () => multi.reset();
              
                          const multiActions = getMultiActions(
              Severity: Major
              Found in scripts/apps/search/directives/MultiActionBar.ts - About 3 hrs to fix

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

                    render() {
                        const {debounced} = this.props;
                        const {searchBarExtended} = this.state;
                        const _uniqueId = this.state.uniqueId;
                        const minLength = this.props.minLength ? this.props.minLength : 2;
                Severity: Major
                Found in scripts/core/ui/components/SearchBar/index.tsx - About 3 hrs to fix

                  Function UserNotificationsService has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function UserNotificationsService(
                      $rootScope,
                      $timeout,
                      api,
                      session,
                  Severity: Major
                  Found in scripts/core/menu/notifications/notifications.ts - About 3 hrs to fix

                    Function itemTemplate has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            this.itemTemplate = (templateProps) => {
                                const template = templateProps.entity;
                    
                                const actions: Array<IMenuItem> = [
                                    {

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

                          render() {
                              const ContentPanel = this.getContentPanelComponent();
                      
                              const actions: Array<IAssetCallback> =
                                  [{
                      Severity: Major
                      Found in scripts/extensions/sams/src/apps/samsWorkspace.tsx - About 3 hrs to fix

                        Function LegalArchiveService has 75 lines of code (exceeds 25 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: Major
                        Found in scripts/apps/legal-archive/services/LegalArchiveService.ts - About 3 hrs to fix

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

                                  link: function(scope, elem, attrs) {
                                      let expiryfield = attrs.expiryfield;
                          
                                      scope.contentExpiry = {
                                          expire: true,
                          Severity: Major
                          Found in scripts/apps/desks/directives/ContentExpiry.ts - About 3 hrs to fix

                            Function UserRolesDirective has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function UserRolesDirective(api, notify, modal, $filter, _, metadata) {
                                return {
                                    scope: true,
                                    templateUrl: 'scripts/apps/users/views/settings-roles.html',
                                    link: function(scope) {
                            Severity: Major
                            Found in scripts/apps/users/directives/UserRolesDirective.ts - About 3 hrs to fix

                              Function UserMentionDirective has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function UserMentionDirective(userList, desks, asset, $q) {
                                  return {
                                      templateUrl: asset.templateUrl('apps/users/views/mentions.html'),
                                      link: function(scope, elem) {
                                          scope.users = [];
                              Severity: Major
                              Found in scripts/apps/users/directives/UserMentionDirective.ts - About 3 hrs to fix

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

                                            link: function(scope, element, attrs) {
                                                var width = 105,
                                                    height = 100,
                                                    r = Math.min(width, height) * 0.8 * 0.5,
                                                    dayBg = '#d4d8de',
                                Severity: Major
                                Found in scripts/apps/dashboard/world-clock/world-clock.ts - About 3 hrs to fix

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

                                      render() {
                                          const {options} = this.props;
                                  
                                          if (this.props.item.authors == null || options == null) {
                                              return null;
                                  Severity: Major
                                  Found in scripts/apps/search/components/fields/authors.tsx - About 3 hrs to fix

                                    Function showUnsavedChangesPrompt has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function showUnsavedChangesPrompt(
                                        itemOpen?: boolean, // if not open, instead of option to save item, it will show an option to open it first
                                    ) {
                                        return new Promise((resolve) => {
                                            if (itemOpen === true) {
                                    Severity: Major
                                    Found in scripts/core/ui/components/prompt-for-unsaved-changes.tsx - About 3 hrs to fix

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

                                      const getSaveAsTemplate = (getItem: IExposedFromAuthoring<IArticle>['getLatestItem']): IAuthoringAction => ({
                                          label: gettext('Save as template'),
                                          onTrigger: () => (
                                              showModal(({closeModal}) => {
                                                  return (
                                      scripts/apps/authoring-react/authoring-integration-wrapper.tsx on lines 204..216

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

                                      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

                                                                      <FormItem>
                                                                          <DatePicker
                                                                              label={gettext('Uploaded To:')}
                                                                              value={this.state.localSearchParams.dateTo ?? null}
                                                                              onChange={this.onChange.dateTo}
                                      scripts/extensions/sams/src/components/assets/assetFilterPanel.tsx on lines 348..356

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

                                      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