wanglian/workbase-server

View on GitHub

Showing 19 of 51 total issues

File profile.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import './profile.html';

import loadImage from "blueimp-load-image";
import SimpleSchema from 'simpl-schema';
import Swal from 'sweetalert2';
Severity: Minor
Found in imports/profile/client/profile.js - About 2 hrs to fix

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

    const selectizeEmail = (method, params) => {
      return {
        persist: false,
        maxItems: null,
        valueField: 'email',
    Severity: Minor
    Found in imports/autoform/index.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 click .message-header has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      "click .message-header"(e, t) {
        e.preventDefault();
        let m = $(e.target).closest(".message");
        // shift + click 折叠/展开全部
        if (e.shiftKey) {
    Severity: Minor
    Found in imports/inbox/client/message/index.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 pushToUser has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    const pushToUser = (to, message) => {
      return new Promise(function(resolve, reject) {
        try {
          let thread = message.thread();
          let from   = message.user();
    Severity: Minor
    Found in imports/cordova/server/index.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 filetype has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    const filetype = (type) => {
      let _t = "file";
      if (type.match(/image/)) {
        _t = "image";
      } else if (type.match(/pdf/)) {
    Severity: Minor
    Found in imports/files/client/helper.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 editMember has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      editMember(id, email, name, password, title) {
        check(id, String);
        check(name, String);
        check(email, String);
        check(password, Match.Maybe(String));
    Severity: Minor
    Found in imports/admin/server/roster-methods.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 send has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    Mailgun.send = (message) => {
      Messages.update(message._id, {$set: {"email.state": 'sending'}});
    
      let threadId = message.threadId;
      let thread = Threads.findOne(threadId);
    Severity: Minor
    Found in imports/mailgun/server/outgoing/mailgun.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 stream has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      stream(collection, http, fileRef, version) {
        let path;
        if (fileRef && fileRef.versions && fileRef.versions[version] && fileRef.versions[version].meta && fileRef.versions[version].meta.pipePath) {
          path = fileRef.versions[version].meta.pipePath;
        }
    Severity: Minor
    Found in imports/files/server/storage/s3.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      run({ threadId }) {
        if (!this.userId) {
          throw new Meteor.Error('Threads.methods.archive.notLoggedIn', 'Must be logged in.');
        }
    
    
    Severity: Minor
    Found in imports/model/methods.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 editContact has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      editContact(id, params) {
        check(id, String);
        check(params, {
          name: Match.Maybe(String),
          email: Match.Maybe(String),
    Severity: Minor
    Found in imports/admin/server/roster-methods.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 editMember has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      editMember(id, email, name, password, title) {
    Severity: Minor
    Found in imports/admin/server/roster-methods.js - About 35 mins to fix

      Function queryByHours has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      MessageStatRecords.queryByHours = async (days) => {
        let d = moment();
        result = {
          internal: [],
          outgoing: [],
      Severity: Minor
      Found in imports/admin/server/message-records.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 queryByDays has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      MessageStatRecords.queryByDays = async (days) => {
        let d = moment();
        result = {
          internal: [],
          outgoing: [],
      Severity: Minor
      Found in imports/admin/server/message-records.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        run({ messageId }) {
          if (!this.userId) {
            throw new Meteor.Error('Messages.methods.pin.notLoggedIn', 'Must be logged in.');
          }
      
      
      Severity: Minor
      Found in imports/model/methods.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 ensureMember has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      Threads.ensureMember = (thread, user, params) => {
        let threadId = thread._id;
        let userType = user.className();
        let userId   = user._id;
      
      
      Severity: Minor
      Found in imports/model/server/functions.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 editChannel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        editChannel(id, email, name) {
          check(id, String);
          check(name, String);
          check(email, String);
      
      
      Severity: Minor
      Found in imports/channel/server/methods.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

      Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        run({ messageId }) {
          if (!this.userId) {
            throw new Meteor.Error('Messages.methods.like.notLoggedIn', 'Must be logged in.');
          }
      
      
      Severity: Minor
      Found in imports/shared/shared.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

      Function click .btn-next has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        "click .btn-next"(e, t) {
          e.preventDefault();
      
          let curStep = $(e.target).closest(".setup-content");
          let curStepBtn = curStep.attr("id");
      Severity: Minor
      Found in imports/website/client/setup.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

      Function onSubmit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          onSubmit(insertDoc, updateDoc, currentDoc) {
            this.event.preventDefault();
      
            Meteor.call('updateProfile', insertDoc, (err, res) => {
              if (err) {
      Severity: Minor
      Found in imports/profile/client/profile.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

      Severity
      Category
      Status
      Source
      Language