kelsin/kapit

View on GitHub

Showing 18 of 18 total issues

File kapit.js has 401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

var _ = require('lodash');
var blessed = require('blessed');

Severity: Minor
Found in lib/kapit.js - About 5 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    var updateRequest = function() {
      var step = data.getCurrentStep();
      if (step) {
        step.render.request = render.request(step);
        request.setContent(step.render.request);
    Severity: Major
    Found in lib/kapit.js and 1 other location - About 2 hrs to fix
    lib/kapit.js on lines 131..139

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 94.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    var updateResponse = function() {
      var step = data.getCurrentStep();
      if (step) {
        step.render.response = render.response(step);
        response.setContent(step.render.response);
    Severity: Major
    Found in lib/kapit.js and 1 other location - About 2 hrs to fix
    lib/kapit.js on lines 118..126

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 94.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    screen.key('S-n', function() {
      var currentChain = data.getCurrentChain();
    
      if (currentChain) {
        data.newStep();
    Severity: Major
    Found in lib/kapit.js and 1 other location - About 2 hrs to fix
    lib/kapit.js on lines 268..281

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 87.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    screen.key('r', function() {
      var step = data.getCurrentStep();
    
      if (step) {
        data.resetStep();
    Severity: Major
    Found in lib/kapit.js and 1 other location - About 2 hrs to fix
    lib/kapit.js on lines 234..247

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 87.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        try {
          outputStep.request.body = JSON.parse(step.request.body);
        }
        catch (e) {
          outputStep.request.body = _.cloneDeep(step.request.body);
    Severity: Major
    Found in lib/render.js and 1 other location - About 2 hrs to fix
    lib/render.js on lines 207..212

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 76.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        try {
          outputStep.request.data = JSON.parse(step.request.data);
        }
        catch (e) {
          outputStep.request.data = _.cloneDeep(step.request.data);
    Severity: Major
    Found in lib/render.js and 1 other location - About 2 hrs to fix
    lib/render.js on lines 200..205

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 76.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    exports.response = function(step) {
      var output = '';
    
      if(data.raw()) {
        var outputStep = _.cloneDeep(step);
    Severity: Minor
    Found in lib/render.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 request has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.request = function(step) {
      var output = '';
    
      if (step.type === 'HTTP' && !data.raw()) {
        output += '{green-fg}Name{/}: ' + step.name;
    Severity: Minor
    Found in lib/render.js - About 1 hr to fix

      Function help has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.help = function() {
        var output = '';
      
        output += '{yellow-fg}Focused Element{/}';
        output += '\n {green-fg}j{/} move down a line';
      Severity: Minor
      Found in lib/render.js - About 1 hr to fix

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

        exports.response = function(step) {
          var output = '';
        
          if(data.raw()) {
            var outputStep = _.cloneDeep(step);
        Severity: Minor
        Found in lib/render.js - About 1 hr to fix

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

          exports.modal = function(text, options) {
            return blessed.box(_.merge({
              padding: {
                left: 1,
                right: 1
          Severity: Minor
          Found in lib/widgets.js - About 1 hr to fix

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

            exports.request = function(step) {
              var output = '';
            
              if (step.type === 'HTTP' && !data.raw()) {
                output += '{green-fg}Name{/}: ' + step.name;
            Severity: Minor
            Found in lib/render.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 input has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.input = function(text, options) {
              return blessed.Textbox(_.merge({
                padding: {
                  left: 1,
                  right: 1
            Severity: Minor
            Found in lib/widgets.js - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              screen.key('S-c', function() {
                data.newChain();
                updateRequest();
                updateResponse();
                updateChain();
              Severity: Major
              Found in lib/kapit.js and 1 other location - About 1 hr to fix
              lib/kapit.js on lines 283..289

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 55.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              screen.key('S-r', function() {
                data.resetAllSteps();
                updateRequest();
                updateResponse();
                updateChain();
              Severity: Major
              Found in lib/kapit.js and 1 other location - About 1 hr to fix
              lib/kapit.js on lines 249..255

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 55.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function chain has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.chain = function() {
                return _(data.getCurrentSteps()).map(function(step, index) {
                  var color = '';
              
                  if(index === data.getCurrentChain().current) {
              Severity: Minor
              Found in lib/render.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 http has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.http = function(request, label) {
                var output = '';
              
                if (request) {
                  output += '\n';
              Severity: Minor
              Found in lib/render.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

              Severity
              Category
              Status
              Source
              Language