amenezes/headers

View on GitHub

Showing 143 of 143 total issues

Function init_echarts has 723 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function init_echarts() {

                if( typeof (echarts) === 'undefined'){ return; }
                  var theme = {
                  color: [
Severity: Major
Found in web/static/build/js/custom.js - About 3 days to fix

File custom.js has 1046 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Resize function without multiple trigger
 *
 * Usage:
 * $(window).smartresize(function(){
Severity: Major
Found in web/static/build/js/custom.js - About 2 days to fix

Function success has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        success: function(response){

      var header = document.getElementById('csp_total');
      while (header.firstChild) {
        header.removeChild(header.firstChild);
Severity: Major
Found in web/static/build/js/custom.js - About 4 hrs to fix

Function init_DataTables has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function init_DataTables(response) {

                //console.log('run_datatables');

                if( typeof ($.fn.DataTable) === 'undefined'){ return; }
Severity: Major
Found in web/static/build/js/custom.js - About 3 hrs to fix

Function init_echarts has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

        function init_echarts() {

                if( typeof (echarts) === 'undefined'){ return; }
                  var theme = {
                  color: [
Severity: Minor
Found in web/static/build/js/custom.js - About 3 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

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

                toolbox: {
                  show: true,
                  feature: {
                    magicType: {
                      show: true,
Severity: Major
Found in web/static/build/js/custom.js and 1 other location - About 3 hrs to fix
web/static/build/js/custom.js on lines 1002..1026

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

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

        toolbox: {
          show: true,
          feature: {
          magicType: {
            show: true,
Severity: Major
Found in web/static/build/js/custom.js and 1 other location - About 3 hrs to fix
web/static/build/js/custom.js on lines 911..935

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

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 success has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          success: function(response){

        var header = document.getElementById('sts_total');
        while (header.firstChild) {
          header.removeChild(header.firstChild);
Severity: Major
Found in web/static/build/js/custom.js - About 3 hrs to fix

Function success has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          success: function(response){

        var header = document.getElementById('xcto_total');
        while (header.firstChild) {
          header.removeChild(header.firstChild);
Severity: Major
Found in web/static/build/js/custom.js - About 3 hrs to fix

Function success has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          success: function(response){

        var header = document.getElementById('xss_total');
        while (header.firstChild) {
          header.removeChild(header.firstChild);
Severity: Major
Found in web/static/build/js/custom.js - About 2 hrs to fix

Function init_sidebar has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function init_sidebar() {
var setContentHeight = function () {
    // reset height
    $RIGHT_COL.css('min-height', $(window).height());

Severity: Major
Found in web/static/build/js/custom.js - About 2 hrs to fix

Function success has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          success: function(response){

        var header = document.getElementById('xfo_total');
        while (header.firstChild) {
          header.removeChild(header.firstChild);
Severity: Major
Found in web/static/build/js/custom.js - About 2 hrs to fix

Function success has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            success: function(response){

          var header = document.getElementById('pkp_total');
          while (header.firstChild) {
            header.removeChild(header.firstChild);
Severity: Minor
Found in web/static/build/js/custom.js - About 1 hr to fix

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

$('.bulk_action input').on('ifChecked', function () {
    checkState = '';
    $(this).parent().parent().parent().addClass('selected');
    countChecked();
});
Severity: Major
Found in web/static/build/js/custom.js and 2 other locations - About 1 hr to fix
web/static/build/js/custom.js on lines 204..208
web/static/build/js/custom.js on lines 217..221

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

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 3 locations. Consider refactoring.
Open

$('.bulk_action input').on('ifUnchecked', function () {
    checkState = '';
    $(this).parent().parent().parent().removeClass('selected');
    countChecked();
});
Severity: Major
Found in web/static/build/js/custom.js and 2 other locations - About 1 hr to fix
web/static/build/js/custom.js on lines 204..208
web/static/build/js/custom.js on lines 212..216

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

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 3 locations. Consider refactoring.
Open

$('table input').on('ifUnchecked', function () {
    checkState = '';
    $(this).parent().parent().parent().removeClass('selected');
    countChecked();
});
Severity: Major
Found in web/static/build/js/custom.js and 2 other locations - About 1 hr to fix
web/static/build/js/custom.js on lines 212..216
web/static/build/js/custom.js on lines 217..221

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

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 handleDataTableButtons has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                var handleDataTableButtons = function() {
                  if ($("#datatable-buttons").length) {
                    $("#datatable-buttons").DataTable({
                      dom: "Bfrtip",
                      buttons: [
Severity: Minor
Found in web/static/build/js/custom.js - About 1 hr to fix

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

        if ($BODY.hasClass('nav-md')) {
            $SIDEBAR_MENU.find('li.active ul').hide();
            $SIDEBAR_MENU.find('li.active').addClass('active-sm').removeClass('active');
        } else {
Severity: Minor
Found in web/static/build/js/custom.js and 1 other location - About 40 mins to fix
web/static/build/js/custom.js on lines 104..107

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

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

        } else {
            $SIDEBAR_MENU.find('li.active-sm ul').show();
            $SIDEBAR_MENU.find('li.active-sm').addClass('active').removeClass('active-sm');
        }
Severity: Minor
Found in web/static/build/js/custom.js and 1 other location - About 40 mins to fix
web/static/build/js/custom.js on lines 101..104

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

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 siteinfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def siteinfo(site=''):
    '''Secure headers used by a specific <url>'''
    values = ()
    percent_list = []
    if site != '':
Severity: Minor
Found in web/webui.py - 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