4minitz/4minitz

View on GitHub

Showing 435 of 452 total issues

Function onBeforeUpload has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    onBeforeUpload: function (file) {
        if (! GlobalSettings.getAttachmentsEnabled()) {
            return 'Upload not allowed in settings.json';
        }
        // Check if this upload candidate is allowed by size and extension
Severity: Minor
Found in imports/collections/attachments_private.js - About 1 hr to fix

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

    let _connectMongo = function (mongoUrl) {
        return new Promise((resolve, reject) => {
            mongo.connect(mongoUrl, (error, db) => {
                if (error) {
                    reject(error);
    Severity: Major
    Found in private/createTestUsers.js and 1 other location - About 1 hr to fix
    private/exportMeetingSeries.js on lines 34..43

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

    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

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

    let _connectMongo = function (mongoUrl) {
        return new Promise((resolve, reject) => {
            mongo.connect(mongoUrl, (error, db) => {
                if (error) {
                    reject(error);
    Severity: Major
    Found in private/exportMeetingSeries.js and 1 other location - About 1 hr to fix
    private/createTestUsers.js on lines 64..73

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

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

        onBeforeUpload: function (file) {
            if (! GlobalSettings.getAttachmentsEnabled()) {
                return 'Upload not allowed in settings.json';
            }
            // Check if this upload candidate is allowed by size and extension
    Severity: Minor
    Found in imports/collections/attachments_private.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 notifyOnRoleChange has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    const notifyOnRoleChange = function(usersWithRolesAfterEdit, meetingSeriesId) {
        function sendEmail (userId, oldRole, newRole, meetingSeriesId) {
            Meteor.call('meetingseries.sendRoleChange', userId, oldRole, newRole, meetingSeriesId);
        }
    
    
    Severity: Minor
    Found in client/templates/meetingseries/meetingSeriesEdit.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 removeIsEditedMinute has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function removeIsEditedMinute(minuteId, ignoreLock) {
        let minute = new Minutes(minuteId);
        for (let topic of minute.topics) {
            if (ignoreLock === true) {
                topic.isEditedBy = null;
    Severity: Minor
    Found in imports/services/isEditedService.js - About 1 hr to fix

      Function docMatchesFilterTokens has 39 lines of code (exceeds 25 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 1 hr to fix

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

            static preImportCheck (db, msID, force=false) {
                return new Promise((resolve, reject) => {
                    db.collection('migrations')
                        .findOne()
                        .then(doc => {
        Severity: Minor
        Found in imports/server/exportimport/expImpSchema.js - About 1 hr to fix

          Function responsiblesSearch has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              'responsiblesSearch' (partialName, participants) {
                  check(partialName, String);
                  let results_participants = []; // get all the participants for the minute
                  let foundPartipantsNames = [];
          
          
          Severity: Minor
          Found in imports/collections/minutes_private.js - About 1 hr to fix

            Function users.editProfile has 38 lines of code (exceeds 25 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 1 hr to fix

              Function send has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  send() {
                      let emailFrom = this._moderator.emails;
                      let modFrom = (emailFrom && emailFrom.length > 0)
                          ? emailFrom[0].address
                          : GlobalSettings.getDefaultEmailSenderAddress();
              Severity: Minor
              Found in imports/mail/RoleChangeMailHandler.js - About 1 hr to fix

                Function _fetchLDAPUsers has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                let _fetchLDAPUsers = function (connection) {
                    let client = connection.client,
                        settings = connection.settings,
                        base = settings.serverDn,
                        searchDn = _.get(settings, 'propertyMap.username', 'cn'),
                Severity: Minor
                Found in imports/ldap/getLDAPUsers.js - About 1 hr to fix

                  Function blur .addItemForm has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      'blur .addItemForm' (evt, tmpl) {
                          if (!tmpl.data.isEditable) {
                              throw new Meteor.Error('illegal-state', 'Tried to call an illegal event in read-only mode');
                          }
                  
                  
                  Severity: Minor
                  Found in client/templates/topic/topicElement.js - About 1 hr to fix

                    Function statisticsDetails has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    let statisticsDetails = function (minMinutesCount = 2, minTopicsCount = 5) { //eslint-disable-line
                        let MS = MeetingSeriesSchema.find();
                        let MScount = 0;
                        let MinutesCount = 0;
                        let TopicCount = 0;
                    Severity: Minor
                    Found in imports/statistics.js - About 1 hr to fix

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

                                      AttachmentsCollection.remove({'meta.meetingminutes_id': minutes_id},
                                          function (error) {
                                              if (error) {
                                                  console.error('File wasn\'t removed, error: ' + error.reason);
                                              } else {
                      Severity: Major
                      Found in imports/collections/workflow_private.js and 1 other location - About 1 hr to fix
                      imports/collections/workflow_private.js on lines 172..180

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

                      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

                                  AttachmentsCollection.remove({'meta.parentseries_id': meetingseries_id},
                                      function (error) {
                                          if (error) {
                                              console.error('File wasn\'t removed, error: ' + error.reason);
                                          } else {
                      Severity: Major
                      Found in imports/collections/workflow_private.js and 1 other location - About 1 hr to fix
                      imports/collections/workflow_private.js on lines 141..149

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

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

                              'e2e.resetMyApp'(skipUsersCreation) {
                                  console.log('-------------------------- E2E-METHOD: resetMyApp ');
                                  AttachmentsCollection.remove({});
                                  console.log('Count AttachmentsCollection after reset:'+AttachmentsCollection.find().count());
                                  // remove the meeting series attachment dir
                      Severity: Minor
                      Found in server/end2end/end2end-helpers.js - About 1 hr to fix

                        Function createItem has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function createItem(itemDoc, parentTopic, minutesId, meetingSeries, type = 'infoItem', labels = []) {
                            itemDoc.labels = convertOrCreateLabelsFromStrings(labels, meetingSeries);
                        
                            if (!itemDoc.createdInMinute) {
                                itemDoc.createdInMinute = minutesId;
                        Severity: Minor
                        Found in client/templates/topic/helpers/create-item.js - About 1 hr to fix

                          Function updateCheck has 37 lines of code (exceeds 25 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 1 hr to fix

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

                                'click .btnToggleAIState'(evt, tmpl) {
                                    performActionForItem(evt, tmpl, (item) => {
                                        if (item instanceof ActionItem) {
                                            item.toggleState();
                                            item.save().catch(handleError);
                            Severity: Major
                            Found in client/templates/topic/topicInfoItemList.js and 1 other location - About 1 hr to fix
                            client/templates/topic/topicInfoItemList.js on lines 460..467

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

                            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