4minitz/4minitz

View on GitHub

Showing 160 of 452 total issues

Function generateNewParticipants has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    generateNewParticipants () {
        if (this.isFinalized) {
            throw new Error('generateNewParticipants () must not be called on finalized minutes');
        }
        let changed = false;
Severity: Minor
Found in imports/minutes.js - About 1 hr to fix

    Function attachments.remove has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        'attachments.remove'(attachmentID) {
            if (Meteor.isServer && attachmentID) {
                if (! this.userId) {
                    console.log('Attachment removal prohibited. User not logged in.');
                    return false;
    Severity: Minor
    Found in imports/collections/attachments_private.js - About 1 hr to fix

      Function up has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static up() {
      
              MinutesSchema.getCollection().find().forEach(minute => {
                  MigrateV7._upgradeTopics(minute.topics);
      
      
      Severity: Minor
      Found in server/migrations/migrate_v7.js - About 1 hr to fix

        Function change #btnUploadAttachment has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            'change #btnUploadAttachment': function (e, template) {
                if (e.currentTarget.files && e.currentTarget.files[0]) {
                    // We upload only one file, in case
                    // multiple files were selected
                    const uploadFilename = e.currentTarget.files[0];
        Severity: Minor
        Found in client/templates/minutes/minutesAttachments.js - About 1 hr to fix

          Function show.bs.modal #dlgEditMeetingSeries has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              'show.bs.modal #dlgEditMeetingSeries': function (evt, tmpl) {
          
                  const ms = new MeetingSeries(tmpl.data._id);
          
                  const element = ms;
          Severity: Minor
          Found in client/templates/meetingseries/meetingSeriesEdit.js - About 1 hr to fix

            Function upsertInfoItem has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                async upsertInfoItem(topicItemDoc, saveChanges, insertPlacementTop = true) {
                    if (saveChanges === undefined) {
                        saveChanges = true;
                    }
                    let i = undefined;
            Severity: Minor
            Found in imports/topic.js - About 1 hr to fix

              Function minutes.update has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  'minutes.update'(doc) {
                      // Make sure the user is logged in before changing collections
                      if (!Meteor.userId()) {
                          throw new Meteor.Error('not-authorized');
                      }
              Severity: Minor
              Found in imports/collections/minutes_private.js - About 1 hr to fix

                Function _doMigration has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _doMigration() {
                        MinutesSchema.getCollection().find().forEach(minute => {
                            this._migrateTopics(minute.topics);
                
                            // We switch off bypassCollection2 here, to skip .clean & .validate to allow empty string values
                Severity: Minor
                Found in server/migrations/helpers/migrateItems.js - About 1 hr to fix

                  Function getUser has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      static getUser()  {
                          UserFactory.counter += 1;
                          const username = "user_"+UserFactory.postfix+"_"+UserFactory.counter;
                          return {
                              _id: random.generate({
                  Severity: Minor
                  Found in private/createTestUsers.js - About 1 hr to fix

                    Function send has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 handleTemplatesGlobalKeyboardShortcuts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    let handleTemplatesGlobalKeyboardShortcuts = function(switchOn) {
                        if (switchOn) {
                            $(document).keydown( function(evt) {
                                if ($('.modal.in').length > 0) {    // any modal dialog open?
                                    return;
                    Severity: Minor
                    Found in client/templates/minutes/minutesedit.js - About 55 mins 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 createItem has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 e2e.resetMyApp has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 users.admin.changePassword has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        'users.admin.changePassword'(userId, password1, password2) {
                            if (Meteor.isServer) {
                                // #Security: Only logged in admin may invoke this method: users.admin.changePassword
                                console.log('users.admin.changePassword for user: '+Meteor.userId());
                                if (! Meteor.userId()) {
                    Severity: Minor
                    Found in imports/collections/users_private.js - About 55 mins 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 updateTopicSorting has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    let updateTopicSorting = function (event, ui) {
                        const draggedTopicID = $(ui.item).attr('data-id');
                        if (!draggedTopicID) {
                            return;
                        }
                    Severity: Minor
                    Found in client/templates/minutes/minutesedit.js - About 55 mins 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 users.admin.registerUser has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        'users.admin.registerUser'(username, longname, email, password1, password2, sendMail, sendPassword) {
                    Severity: Major
                    Found in imports/collections/users_private.js - About 50 mins to fix

                      Function convertOldPriority has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const convertOldPriority = (priority) => {
                          priority = (priority) ? priority.toUpperCase() : '';
                          if ( priority.startsWith('HIGH') || priority.startsWith('WICHTIG') || priority.startsWith('ASAP') ) {
                              return 1;
                          } else if ( priority.startsWith('MEDIUM') || priority.startsWith('MITTEL') ) {
                      Severity: Minor
                      Found in server/migrations/migrate_v15.js - About 45 mins 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

                      Avoid deeply nested control flow statements.
                      Open

                                          if (detail.isEditedBy === Meteor.userId()) {
                                              detail.isEditedBy = null;
                                              detail.isEditedDate = null;
                                          }
                      Severity: Major
                      Found in imports/services/isEditedService.js - About 45 mins to fix

                        Function docMatchesSearchTokens has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            docMatchesSearchTokens(doc, searchTokens) {
                                for (let i=0; i < searchTokens.length; i++) {
                                    let token = this._toUpper(searchTokens[i]);
                                    let subject = this._toUpper(doc.subject);
                                    let infos = (doc.details)
                        Severity: Minor
                        Found in imports/search/ItemsFilter.js - About 45 mins 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 updateParticipantPresent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            async updateParticipantPresent(userid, isPresent) {
                                let index = -1;
                                if (this.participants) {
                                    for (let i=0; i < this.participants.length; i++) {
                                        if (this.participants[i].userId === userid) {
                        Severity: Minor
                        Found in imports/minutes.js - About 45 mins 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