signmeup/signmeup

View on GitHub

Showing 185 of 187 total issues

Function submit #js-modal-join-queue-form has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  "submit #js-modal-join-queue-form"(event, templateInstance) {
    event.preventDefault();
    let errors = false;

    let data = {
Severity: Minor
Found in imports/ui/components/modals/modal-join-queue/modal-join-queue.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

    if (ticket && ticket.isClaimed()) {
      self.claimDurationInterval = Meteor.setInterval(() => {
        self.claimDuration.set(moment().diff(moment(ticket.claimedAt)));
      }, 1000);
    }
Severity: Major
Found in imports/ui/components/ticket/ticket-drawer/ticket-drawer.js and 1 other location - About 2 hrs to fix
imports/ui/components/ticket/ticket-drawer/ticket-drawer.js on lines 30..36

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

    if (ticket && ticket.isMarkedAsMissing()) {
      self.missingDurationInterval = Meteor.setInterval(() => {
        self.missingDuration.set(
          moment().diff(moment(ticket.markedAsMissingAt))
        );
Severity: Major
Found in imports/ui/components/ticket/ticket-drawer/ticket-drawer.js and 1 other location - About 2 hrs to fix
imports/ui/components/ticket/ticket-drawer/ticket-drawer.js on lines 20..24

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

  run({ queueId }) {
    const queue = Queues.findOne(queueId);
    if (!queue) {
      throw new Meteor.Error(
        "queues.doesNotExist",
Severity: Major
Found in imports/api/queues/methods.js - About 2 hrs to fix

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

      tas(course) {
        const tas = course.tas().fetch();
        return tas.sort((a, b) => {
          return a.fullName().localeCompare(b.fullName());
        });
    imports/ui/components/settings-courses/courses-people/courses-people.js on lines 23..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 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

      htas(course) {
        const htas = course.htas().fetch();
        return htas.sort((a, b) => {
          return a.fullName().localeCompare(b.fullName());
        });
    imports/ui/components/settings-courses/courses-people/courses-people.js on lines 30..35

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

      run({ queueId, name, locationId, scheduledEndTime }) {
        const queue = Queues.findOne(queueId);
        if (!queue || queue.status === "ended") {
          throw new Meteor.Error(
            "queues.doesNotExist"`No queue exists with id ${queueId}`
    Severity: Minor
    Found in imports/api/queues/methods.js - About 1 hr to fix

      Function run has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        run({ ticketId }) {
          const ticket = Tickets.findOne(ticketId);
          if (!ticket || ticket.status === "deleted") {
            throw new Meteor.Error(
              "tickets.doesNotExist"`No ticket exists with id ${ticketId}`
      Severity: Minor
      Found in imports/api/tickets/methods.js - About 1 hr to fix

        Function onRendered has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        Template.Queue.onRendered(function onRendered() {
          WebNotifications.requestPermission();
          this.autorun(() => {
            if (this.subscriptionsReady()) {
              const queue = this.getQueue();
        Severity: Minor
        Found in imports/ui/pages/queue/queue.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 run has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          run({ queueId }) {
            const queue = Queues.findOne(queueId);
            if (!queue || queue.status === "ended") {
              throw new Meteor.Error(
                "queues.doesNotExist"`No queue exists with id ${queueId}`
        Severity: Minor
        Found in imports/api/queues/methods.js - About 1 hr to fix

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

            "click .js-release-ticket"(event) {
              event.preventDefault();
          
              releaseTicket.call(
                {
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 13..24
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 26..37
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 55..66
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 14..25
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 40..51

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

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

            "click .js-mark-as-missing"(event) {
              event.preventDefault();
          
              markTicketAsMissing.call(
                {
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 13..24
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 26..37
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 55..66
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 14..25
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 27..38

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

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

            "click .js-open-queue"(event) {
              event.preventDefault();
          
              openQueue.call(
                {
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 26..37
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 55..66
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 14..25
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 27..38
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 40..51

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

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

            "click .js-reopen-queue"(event) {
              event.preventDefault();
          
              reopenQueue.call(
                {
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 13..24
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 26..37
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 14..25
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 27..38
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 40..51

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

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

            "click .js-claim-ticket"(event) {
              event.preventDefault();
          
              claimTicket.call(
                {
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 13..24
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 26..37
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 55..66
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 27..38
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 40..51

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

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

            "click .js-cutoff-queue"(event) {
              event.preventDefault();
          
              cutoffQueue.call(
                {
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 13..24
          imports/ui/components/queue-actions/queue-status-dropdown/queue-status-dropdown.js on lines 55..66
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 14..25
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 27..38
          imports/ui/components/ticket/ticket-ta-actions/ticket-ta-actions.js on lines 40..51

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

          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

          Template.QueueCard.onCreated(function onCreated() {
            this.autorun(() => {
              this.subscribe("tickets.byQueueId", Template.currentData().queue._id);
            });
          });
          Severity: Major
          Found in imports/ui/components/queue-card/queue-card.js and 2 other locations - About 1 hr to fix
          imports/ui/components/queue-alert-restricted-session/queue-alert-restricted-session.js on lines 11..15
          imports/ui/components/settings-courses/courses-people/courses-people.js on lines 16..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 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 3 locations. Consider refactoring.
          Open

          Template.QueueAlertRestrictedSession.onCreated(function onCreated() {
            this.autorun(() => {
              this.subscribe("sessions.byQueueId", Template.currentData().queue._id);
            });
          });
          imports/ui/components/queue-card/queue-card.js on lines 5..9
          imports/ui/components/settings-courses/courses-people/courses-people.js on lines 16..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 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

          Template.CoursesPeople.onRendered(() => {
            const tabId = FlowRouter.getQueryParam("tab");
            if (tabId) {
              $('a[href="#' + tabId + '"]').tab("show");
            }
          imports/ui/components/settings-courses/courses-general/courses-general.js on lines 9..14

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

          Template.CoursesPeople.onCreated(function onCreated() {
            this.autorun(() => {
              this.subscribe("users.staffByCourseId", Template.currentData().course._id);
            });
          });
          imports/ui/components/queue-alert-restricted-session/queue-alert-restricted-session.js on lines 11..15
          imports/ui/components/queue-card/queue-card.js on lines 5..9

          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

          Severity
          Category
          Status
          Source
          Language