4minitz/4minitz

View on GitHub
imports/minutes.js

Summary

Maintainability
C
1 day
Test Coverage

Minutes has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

export class Minutes {
    constructor(source) {   // constructs obj from Mongo ID or Mongo document
        if (! source)
            throw new Meteor.Error('invalid-argument', 'Mongo ID or Mongo document required');

Severity: Minor
Found in imports/minutes.js - About 4 hrs to fix

    File minutes.js has 336 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Meteor } from 'meteor/meteor';
    import { i18n } from 'meteor/universe:i18n';
    import { Random } from 'meteor/random';
    import { MinutesSchema } from './collections/minutes.schema';
    import { MeetingSeries } from './meetingseries';
    Severity: Minor
    Found in imports/minutes.js - About 4 hrs to fix

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

        Function generateNewParticipants has a Cognitive Complexity of 7 (exceeds 5 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 35 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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            save (optimisticUICallback, serverCallback) {
                console.log('Minutes.save()');
                if (this.createdAt === undefined) {
                    this.createdAt = new Date();
                }
        Severity: Minor
        Found in imports/minutes.js - About 25 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

        TODO found
        Open

             * TODO Reactive performance may be better if we only update one array element in DB
        Severity: Minor
        Found in imports/minutes.js by fixme

        There are no issues that match your filters.

        Category
        Status