VevoxDigital/Skribki

View on GitHub

Showing 13 of 13 total issues

File page.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict'

const lockfile = require('lockfile')
const fs = require('fs-extra')
const readline = require('readline')
Severity: Minor
Found in models/page.js - About 3 hrs to fix

    Function install has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.install = () => {
      /**
        * @function normalize
        * Normalizes the given url to a standardized format.
        *
    Severity: Minor
    Found in modules/utils.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

    Function install has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.install = opts => {
      frameworkEngine = global.Controller.prototype.view
      /* eslint complexity: 0 */
      global.Controller.prototype.view = function (name, model = { }, headers, isPartial) {
        // shift arguments if needed
    Severity: Minor
    Found in modules/pug.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 install has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.install = () => {
      /**
        * @function normalize
        * Normalizes the given url to a standardized format.
        *
    Severity: Minor
    Found in modules/utils.js - About 1 hr to fix

      Function install has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.install = opts => {
        frameworkEngine = global.Controller.prototype.view
        /* eslint complexity: 0 */
        global.Controller.prototype.view = function (name, model = { }, headers, isPartial) {
          // shift arguments if needed
      Severity: Minor
      Found in modules/pug.js - About 1 hr to fix

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

          global.Controller.prototype.view = function (name, model = { }, headers, isPartial) {
            // shift arguments if needed
            if (isPartial === undefined && typeof headers === 'boolean') {
              isPartial = headers
              headers = null
        Severity: Minor
        Found in modules/pug.js - About 1 hr to fix

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

          exports.buildIndex = () => {
            const cached = F.cache.get(INDEX_KEY)
            if (!F.isDebug && cached) return q(cached)
          
            const deferred = q.defer()
          Severity: Minor
          Found in models/page.js - About 1 hr to fix

            Function install has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.install = () => {
              let deferred = q.defer()
            
              F.path.wiki = (p = '') => { return F.path.root(path.join(F.isTest ? 'wiki.test' : 'wiki', p)) }
              try {
            Severity: Minor
            Found in models/page.js - About 1 hr to fix

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

              exports.parseDocument = doc => {
                if (typeof doc === 'string') {
                  let bodyMatch = /(?:^|\n)[^$]/.exec(doc)
                  if (!bodyMatch) return q('')
                  let body = doc.substring(bodyMatch.index)
              Severity: Minor
              Found in models/page.js - About 1 hr to fix

                Avoid too many return statements within this function.
                Open

                      else return 'white'
                Severity: Major
                Found in definitions/routing.js - About 30 mins to fix

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

                  exports.install = () => {
                    let deferred = q.defer()
                  
                    F.path.wiki = (p = '') => { return F.path.root(path.join(F.isTest ? 'wiki.test' : 'wiki', p)) }
                    try {
                  Severity: Minor
                  Found in models/page.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 compileTarget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function compileTarget (req, res, isValidation) {
                    if (isValidation) return req.url.endsWith('.scss') || req.url.endsWith('.sass')
                    else if (!compileTarget(req, res, true)) return false
                  
                    // try to load from cache if present.
                  Severity: Minor
                  Found in modules/styles.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 parseDocument has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.parseDocument = doc => {
                    if (typeof doc === 'string') {
                      let bodyMatch = /(?:^|\n)[^$]/.exec(doc)
                      if (!bodyMatch) return q('')
                      let body = doc.substring(bodyMatch.index)
                  Severity: Minor
                  Found in models/page.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