wikilab/wikilab-api

View on GitHub

Showing 14 of 18 total issues

Function exports has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(DataTypes) {
  return [{
    UUID: {
      type: DataTypes.UUID,
      allowNull: false,
Severity: Major
Found in api/models/docs.js - About 5 hrs to fix

    Function exports has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function(DataTypes) {
      return [{
        UUID: {
          type: DataTypes.UUID,
          allowNull: false,
    Severity: Minor
    Found in api/models/docs.js - About 3 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

    Function exports has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(DataTypes) {
      return [{
        email:    {
          type: DataTypes.STRING,
          allowNull: false,
    Severity: Major
    Found in api/models/users.js - About 3 hrs to fix

      Function exports has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(DataTypes) {
        return [{
          name: {
            type: DataTypes.STRING,
            allowNull: false
      Severity: Major
      Found in api/models/collections.js - About 3 hrs to fix

        Function exports has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(DataTypes) {
          return [{
            token: {
              type: DataTypes.UUID,
              allowNull: false,
        Severity: Minor
        Found in api/models/sessions.js - About 1 hr to fix

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

          module.exports = function(DataTypes) {
            return [{
              key:    {
                type: DataTypes.STRING,
                allowNull: false,
          Severity: Minor
          Found in api/models/settings.js - About 1 hr to fix

            Function exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function(DataTypes) {
              return [{
                name: {
                  type: DataTypes.STRING,
                  allowNull: false
            Severity: Minor
            Found in api/models/collections.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 setOrder has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  setOrder: function *(order) {
                    var t = yield sequelize.transaction();
                    try {
                      var docs = yield Doc.findAll({
                        where: { parentUUID: this.parentUUID },
            Severity: Minor
            Found in api/models/docs.js - About 1 hr to fix

              Function setOrder has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    setOrder: function *(order) {
                      var t = yield sequelize.transaction();
                      try {
                        var collections = yield Collection.findAll({
                          where: { ProjectId: this.ProjectId },
              Severity: Minor
              Found in api/models/collections.js - About 1 hr to fix

                Function createWithTransaction has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      createWithTransaction: function *(doc) {
                        if (!doc.CollectionId) {
                          throw new Error('CollectionId is not specified');
                        }
                        var t = yield sequelize.transaction();
                Severity: Minor
                Found in api/models/docs.js - About 1 hr to fix

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

                  module.exports = function(DataTypes) {
                    return [{
                      type: {
                        type: DataTypes.ENUM(
                          // Collection
                  Severity: Minor
                  Found in api/models/news.js - About 1 hr to fix

                    Function exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function(DataTypes) {
                      return [{
                        email:    {
                          type: DataTypes.STRING,
                          allowNull: false,
                    Severity: Minor
                    Found in api/models/users.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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function(DataTypes) {
                      return [{
                        token: {
                          type: DataTypes.UUID,
                          allowNull: false,
                    Severity: Minor
                    Found in api/models/sessions.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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function(DataTypes) {
                      return [{
                        key:    {
                          type: DataTypes.STRING,
                          allowNull: false,
                    Severity: Minor
                    Found in api/models/settings.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