catarse/catarse.js

View on GitHub

Showing 570 of 1,380 total issues

Function view has 142 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    view({state, attrs}) {
        
        const projectsExploreVM : ProjectsExploreViewModel = state.projectsExploreVM;
        const projectsCollection = projectsExploreVM.projectsView.collection();
        const isContributedByFriendsFilter = projectsExploreVM.filter === 'contributed_by_friends';
Severity: Major
Found in legacy/src/root/projects-explore.ts - About 5 hrs to fix

    ProjectsExploreViewModel has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class ProjectsExploreViewModel {
    
        private _observer : Observer<Query>;
        private _categories : Category[];
        private _mode : Mode;
    Severity: Minor
    Found in legacy/src/vms/projects-explore-vm.ts - About 5 hrs to fix

      Function view has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          view: function({state}) {
              
              const project = _.first(state.projectDetails()),
                  isSubscription = projectVM.isSubscription(project),
                  recipients = state.fields.recipients;
      Severity: Minor
      Found in legacy/src/root/posts.js - About 5 hrs 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 oninit has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          oninit: function(vnode) {
              const vm = vnode.attrs.vm,
                  isSubscriptionEdit = vnode.attrs.isSubscriptionEdit || prop(false),
                  subscriptionEditConfirmed = prop(false),
                  showSubscriptionModal = prop(false),
      Severity: Minor
      Found in legacy/src/c/payment-credit-card.js - About 5 hrs 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

      File mithril-query.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict'
      
      const m = require('mithril/render/hyperscript')
      const cssauron = require('cssauron')
      const code = require('yields-keycode')
      Severity: Minor
      Found in legacy/spec/lib/mithril-query/mithril-query.js - About 5 hrs to fix

        Function view has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            view: function({state, attrs}) {
                const isInternational = state.vm.isInternational();
        
                return m('.w-form.u-marginbottom-40', {
                    oncreate: state.loadPagarme
        Severity: Minor
        Found in legacy/src/c/payment-credit-card.js - About 5 hrs 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 oninit has 132 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            oninit: function(vnode) {
                let parsedErrors = userSettingsVM.mapRailsErrors(railsErrorsVM.railsErrors());
                let deleteFormSubmit;
                const user = vnode.attrs.user();
                const userAddress = user.address || {};
        Severity: Major
        Found in legacy/src/c/user-settings.js - About 5 hrs to fix

          Function oninit has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

              oninit: function (vnode) {
                  const reward = vnode.attrs.reward(),
                      imageFileToUpload = prop(null),
                      isUploadingRewardImage = prop(false),
                      isDeletingRewardImage = prop(false),
          Severity: Minor
          Found in legacy/src/c/dashboard-reward-card.js - About 5 hrs 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 oninit has 131 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              oninit: function(vnode) {
                  const {
                          survey_id
                      } = vnode.attrs,
                      contributionId = m.route.param('contribution_id'),
          Severity: Major
          Found in legacy/src/root/surveys-show.js - About 5 hrs to fix

            Function addressVM has 131 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const addressVM = (args) => {
                const data = args.data;
                const international = prop();
                const statesLoader = catarse.loader(models.state.getPageOptions());
            
            
            Severity: Major
            Found in legacy/src/vms/address-vm.js - About 5 hrs to fix

              Function view has 131 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  view({ attrs, state } : m.Vnode<UserInfoEditPublicProfileAttrs, UserInfoEditPublicProfileState>) {
                      const user = attrs.user
                      const hasErrorOn = attrs.hasErrorOn
                      const getErrorsOn = attrs.getErrorsOn
                      const onSelectProfileImage = attrs.onSelectProfileImage

                File project-basics-edit.js has 384 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import m from 'mithril';
                import prop from 'mithril/stream';
                import _ from 'underscore';
                import { catarse } from '../api';
                import models from '../models';
                Severity: Minor
                Found in legacy/src/c/project-basics-edit.js - About 5 hrs to fix

                  File payment-vm.js has 384 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import m from 'mithril';
                  import prop from 'mithril/stream';
                  import _ from 'underscore';
                  import moment, { defaultFormat } from 'moment';
                  import h from '../h';
                  Severity: Minor
                  Found in legacy/src/vms/payment-vm.js - About 5 hrs to fix

                    Function view has 129 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        view({ attrs, state } : m.Vnode<ShareAttrs, ShareState>) {
                            
                            const project = attrs.project
                            const projectUrl = `${window.location.origin}/${project.permalink}`
                            const copyToClipboard = (copyText : HTMLInputElement) => {
                    Severity: Major
                    Found in legacy/src/root/projects/publish-by-steps/share.tsx - About 5 hrs to fix

                      Function view has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                          view: function({state, attrs}) {
                              const list = state.listVM,
                                  project = attrs.project() || {},
                                  postHeader = (post) => _.map(post.rewards_that_can_access_post, r => ` R$${h.formatNumber(r.minimum_value)}${r.title ? ` - ${r.title}` : ''}`),
                                  postTextSubscription = (post) => `Post exclusivo para assinantes${ post.rewards_that_can_access_post ? ' de' : ''}${postHeader(post)}`,
                      Severity: Minor
                      Found in legacy/src/c/project-posts.js - About 5 hrs 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 view has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                          view: function({state, attrs}) {
                              const contribution = attrs.contribution(),
                                  project = attrs.project(),
                                  survey = _.first(state.survey()),
                                  profileImg = (_.isEmpty(contribution.profile_img_thumbnail) ? '/assets/catarse_bootstrap/user.jpg' : contribution.profile_img_thumbnail),
                      Severity: Minor
                      Found in legacy/src/c/project-contribution-report-content-card.js - About 5 hrs 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

                      File publish-vm.js has 378 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import m from 'mithril';
                      import h from '../h';
                      
                      const formattedServiceFee = (project) => (project.service_fee * 100).toFixed(2).replace(/(\.|,)?0+$/g, '');
                      
                      
                      Severity: Minor
                      Found in legacy/src/vms/publish-vm.js - About 5 hrs to fix

                        Function view has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            view({ attrs, state } : m.Vnode<CardEditAttrs, CardEditState>) {
                                
                                const project = attrs.project
                                const isSaving = attrs.isSaving
                                const save = attrs.save
                        Severity: Major
                        Found in legacy/src/root/projects/publish-by-steps/card-edit.tsx - About 4 hrs to fix

                          Function oninit has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              oninit({ attrs, state }: m.Vnode<RewardsEditListAttrs, RewardsEditListState>) {
                                  const rewards = prop<StreamType<RewardDetailsStream>[]>([])
                                  const loading = attrs.loading
                                  const error = attrs.error
                                  const errors = attrs.errors
                          Severity: Major
                          Found in legacy/src/c/projects/edit/rewards-edit-list.tsx - About 4 hrs to fix

                            Function view has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                            Open

                                view: function ({
                                    state,
                                    attrs
                                }) {
                                    const reward = attrs.reward();
                            Severity: Minor
                            Found in legacy/src/c/dashboard-reward-card.js - About 4 hrs 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

                            Severity
                            Category
                            Status
                            Source
                            Language