RadarParlamentar-MES2017-1/radar

View on GitHub

Showing 117 of 377 total issues

Function _energia has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _energia(self, dados_fixos, dados_meus, por_partido,
                 graus=0, espelho=0):
        """Calcula energia envolvida no movimento entre dois instantes
        (fixo e meu), onde o meu é rodado (entre 0 e 360 graus),
        e primeiro eixo multiplicado por -1 se espelho=1.
Severity: Minor
Found in radar_parlamentar/analises/analise.py - 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 diagonal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

d3.svg.diagonal = function() {
  var source = d3_svg_chordSource,
      target = d3_svg_chordTarget,
      projection = d3_svg_diagonalProjection;

Severity: Minor
Found in radar_parlamentar/static/files/codes/js/d3.js - About 1 hr to fix

    Function d3_svg_brushMove has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function d3_svg_brushMove() {
      if (d3_svg_brushOffset) {
        var mouse = d3.svg.mouse(d3_svg_brushTarget),
            g = d3.select(d3_svg_brushTarget);
    
    
    Severity: Minor
    Found in radar_parlamentar/static/files/codes/js/d3.js - About 1 hr to fix

      Function d3_behavior_zoomTo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function d3_behavior_zoomTo(z, x0, x1) {
        z = d3_behavior_zoomExtentClamp(z, 2);
        var j = Math.pow(2, d3_behavior_zoomXyz[2]),
            k = Math.pow(2, z),
            K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]),
      Severity: Minor
      Found in radar_parlamentar/static/files/codes/js/d3.js - About 1 hr to fix

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

            def _preenche_matrizes(self, votacao, iv):
                ip = -1  # indice parlamentares
                for parlamentar in self.parlamentares:
                    ip += 1
                    self.partido_do_parlamentar.append(parlamentar.partido.nome)
        Severity: Minor
        Found in radar_parlamentar/analises/analise.py - 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 _dict_parlamentar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _dict_parlamentar(self, parlamentar):
                leg_id = parlamentar.id
                nome = parlamentar.nome
                localidade = parlamentar.localidade
                dict_parlamentar = {"nome": nome,
        Severity: Minor
        Found in radar_parlamentar/analises/grafico.py - 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

        Avoid deeply nested control flow statements.
        Open

                        if partido == "S":
                            partido = "SEM PARTIDO"
        
        

          Avoid deeply nested control flow statements.
          Open

                          if not legis_partidos:
                              legis_partidos = {}
                              historia[legislatura] = legis_partidos
                          nums = legis_partidos.get(partido, {})

            Avoid deeply nested control flow statements.
            Open

                            if partido not in lista_partidos:
                                lista_partidos.append(partido)
            
            
            Severity: Major
            Found in radar_parlamentar/importadores/camara_genero/genero_historia_partidos.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if ano.find("e") == -1:
                                  anos2.append(ano)
                              else:
                                  ano1, e, ano2 = ano.partition("e")
                                  anos2.append(ano1.strip())

                Avoid deeply nested control flow statements.
                Open

                                if not legis_partidos:
                                    legis_partidos = {}
                                    historia[partido] = legis_partidos
                                nums = legis_partidos.get(legislatura, {})
                Severity: Major
                Found in radar_parlamentar/importadores/camara_genero/genero_historia_partidos.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            for (j = i + 1; j < n; ++j) q[j].i--;
                  Severity: Major
                  Found in radar_parlamentar/static/files/codes/js/d3.js - About 45 mins to fix

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

                        def __str__(self):
                            data_string = ''
                    #       data_string = str(self.ini.year) # sempre começa com o ano
                            delta = self.fim - self.ini
                            if delta.days < 35:  # período é de um mês
                    Severity: Minor
                    Found in radar_parlamentar/modelagem/models.py - 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

                    Avoid deeply nested control flow statements.
                    Open

                                    if partido not in lista_partidos:
                                        lista_partidos.append(partido)
                    
                    

                      Avoid deeply nested control flow statements.
                      Open

                                    for (var i = 0; i <= w; i++) {
                                      board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);
                                    }
                      Severity: Major
                      Found in radar_parlamentar/static/files/codes/js/d3.layout.cloud.js - About 45 mins to fix

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

                            def get_chefe_periodo(ano_inicio, ano_fim, chefes_executivo):
                                chefes = []
                                for chefe in chefes_executivo:
                                    ano_inicio_valido = (ano_inicio >= chefe.mandato_ano_inicio) and (
                                        ano_inicio <= chefe.mandato_ano_fim)
                        Severity: Minor
                        Found in radar_parlamentar/modelagem/models.py - 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

                        Avoid deeply nested control flow statements.
                        Open

                                  for (j = i + 1; j < n; ++j) q[j].i -= 2;
                        Severity: Major
                        Found in radar_parlamentar/static/files/codes/js/d3.js - About 45 mins to fix

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

                              def _inicio_primeiro_periodo(self):
                                  # TODO extrair e fazer teste de unidade só pra esse método
                                  # dia
                                  dia_inicial = 1
                                  # mês
                          Severity: Minor
                          Found in radar_parlamentar/modelagem/utils.py - 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

                          Avoid deeply nested control flow statements.
                          Open

                                    for (j = i + 1; j < n; ++j) q[j].i--;
                          Severity: Major
                          Found in radar_parlamentar/static/files/codes/js/d3.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if not len(partido):
                                                partido = "SEM PARTIDO"
                                            if partido == "S":
                              Severity
                              Category
                              Status
                              Source
                              Language