rahulkapoor90/VITacademics-Enhancement-Suite

View on GitHub
Extension for chrome/scripts/captcha/captcha.js

Summary

Maintainability
F
1 mo
Test Coverage

File captcha.js has 703 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 Extension for chrome/scripts/captcha/captcha.js - About 1 day to fix

Function getCaptcha has a Cognitive Complexity of 28 (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 Extension for chrome/scripts/captcha/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 Extension for chrome/scripts/captcha/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 42 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 Extension for chrome/scripts/captcha/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 Extension for chrome/scripts/captcha/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 Extension for chrome/scripts/captcha/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 Extension for chrome/scripts/captcha/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 Extension for chrome/scripts/captcha/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

Identical blocks of code found in 3 locations. 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 Extension for chrome/scripts/captcha/captcha.js and 2 other locations - About 1 mo to fix
Extension for Edge/scripts/captcha/captcha.js on lines 1..542
Extension for Firefox/scripts/captcha/captcha.js on lines 1..542

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 6295.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

var getCaptcha = function(img) {

    temp = 0;
    var x, y;
    for (x = 0; x < 25; ++x) {
Severity: Major
Found in Extension for chrome/scripts/captcha/captcha.js and 2 other locations - About 2 days to fix
Extension for Edge/scripts/captcha/captcha.js on lines 635..680
Extension for Firefox/scripts/captcha/captcha.js on lines 635..680

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 471.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

function matchImg(rx, ry, pix, mask) {
    flag = 1;
    breakflag = 0;
    x = 0;
    y = 0;
Severity: Major
Found in Extension for chrome/scripts/captcha/captcha.js and 2 other locations - About 1 day to fix
Extension for Edge/scripts/captcha/captcha.js on lines 545..577
Extension for Firefox/scripts/captcha/captcha.js on lines 545..577

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 235.

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

Identical blocks of code found in 3 locations. 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: Major
Found in Extension for chrome/scripts/captcha/captcha.js and 2 other locations - About 1 day to fix
Extension for Edge/scripts/captcha/captcha.js on lines 614..632
Extension for Firefox/scripts/captcha/captcha.js on lines 614..632

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 214.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

function sort(sorter, captcha) {
    for (var i = 0; i < sorter.length; ++i) {
        less = sorter[i];
        swap = 0;
        ls = i;
Severity: Major
Found in Extension for chrome/scripts/captcha/captcha.js and 2 other locations - About 1 day to fix
Extension for Edge/scripts/captcha/captcha.js on lines 590..611
Extension for Firefox/scripts/captcha/captcha.js on lines 590..611

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 210.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

function loaded() {

    var canvas = document.createElement('canvas');
    var context = canvas.getContext('2d');
    var img = document.getElementById('imgCaptcha');
Severity: Major
Found in Extension for chrome/scripts/captcha/captcha.js and 2 other locations - About 1 day to fix
Extension for Edge/scripts/captcha/captcha.js on lines 691..716
Extension for Firefox/scripts/captcha/captcha.js on lines 691..716

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 208.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

function skip(start, end, y) {
    flag = 0;
    for (var i = 0; i < start.length; ++i) {
        if (y >= start[i] && y <= end[i]) {
            flag = 1;
Severity: Major
Found in Extension for chrome/scripts/captcha/captcha.js and 2 other locations - About 2 hrs to fix
Extension for Edge/scripts/captcha/captcha.js on lines 579..588
Extension for Firefox/scripts/captcha/captcha.js on lines 579..588

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 83.

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

There are no issues that match your filters.

Category
Status