pasosdeJesus/sivel2_gen

View on GitHub
app/javascript/controllers/motor.js

Summary

Maintainability
F
4 days
Test Coverage

File motor.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Sivel2Gen__AutocompletaAjaxColectivas from "./AutocompletaAjaxColectivas"
window.Sivel2Gen__AutocompletaAjaxColectivas = Sivel2Gen__AutocompletaAjaxColectivas 

import Sivel2Gen__AutocompletaAjaxFamiliares from "./AutocompletaAjaxFamiliares"
window.Sivel2Gen__AutocompletaAjaxFamiliares = Sivel2Gen__AutocompletaAjaxFamiliares 
Severity: Minor
Found in app/javascript/controllers/motor.js - About 3 hrs to fix

    Function crearCopiaDeVictima has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static crearCopiaDeVictima(obj, fobj) {
        let div_victima = obj.parentElement.parentElement;
        let valores_input= []
        let valores_select= []
        div_victima.querySelectorAll('input').forEach(elem => {
    Severity: Major
    Found in app/javascript/controllers/motor.js - About 2 hrs to fix

      Function crearCopiaDeCombatiente has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static crearCopiaDeCombatiente(obj, fobj){
          let div_combatiente = obj.parentElement.parentElement;
          let valores_input= []
          let valores_select= []
          div_combatiente.querySelectorAll('input').forEach(elem => {
      Severity: Major
      Found in app/javascript/controllers/motor.js - About 2 hrs to fix

        Function ejecutarAlCargarPagina has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static ejecutarAlCargarPagina() {
            console.log("* Corriendo Sivel2Gen__Motor::ejecutarAlCargarPagina()")
          
            // Envia formulario al presionar botones con clase fichacambia 
            // con más de 5 segundos de diferencia entre un click y el siguiente
        Severity: Minor
        Found in app/javascript/controllers/motor.js - About 1 hr to fix

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

            static ejecutarAlCargarDocumentoYRecursos() {
              console.log("* Corriendo Sivel2Gen__Motor::ejecutarAlCargarDocumentoYRecursos()")
          
              if (typeof window.puntoMontaje == 'undefined') {
                window.puntoMontaje = '/'
          Severity: Minor
          Found in app/javascript/controllers/motor.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                            for (const opc of elem.options) {
                              if(opc.value == val){
                                opc.selected = true;
                              }
                            }
            Severity: Major
            Found in app/javascript/controllers/motor.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if(opc.value == val){
                                opc.selected = true;
                              }
              Severity: Major
              Found in app/javascript/controllers/motor.js - About 45 mins to fix

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

                        if(elem.multiple){
                          let opciones = elem.options
                          let valores_multi= []
                          for (const opc of opciones){
                            if(opc.selected){
                Severity: Major
                Found in app/javascript/controllers/motor.js and 1 other location - About 3 hrs to fix
                app/javascript/controllers/motor.js on lines 364..376

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

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

                      if (elem.multiple) {
                        let opciones = elem.options
                        let valores_multi= []
                        for (const opc of opciones) {
                          if(opc.selected) {
                Severity: Major
                Found in app/javascript/controllers/motor.js and 1 other location - About 3 hrs to fix
                app/javascript/controllers/motor.js on lines 295..307

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

                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

                            if(elem.multiple){
                              for(const val of valores_select[indice_tipo_select]){
                                for (const opc of elem.options) {
                                  if(opc.value == val){
                                    opc.selected = true;
                Severity: Major
                Found in app/javascript/controllers/motor.js and 1 other location - About 2 hrs to fix
                app/javascript/controllers/motor.js on lines 393..404

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

                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

                          if(elem.multiple){
                            for(const val of valores_select[i]){
                              for (const opc of elem.options) {
                                if(opc.value == val){
                                  opc.selected = true;
                Severity: Major
                Found in app/javascript/controllers/motor.js and 1 other location - About 2 hrs to fix
                app/javascript/controllers/motor.js on lines 333..344

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

                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

                        if (valor == 'Departamento') {
                          fil_cat.parentElement.style.display = "block"
                          fil_dep.parentElement.style.display = "none"
                          fil_sex.parentElement.style.display = "block"
                        }
                Severity: Major
                Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
                app/javascript/controllers/motor.js on lines 130..134
                app/javascript/controllers/motor.js on lines 135..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 68.

                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

                        if (valor == 'Categoria') {
                          fil_cat.parentElement.style.display = "none"
                          fil_dep.parentElement.style.display = "block"
                          fil_sex.parentElement.style.display = "block"
                        }
                Severity: Major
                Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
                app/javascript/controllers/motor.js on lines 125..129
                app/javascript/controllers/motor.js on lines 135..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 68.

                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

                        if (valor == 'Sexo') {
                          fil_cat.parentElement.style.display = "block"
                          fil_dep.parentElement.style.display = "block"
                          fil_sex.parentElement.style.display = "none"
                        }
                Severity: Major
                Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
                app/javascript/controllers/motor.js on lines 125..129
                app/javascript/controllers/motor.js on lines 130..134

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

                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

                          if(elem.type != "hidden" && elem.type != 'submit' &&
                            !elem.id.includes('personados') && !elem.classList.contains('chosen-search-input')){
                            elem.value = valores_input[indice_tipo_input]
                            elem.dispatchEvent(new Event('input'));
                            indice_tipo_input += 1;
                Severity: Major
                Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
                app/javascript/controllers/motor.js on lines 286..289
                app/javascript/controllers/motor.js on lines 292..308

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

                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

                      if(elem.type != "hidden" && elem.type != 'submit' && 
                        !elem.id.includes('personados') && !elem.classList.contains('chosen-search-input')){
                        valores_input.push(elem.value)
                      }
                Severity: Major
                Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
                app/javascript/controllers/motor.js on lines 292..308
                app/javascript/controllers/motor.js on lines 321..326

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

                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

                      if(elem.type != "hidden" && elem.type != 'submit' && 
                        !elem.id.includes('personados') && !elem.id.includes('persona_trelacion1')){
                        console.log([elem.value, elem.type, elem.id])
                        if(elem.multiple){
                          let opciones = elem.options
                Severity: Major
                Found in app/javascript/controllers/motor.js and 2 other locations - About 1 hr to fix
                app/javascript/controllers/motor.js on lines 286..289
                app/javascript/controllers/motor.js on lines 321..326

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

                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 {
                          div_fini.style.display = "none"
                          div_ffin.style.display = "none"
                          div_fdep.style.display = "none"
                        }
                Severity: Minor
                Found in app/javascript/controllers/motor.js and 1 other location - About 40 mins to fix
                app/javascript/controllers/motor.js on lines 77..81

                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

                        if (e.target.value.includes('22')) {
                          div_fini.style.display = "block"
                          div_ffin.style.display = "block"
                          div_fdep.style.display = "block"
                        } else {
                Severity: Minor
                Found in app/javascript/controllers/motor.js and 1 other location - About 40 mins to fix
                app/javascript/controllers/motor.js on lines 81..85

                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

                There are no issues that match your filters.

                Category
                Status