martinmicunda/employee-scheduling-api

View on GitHub

Showing 17 of 87 total issues

Function html has 1303 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function html(model, token) {
    return `
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Severity: Major
Found in lib/api/emails/lib/templates/activation.js - About 6 days to fix

    Function html has 1285 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function html(model, token) {
        return `
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    Severity: Major
    Found in lib/api/emails/lib/templates/passwod-reset.js - About 6 days to fix

      Function html has 1237 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function html(model) {
          return `
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      Severity: Major
      Found in lib/api/emails/lib/templates/message.js - About 6 days to fix

        File activation.js has 1319 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * @author    Martin Micunda {@link http://martinmicunda.com}
         * @copyright Copyright (c) 2015, Martin Micunda
         * @license   GPL-3.0
         */
        Severity: Major
        Found in lib/api/emails/lib/templates/activation.js - About 3 days to fix

          File passwod-reset.js has 1304 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * @author    Martin Micunda {@link http://martinmicunda.com}
           * @copyright Copyright (c) 2015, Martin Micunda
           * @license   GPL-3.0
           */
          Severity: Major
          Found in lib/api/emails/lib/templates/passwod-reset.js - About 3 days to fix

            File message.js has 1254 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * @author    Martin Micunda {@link http://martinmicunda.com}
             * @copyright Copyright (c) 2015, Martin Micunda
             * @license   GPL-3.0
             */
            Severity: Major
            Found in lib/api/emails/lib/templates/message.js - About 3 days to fix

              Function initErrorHandler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  initErrorHandler() {
                      this.app.use(function *error(next){
                          try {
                              // pass on the execution to downstream middlewares
                              yield next;
              Severity: Minor
              Found in lib/config/koa.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 update has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              async function update(id, doc) {
                  let cas = doc.cas;
                  // do not store CAS(version) and document ID as Couchbase already keep these values in metadata for each document
                  doc = db.removeMetadataFromDoc(doc);
                  doc.type = DOC_TYPE; // map-reduces
              Severity: Minor
              Found in lib/api/employees/lib/dao.js - About 1 hr to fix

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

                async function update(id, doc) {
                    let cas = doc.cas;
                    // do not store CAS(version) and document ID as Couchbase already keep these values in metadata for each document
                    doc = db.removeMetadataFromDoc(doc);
                    doc.type = DOC_TYPE; // map-reduces
                Severity: Minor
                Found in lib/api/partners/lib/dao.js - About 1 hr to fix

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

                  async function update(id, doc) {
                      let cas = doc.cas;
                      // do not store CAS(version) and document ID as Couchbase already keep these values in metadata for each document
                      doc = db.removeMetadataFromDoc(doc);
                      doc.type = DOC_TYPE; // map-reduces
                  Severity: Minor
                  Found in lib/api/positions/lib/dao.js - About 1 hr to fix

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

                    async function update(id, doc) {
                        let cas = doc.cas;
                        // do not store CAS(version) and document ID as Couchbase already keep these values in metadata for each document
                        doc = db.removeMetadataFromDoc(doc);
                        doc.type = DOC_TYPE; // map-reduces
                    Severity: Minor
                    Found in lib/api/locations/lib/dao.js - About 1 hr to fix

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

                      async function instanceExists() {
                          logger.info(`    COUCHBASE INSTANCE: ${config.couchbase.host}:${config.couchbase.port}`);
                          let data;
                      
                          try {
                      Severity: Minor
                      Found in lib/config/setup.js - About 1 hr to fix

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

                        async function update(id, doc) {
                            let cas = doc.cas;
                            // do not store CAS(version) and document ID as Couchbase already keep these values in metadata for each document
                            doc = db.removeMetadataFromDoc(doc);
                            doc.type = DOC_TYPE; // map-reduces
                        Severity: Minor
                        Found in lib/api/employees/lib/dao.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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        async function update(id, doc) {
                            let cas = doc.cas;
                            // do not store CAS(version) and document ID as Couchbase already keep these values in metadata for each document
                            doc = db.removeMetadataFromDoc(doc);
                            doc.type = DOC_TYPE; // map-reduces
                        Severity: Minor
                        Found in lib/api/locations/lib/dao.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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        async function update(id, doc) {
                            let cas = doc.cas;
                            // do not store CAS(version) and document ID as Couchbase already keep these values in metadata for each document
                            doc = db.removeMetadataFromDoc(doc);
                            doc.type = DOC_TYPE; // map-reduces
                        Severity: Minor
                        Found in lib/api/positions/lib/dao.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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        async function update(id, doc) {
                            let cas = doc.cas;
                            // do not store CAS(version) and document ID as Couchbase already keep these values in metadata for each document
                            doc = db.removeMetadataFromDoc(doc);
                            doc.type = DOC_TYPE; // map-reduces
                        Severity: Minor
                        Found in lib/api/partners/lib/dao.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 authenticate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        async function authenticate(email, password) {
                            try {
                                const employee = await employeeDAO.findByEmail(email);
                        
                                if(employee.status !== 'active' || employee.password !== hashPassword(employee.salt, password)) {
                        Severity: Minor
                        Found in lib/api/auth/lib/service.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