4minitz/4minitz

View on GitHub

Showing 435 of 452 total issues

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

    hasLabelWithId(labelId) {
        let i;
        for (i = 0; i < this._topicDoc.labels.length; i++) {
            if (this._topicDoc.labels[i] === labelId) {
                return true;
Severity: Major
Found in imports/topic.js and 1 other location - About 2 hrs to fix
imports/infoitem.js on lines 189..197

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

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

    hasLabelWithId(labelId) {
        let i;
        for (i = 0; i < this._infoItemDoc.labels.length; i++) {
            if (this._infoItemDoc.labels[i] === labelId) {
                return true;
Severity: Major
Found in imports/infoitem.js and 1 other location - About 2 hrs to fix
imports/topic.js on lines 305..313

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

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

    static getDocumentData(context) {
        let presentParticipants = context._participants.filter(participant => {
            return participant.present;
        });

Severity: Major
Found in imports/documentGeneration.js - About 2 hrs to fix

    Function click #btnDelInfoItem has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        'click #btnDelInfoItem'(evt, tmpl) {
            /** @type {TopicInfoItemListContext} */
            const context = tmpl.data;
            performActionForItem(evt, tmpl, (item) => {
                let isDeleteAllowed = item.isDeleteAllowed(context.getSeriesId(item._infoItemDoc._id));
    Severity: Minor
    Found in client/templates/topic/topicInfoItemList.js - About 1 hr to fix

      Function submit #frmDlgEditMeetingSeries has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          'submit #frmDlgEditMeetingSeries': function(evt, tmpl) {
              evt.preventDefault();
              let saveButton = $('#btnMeetingSeriesSave');
              let cancelButton = $('btnMeetinSeriesEditCancel');
              saveButton.prop('disabled',true);
      Severity: Minor
      Found in client/templates/meetingseries/meetingSeriesEdit.js - About 1 hr to fix

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

            onAfterUpload: function (file) {
                console.log('Successfully uploaded attachment file: '+file.name + ' to '+file.path);
                AttachmentsCollection.update(file._id, {$set: {'meta.timestamp': new Date()}});
            }
        Severity: Major
        Found in imports/collections/attachments_private.js and 1 other location - About 1 hr to fix
        imports/collections/documentgeneration_private.js on lines 50..53

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

        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

            onAfterUpload: function (file) {
                console.log('Successfully created protocol: ' + file.name + ' to ' + file.path);
                DocumentsCollection.update(file._id, {$set: {'meta.timestamp': new Date()}});
            },
        Severity: Major
        Found in imports/collections/documentgeneration_private.js and 1 other location - About 1 hr to fix
        imports/collections/attachments_private.js on lines 81..84

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

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

            'blur .detailInput'(evt, tmpl) {
                evt.preventDefault();
                /** @type {TopicInfoItemListContext} */
                const context = tmpl.data;
        
        
        Severity: Minor
        Found in client/templates/topic/topicInfoItemList.js - About 1 hr to fix

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

          function saveMinutes(minutes) {
              minutes.forEach(min => {
                  MinutesSchema.getCollection().update(
                      min._id, {
                          $set: {
          Severity: Major
          Found in server/migrations/migrate_v20.js and 1 other location - About 1 hr to fix
          server/migrations/migrate_v20.js on lines 17..28

          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

          function saveTopics(topics) {
              topics.forEach(topic => {
                  TopicSchema.getCollection().update(
                      topic._id, {
                          $set: {
          Severity: Major
          Found in server/migrations/migrate_v20.js and 1 other location - About 1 hr to fix
          server/migrations/migrate_v20.js on lines 4..15

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

              static doImport (db, msID, usrMap) {
                  return new Promise((resolve, reject) => {
                      const usrFile = msID + ExpImpUsers.FILENAME_POSTFIX;
                      let allUsersDoc = undefined;
                      try {
          Severity: Minor
          Found in imports/server/exportimport/expImpUsers.js - About 1 hr to fix

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

                static up() {
                    console.log('% Progress - updating all topics. This might take several minutes...');
                    let allSeries = MeetingSeriesSchema.getCollection().find();
                    allSeries.forEach(series => {
                        (new MigrateSeriesUp(series)).run();
            Severity: Major
            Found in server/migrations/migrate_v12.js and 1 other location - About 1 hr to fix
            server/migrations/migrate_v10.js on lines 74..80

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

            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

                static up() {
                    console.log('% Progress - updating all topics. This might take several minutes...');
                    let allSeries = MeetingSeriesSchema.getCollection().find();
                    allSeries.forEach(series => {
                        (new MigrateSeriesUp(series)).run();
            Severity: Major
            Found in server/migrations/migrate_v10.js and 1 other location - About 1 hr to fix
            server/migrations/migrate_v12.js on lines 138..144

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

            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 handleDemoUserAccount has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            let handleDemoUserAccount = function () {
                if (GlobalSettings.createDemoAccount()) {
                    let demoUser = Meteor.users.findOne({$and: [{username: 'demo'}, {isDemoUser: true}]});
                    if (!demoUser) {    // we don't have a demo user, but settings demand one
                        Accounts.createUser({username: 'demo', password: 'demo', email: '', profile: {name: 'Demo User'}});
            Severity: Minor
            Found in server/main.server.js - 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 blur .detailInput has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                'blur .detailInput'(evt, tmpl) {
                    evt.preventDefault();
                    /** @type {TopicInfoItemListContext} */
                    const context = tmpl.data;
            
            
            Severity: Minor
            Found in client/templates/topic/topicInfoItemList.js - 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

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

                async updateLastMinutesFields (callback) {
                    callback = callback || function () {};
            
                    try {
                        let result = await this.updateLastMinutesFieldsAsync();
            Severity: Major
            Found in imports/meetingseries.js and 1 other location - About 1 hr to fix
            imports/infoitem.js on lines 134..143

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

            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

                async save(callback) {
                    callback = callback || function () {};
            
                    try {
                        let result = await this.saveAsync();
            Severity: Major
            Found in imports/infoitem.js and 1 other location - About 1 hr to fix
            imports/meetingseries.js on lines 135..144

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

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

            function select2search(selectResponsibles, delayTime, freeTextValidator, minuteID, topicOrItem) {
                let minute = new Minutes(minuteID);
                let preparer = new ParticipantsPreparer(minute, topicOrItem, Meteor.users, freeTextValidator);
                let participants = preparer.getPossibleResponsibles();
                selectResponsibles.select2({
            Severity: Minor
            Found in imports/client/ResponsibleSearch.js - About 1 hr to fix

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

                      MinutesSchema.getCollection().find().forEach(minute => {
                          minute.topics.forEach(migrateTopicsUp);
                          updateTopicsOfMinutes(minute, MinutesSchema.getCollection(), {bypassCollection2: true});
                      });
              Severity: Major
              Found in server/migrations/migrate_v4.js and 1 other location - About 1 hr to fix
              server/migrations/migrate_v4.js on lines 38..41

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

              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

                      MinutesSchema.getCollection().find().forEach(minute => {
                          minute.topics.forEach(migrateTopicsDown);
                          updateTopicsOfMinutes(minute, MinutesSchema.getCollection(), {bypassCollection2: true});
                      });
              Severity: Major
              Found in server/migrations/migrate_v4.js and 1 other location - About 1 hr to fix
              server/migrations/migrate_v4.js on lines 17..20

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

              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