catarse/catarse.js

View on GitHub

Showing 1,380 of 1,380 total issues

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

            const projectsExploreVM = new ProjectsExploreViewModel({
                mode: 'all_modes',
                category_id: null,
                searchParam: null,
                filter: 'all',
Severity: Major
Found in legacy/spec/components/vms/projects-explore-vm.spec.js and 1 other location - About 1 hr to fix
legacy/spec/components/vms/projects-explore-vm.spec.js on lines 208..221

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

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

                        m('div', [
                            m('span.fontcolor-secondary', window.I18n.t('bank.account', I18nScope())),
                            m.trust(' '),
                            `${item.account}-${item.account_digit}`
                        ]),
Severity: Major
Found in legacy/src/c/user-balance-request-modal-content.js and 1 other location - About 1 hr to fix
legacy/src/c/user-balance-request-modal-content.js on lines 178..182

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

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 oninit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    oninit: function(vnode) {
        const stats = prop([]),
            projects = prop([]),
            l = prop(),
            sample3 = _.partial(_.sample, _, 3),
Severity: Minor
Found in legacy/src/root/flex.js - About 1 hr to fix

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

        oninit: function(vnode) {
    
            const {
                ViewContentEvent,
            } = projectVM;
    Severity: Minor
    Found in legacy/src/root/projects-contribution.js - About 1 hr to fix

      Function sendAnswer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  sendAnswer = () => {
                      const data = {};
                      _.extend(data, {
                          survey_address_answers_attributes: {
                              addresses_attributes: addVM().getFields()
      Severity: Minor
      Found in legacy/src/root/surveys-show.js - About 1 hr to fix

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

            view({ state, attrs }) {
        
                /** @type {HomeVM} */
                const vm = state.vm;
                const banners = vm.banners;
        Severity: Minor
        Found in legacy/src/root/admin-home-banners.js - About 1 hr to fix

          Function loadNotifications has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  const loadNotifications = () => {
                      const notificationsInternal = prop([]);            
                      const addNotificationsToInternal = (notifications) => notificationsInternal(notifications);
          
                      // First loads the first page and configure the next interactions
          Severity: Minor
          Found in legacy/src/c/admin-subscription-detail.js - About 1 hr to fix

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

                oninit: function(vnode) {
                    let l = prop(false);
                    const deleteSuccess = prop(false),
                        confirmed = prop(true),
                        error = prop(''),
            Severity: Minor
            Found in legacy/src/c/delete-project-modal-content.js - About 1 hr to fix

              Function stateClass has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          stateClass = (state) => {
                              const classes = {
                                  online: {
                                      paid: 'text-success.fa-circle',
                                      refunded: 'text-error.fa-circle',
              Severity: Minor
              Found in legacy/src/c/project-contribution-report-content-card.js - About 1 hr to fix

                Function displayTabContent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            displayTabContent = (project) => {
                                const c_opts = {
                                        project,
                                        post_id: vnode.attrs.post_id,
                                        subscriptionData: vnode.attrs.subscriptionData
                Severity: Minor
                Found in legacy/src/c/project-main.js - About 1 hr to fix

                  Function p has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          const p = new Promise((resolve, reject) => {
                              m.request({
                                  method: 'GET',
                                  url: `/payment/pagarme/${contribution_id}/get_encryption_key`,
                                  config: setCsrfToken
                  Severity: Minor
                  Found in legacy/src/vms/payment-vm.js - About 1 hr to fix

                    Function runFunctionsWithinRange has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
                      var scheduledFunc;
                      var funcsToRun = [];
                      for (var timeoutKey in this.scheduledFunctions) {
                        scheduledFunc = this.scheduledFunctions[timeoutKey];
                    Severity: Minor
                    Found in legacy/spec/lib/jasmine/jasmine.js - About 1 hr to fix

                      Function updateProject has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const updateProject = async (project_id) => {
                          const projectData = {
                              tracker_snippet_html: fields.tracker_snippet_html(),
                              user_id: fields.user_id(),
                              all_tags: fields.admin_tags(),
                      Severity: Minor
                      Found in legacy/src/vms/project-basics-vm.js - About 1 hr to fix

                        Function RedrawScheduler has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function RedrawScheduler() {
                            let redrawsRequestCounter = 0;
                            const markedCallStack = {};
                            const requestAnimationFramePolyfill = (function() {
                                if (window.requestAnimationFrame !== undefined) {
                        Severity: Minor
                        Found in legacy/src/h.ts - About 1 hr to fix

                          Function ajax has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            var ajax = (function(){
                              //based on https://raw.githubusercontent.com/yanatan16/nanoajax/v0.2.4/index.js
                              function getRequest() {
                                if (window.XMLHttpRequest)
                                  return new window.XMLHttpRequest;
                          Severity: Minor
                          Found in legacy/spec/lib/analytics.js - About 1 hr to fix

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

                                view({ attrs, state } : m.Vnode<ExploreMobileSearchAttrs, ExploreMobileSearchState>) {
                                    const action = attrs.action || `/${window.I18n.locale}/explore?ref=ctrse_explore_pgsearch&filter=all`
                                    const method = attrs.method || 'GET'
                                    const searchParam = state.searchParam
                            
                            
                            Severity: Minor
                            Found in legacy/src/c/explore/explore-mobile-search.tsx - About 1 hr to fix

                              Function loadProjects has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private loadProjects(model, parameters : Object = {}) : ViewModel<Project> {
                                      model.pageSize(9);
                                      if (this._searchParam) {
                                          return new SinglePageViewModel(async () => {
                                              const projectsFound = await this.makeProjectsSearch()
                              Severity: Minor
                              Found in legacy/src/vms/projects-explore-vm.ts - About 1 hr to fix

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

                                    oninit: function(vnode) {
                                        const userDetails = prop(vnode.attrs.user_details || {}),
                                            user_id = vnode.attrs.user_id.split('-')[0],
                                            hash = prop(window.location.hash),
                                            displayTabContent = (user) => {
                                Severity: Minor
                                Found in legacy/src/root/users-show.js - About 1 hr to fix

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

                                      oninit: function(vnode) {
                                          vnode.state = {
                                              actions: {
                                                  reset: {
                                                      property: 'password',
                                  Severity: Minor
                                  Found in legacy/src/c/admin-user-detail.js - About 1 hr to fix

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

                                        oninit: function(vnode) {
                                            const subscription = vnode.attrs.subscription,
                                                reward = prop(),
                                                toggleDetails = h.toggleProp(false, true),
                                                user = prop(vnode.attrs.user);
                                    Severity: Minor
                                    Found in legacy/src/c/dashboard-subscription-card.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language