inderpartap/Bunk-O-Meter

View on GitHub
captcha.js

Summary

Maintainability
D
3 days
Test Coverage

File captcha.js has 707 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var keys = {
    "0": [
        ["0", "0", "0", "1", "1", "1", "1", "0", "0", "0"],
        ["0", "1", "1", "1", "1", "1", "1", "1", "1", "0"],
        ["0", "1", "1", "1", "0", "0", "0", "1", "1", "0"],
Severity: Major
Found in captcha.js - About 1 day to fix

    Function getCaptcha has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    var getCaptcha = function(img) {
    
        temp = 0;
        var x, y;
        for (x = 0; x < 25; ++x) {
    Severity: Minor
    Found in captcha.js - About 4 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 matchImg has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function matchImg(rx, ry, pix, mask) {
        flag = 1;
        breakflag = 0;
        x = 0;
        y = 0;
    Severity: Minor
    Found in captcha.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 getCaptcha has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var getCaptcha = function(img) {
    
        temp = 0;
        var x, y;
        for (x = 0; x < 25; ++x) {
    Severity: Minor
    Found in captcha.js - About 1 hr to fix

      Function matchImg has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function matchImg(rx, ry, pix, mask) {
          flag = 1;
          breakflag = 0;
          x = 0;
          y = 0;
      Severity: Minor
      Found in captcha.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                            if (matchImg(x, y, img, mask)) {
                                skipstart.push(y);
                                skipend.push(y + mask[0].length);
                                sorter.push(y);
                                captcha.push(order[l]);
        Severity: Major
        Found in captcha.js - About 45 mins to fix

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

          function sort(sorter, captcha) {
              for (var i = 0; i < sorter.length; ++i) {
                  less = sorter[i];
                  swap = 0;
                  ls = i;
          Severity: Minor
          Found in captcha.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 getPixelMapFromImageData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          var getPixelMapFromImageData = function(imgData) {
              var pixMap=[];
              var count=0;
              var temp=[];
              for (var i=0;i<imgData.data.length;i+=4)
          Severity: Minor
          Found in captcha.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