4minitz/4minitz

View on GitHub

Showing 435 of 452 total issues

Function users.editProfile has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    'users.editProfile'(userId, eMail, longName) {
        check(eMail, String);
        check(longName, String);
        if (! Meteor.userId()) {
            throw new Meteor.Error('Cannot edit profile', 'User not logged in.');
Severity: Minor
Found in imports/collections/users_private.js - About 2 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

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

        MeetingSeriesSchema.getCollection().find().forEach(meeting => {
            meeting.topics.forEach(migrateTopicsUp);
            meeting.openTopics.forEach(migrateTopicsUp);

            updateTopicsOfSeriesPre16(meeting, MeetingSeriesSchema.getCollection(), {bypassCollection2: true});
Severity: Major
Found in server/migrations/migrate_v4.js and 1 other location - About 2 hrs to fix
server/migrations/migrate_v4.js on lines 43..48

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

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

        MeetingSeriesSchema.getCollection().find().forEach(meeting => {
            meeting.topics.forEach(migrateTopicsDown);
            meeting.openTopics.forEach(migrateTopicsDown);

            updateTopicsOfSeriesPre16(meeting, MeetingSeriesSchema.getCollection(), {bypassCollection2: true});
Severity: Major
Found in server/migrations/migrate_v4.js and 1 other location - About 2 hrs to fix
server/migrations/migrate_v4.js on lines 21..26

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

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

            for (let i=0; minDoc[m].visibleFor&&i<minDoc[m].visibleFor.length; i++) {
                minDoc[m].visibleFor[i] = usrMap[minDoc[m].visibleFor[i]];
            }
Severity: Major
Found in imports/server/exportimport/expImpMinutes.js and 1 other location - About 2 hrs to fix
imports/server/exportimport/expImpMinutes.js on lines 97..99

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

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

            for (let i=0; minDoc[m].informedUsers&&i<minDoc[m].informedUsers.length; i++) {
                minDoc[m].informedUsers[i] = usrMap[minDoc[m].informedUsers[i]];
            }
Severity: Major
Found in imports/server/exportimport/expImpMinutes.js and 1 other location - About 2 hrs to fix
imports/server/exportimport/expImpMinutes.js on lines 94..96

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

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

    'documentgeneration.createAndStoreFile'(minutesId) {
        if (Meteor.isClient) {
            return;
        }
        if (! Meteor.settings.public.docGeneration.enabled) {
Severity: Major
Found in imports/collections/documentgeneration_private.js - About 2 hrs to fix

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

            for (let i in this.visibleFor) {
                let user = Meteor.users.findOne(this.visibleFor[i]);
                user._idOrg = user._id;
                delete user._id;
                Template.instance().userEditConfig.users.insert(user);
    Severity: Major
    Found in client/templates/meetingseries/meetingSeriesEdit.js and 1 other location - About 2 hrs to fix
    client/templates/meetingseries/meetingSeriesEdit.js on lines 169..174

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

    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 3 locations. Consider refactoring.
    Open

                    if (ignoreLock === true) {
                        detail.isEditedBy = null;
                        detail.isEditedDate = null;
                    }
                    else {
    Severity: Major
    Found in imports/services/isEditedService.js and 2 other locations - About 2 hrs to fix
    imports/services/isEditedService.js on lines 42..51
    imports/services/isEditedService.js on lines 53..63

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

    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 3 locations. Consider refactoring.
    Open

            if (ignoreLock === true) {
                topic.isEditedBy = null;
                topic.isEditedDate = null;
            }
            else {
    Severity: Major
    Found in imports/services/isEditedService.js and 2 other locations - About 2 hrs to fix
    imports/services/isEditedService.js on lines 53..63
    imports/services/isEditedService.js on lines 65..74

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

    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 3 locations. Consider refactoring.
    Open

                if (ignoreLock === true)
                {
                    infoItem.isEditedBy = null;
                    infoItem.isEditedDate = null;
                }
    Severity: Major
    Found in imports/services/isEditedService.js and 2 other locations - About 2 hrs to fix
    imports/services/isEditedService.js on lines 42..51
    imports/services/isEditedService.js on lines 65..74

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

    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

            for (let i in this.informedUsers) {
                let user = Meteor.users.findOne(this.informedUsers[i]);
                user._idOrg = user._id;
                delete user._id;
                Template.instance().userEditConfig.users.insert(user);
    Severity: Major
    Found in client/templates/meetingseries/meetingSeriesEdit.js and 1 other location - About 2 hrs to fix
    client/templates/meetingseries/meetingSeriesEdit.js on lines 162..167

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

    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 show.bs.modal #dlgAddInfoItem has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        'show.bs.modal #dlgAddInfoItem': function (evt, tmpl) {
            // at this point we clear the view
            let saveButton = $('#btnInfoItemSave');
            let cancelButton = $('#btnInfoItemCancel');
            saveButton.prop('disabled',false);
    Severity: Major
    Found in client/templates/topic/topicInfoItemEdit.js - About 2 hrs to fix

      Function workflow.addMinutes has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          'workflow.addMinutes'(doc, clientCallback) {
              checkUserAvailableAndIsModeratorOf(doc.meetingSeries_id);
      
              // It is not allowed to insert new minutes if the last minute was not finalized
              check(doc.meetingSeries_id, String);
      Severity: Major
      Found in imports/collections/workflow_private.js - About 2 hrs to fix

        File meetingseries.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Meteor } from 'meteor/meteor';
        import { Random } from 'meteor/random';
        import { MeetingSeriesSchema } from './collections/meetingseries.schema';
        import { MinutesFinder } from '/imports/services/minutesFinder';
        import { Minutes } from './minutes';
        Severity: Minor
        Found in imports/meetingseries.js - About 2 hrs to fix

          Function preImportCheck has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static preImportCheck (db, msID) {
                  return new Promise((resolve, reject) => {
                      const mapFile = msID + ExpImpUsers.MAPNAME_POSTFIX;
                      let usrMap = undefined;
                      try {
          Severity: Major
          Found in imports/server/exportimport/expImpUsers.js - About 2 hrs to fix

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

                'hide.bs.collapse'(evt, tmpl) {
                    let itemID = $(evt.currentTarget).data('itemid');
                    let expandStates = tmpl.isItemExpanded.get();
                    expandStates[itemID] = false;
                    tmpl.isItemExpanded.set(expandStates);
            Severity: Major
            Found in client/templates/topic/topicInfoItemList.js and 1 other location - About 2 hrs to fix
            client/templates/topic/topicInfoItemList.js on lines 656..661

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

            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

                'show.bs.collapse'(evt, tmpl) {
                    let itemID = $(evt.currentTarget).data('itemid');
                    let expandStates = tmpl.isItemExpanded.get();
                    expandStates[itemID] = true;
                    tmpl.isItemExpanded.set(expandStates);
            Severity: Major
            Found in client/templates/topic/topicInfoItemList.js and 1 other location - About 2 hrs to fix
            client/templates/topic/topicInfoItemList.js on lines 650..655

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

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

            let updateCheck = function (forceReport) {
                HTTP.get(url, {}, function (error, result) {
                    if (error || !result.data || !result.data.tag) {
                        // Swallow silently.
                        // If we can't check the version - we will not bother the admin...
            Severity: Minor
            Found in server/updatecheck/slave.js - About 2 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 docMatchesFilterTokens has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                docMatchesFilterTokens(doc, filterTokens) {
                    for (let i=0; i < filterTokens.length; i++) {
                        let filter = filterTokens[i];
            
                        switch (filter.key) {
            Severity: Minor
            Found in imports/search/ItemsFilter.js - About 2 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 click .detailText has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                'click .detailText'(evt, tmpl) {
                    evt.preventDefault();
                    /** @type {TopicInfoItemListContext} */
                    const context = tmpl.data;
            
            
            Severity: Major
            Found in client/templates/topic/topicInfoItemList.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language