zackehh/oryx

View on GitHub
lib/oryx.js

Summary

Maintainability
D
1 day
Test Coverage

Function routes has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Oryx.prototype.routes = function routes(opts, cb) {
  // ensure we parse function args correctly, in
  // case there are no options defined
  if (!cb && typeof opts === 'function') {
    cb = opts;
Severity: Major
Found in lib/oryx.js - About 5 hrs to fix

    File oryx.js has 282 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // core modules
    var fs = require('fs');
    var path = require('path');
    
    // npm modules
    Severity: Minor
    Found in lib/oryx.js - About 2 hrs to fix

      Function models has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Oryx.prototype.models = function models(opts, cb) {
        // ensure we parse function args correctly, in
        // case there are no options defined
        if (!cb && typeof opts === 'function') {
          cb = opts;
      Severity: Major
      Found in lib/oryx.js - About 2 hrs to fix

        Function Oryx has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function Oryx(app, opts) {
          // check for a valid application or agent
          if(!app || !app.listen) {
            throw new OryxError('Invalid app passed to Oryx!');
          }
        Severity: Minor
        Found in lib/oryx.js - About 1 hr to fix

          Function routes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          Oryx.prototype.routes = function routes(opts, cb) {
            // ensure we parse function args correctly, in
            // case there are no options defined
            if (!cb && typeof opts === 'function') {
              cb = opts;
          Severity: Minor
          Found in lib/oryx.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 models has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          Oryx.prototype.models = function models(opts, cb) {
            // ensure we parse function args correctly, in
            // case there are no options defined
            if (!cb && typeof opts === 'function') {
              cb = opts;
          Severity: Minor
          Found in lib/oryx.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

          There are no issues that match your filters.

          Category
          Status