superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

        link: function(scope) {
            api('roles')
                .query()
                .then((result) => {
                    scope.roles = $filter('sortByName')(result._items);
Severity: Minor
Found in scripts/apps/users/directives/RolesPrivilegesDirective.ts - About 1 hr to fix

    Function createPatchObject has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                function createPatchObject() {
                    var p = {};
    
                    _.each(orig, (val, key) => {
                        if (key === 'dateline:located') {
    Severity: Minor
    Found in scripts/apps/users/directives/UserPreferencesDirective.ts - About 1 hr to fix

      Function ItemRendition has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function ItemRendition() {
          return {
              templateUrl: 'scripts/apps/archive/views/item-rendition.html',
              scope: {
                  item: '=',
      Severity: Minor
      Found in scripts/apps/archive/directives/ItemRendition.ts - About 1 hr to fix

        Function openAuthoring has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.open = function openAuthoring(_id, readOnly, repo, action, state) {
                let endpoint = 'archive';
        
                if ($location.$$path !== '/multiedit') {
                    superdeskFlags.flags.authoring = true;
        Severity: Minor
        Found in scripts/apps/authoring/authoring/services/AuthoringService.ts - About 1 hr to fix

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

              render() {
                  if (this.props.action === 'view' && typeof this.state.articleOriginal === 'undefined') {
                      return null; // fetching article from the server
                  }
          
          
          Severity: Minor
          Found in scripts/apps/authoring/authoring/authoring-topbar-react.tsx - About 1 hr to fix

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

                    link: function(scope, elem, attrs, dropdown) {
                        scope.$watch(dropdown.isOpen, (isOpen) => {
                            if (isOpen) {
                                _.defer(() => {
                                    var keyboardOptions = {inputDisabled: false, propagate: false};
            Severity: Minor
            Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

              Function initCarousel has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          function initCarousel() {
                              let updated = false;
              
                              carousel = elem.find(carouselContainerSelector).owlCarousel({
                                  items: 1,

                Function selectLocator has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            scope.selectLocator = function(locator) {
                                var updates = {};
                                let loc = locator;
                
                                if (!loc && scope.$ctrl.selectedTerm) {
                Severity: Minor
                Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

                  Function spikeItems has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function spikeItems(): void {
                          const spikeMultiple = () => {
                              Promise.all(
                                  getSelectedItems().map((item) => sdApi.article.doSpike(item)),
                              ).then(() => {
                  Severity: Minor
                  Found in scripts/apps/search/controllers/get-multi-actions.tsx - About 1 hr to fix

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

                        render() {
                            return (
                                this.props.total > 0 ?
                                    this.props.items.map((item, key) => (
                                        <li className="content-item" key={key}>
                    Severity: Minor
                    Found in scripts/apps/master-desk/components/ListItemsComponent.tsx - About 1 hr to fix

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

                          render() {
                              const classes = classNames(
                                  'plain-text-editor',
                                  this.props.classes,
                                  {focus: this.state.hasFocus},
                      Severity: Minor
                      Found in scripts/core/ui/components/PlainTextEditor/PlainTextEditor.tsx - About 1 hr to fix

                        Function getComponent has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            const getComponent = (val, index, _row) => {
                                const indexReadOnly = isIndexReadOnly(index);
                        
                                return _row ?
                                    (
                        Severity: Minor
                        Found in scripts/core/ui/components/Form/InputArray/index.tsx - About 1 hr to fix

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

                              render() {
                                  return (
                                      <Modal
                                          visible
                                          zIndex={1050}
                          Severity: Minor
                          Found in scripts/core/ui/components/Modal/ModalPrompt.tsx - About 1 hr to fix

                            Function generateFilterForServer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function generateFilterForServer(type: FormFieldType, value: any): any {
                                switch (type) {
                                case FormFieldType.plainText:
                                    return {
                                        $regex: value,

                              Function fetch has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private fetch(priority: RequestPriority = RequestPriority.LOW) {
                                      const requestParams = this.requestFactory();
                              
                                      if (requestParams.endpoint[0] !== '/') {
                                          requestParams.endpoint = '/' + requestParams.endpoint;
                              Severity: Minor
                              Found in scripts/core/helpers/data-provider.ts - About 1 hr to fix

                                Function startListeners has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private startListeners() {
                                        this.listeners.push(addWebsocketEventListener(
                                            'resource:created',
                                            (event: IWebsocketMessage<IResourceCreatedEvent>) => {
                                                const specs = this.listenTo[event.extra.resource];
                                Severity: Minor
                                Found in scripts/core/helpers/data-provider.ts - About 1 hr to fix

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

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

                                    Function handleContentChanges has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        handleContentChanges(changes: Array<IResourceChange>) {
                                            const {data} = this.state;
                                            const dataInitialized = data != null;
                                    
                                            if (this.updatingRequestInProgress || dataInitialized !== true) {
                                    Severity: Minor
                                    Found in scripts/core/with-live-query.tsx - About 1 hr to fix

                                      Function getFilters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function getFilters(filters: IRundownFilters | undefined): ILogicalOperator | undefined {
                                          const queryFilters: IAndOperator['$and'] = [];
                                      
                                          if (filters?.show != null) {
                                              queryFilters.push({show: {$eq: filters.show}});
                                      Severity: Minor
                                      Found in scripts/extensions/broadcasting/src/rundowns/rundowns-list.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 SubscribersDirective has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          notify, api, subscribersService, adminPublishSettingsService,
                                          modal, contentFilters, $q, $filter, products, $rootScope,
                                      Severity: Major
                                      Found in scripts/apps/publish/directives/SubscribersDirective.ts - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language