RadarParlamentar-MES2017-1/radar

View on GitHub
radar_parlamentar/importadores/camara_genero/genero_comparativo_partidos.py

Summary

Maintainability
D
2 days
Test Coverage

Avoid deeply nested control flow statements.
Open

                if not nums:
                    nums = {"M": 0, "F": 0}
                    legis_partidos[partido] = nums
                nums[genero] = nums.get(genero, 0) + 1

    Avoid deeply nested control flow statements.
    Open

                    if not len(partido):
                        partido = "SEM PARTIDO"
                    if partido == "S":

      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 partido not in lista_partidos:
                            lista_partidos.append(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 == "S":
                                partido = "SEM PARTIDO"
            
            

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

                          for leg in legis:
                              termos = leg.split(",")
                              data = termos[1].strip()
                              try:
                                  partido = termos[-1].strip().partition(".")[0]
              radar_parlamentar/importadores/camara_genero/genero_historia_partidos.py on lines 49..64

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

              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

                          for ano in anos:
                              if ano.find("e") == -1:
                                  anos2.append(ano)
                              else:
                                  ano1, e, ano2 = ano.partition("e")
              radar_parlamentar/importadores/camara_genero/genero_historia_partidos.py on lines 39..45
              radar_parlamentar/importadores/camara_genero/num_genero_legis.py on lines 37..43

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

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

                          if legis.find("Deputada") != -1:
                              genero = "F"
                              cont += 1
                          else:
                              genero = "M"
              radar_parlamentar/importadores/camara_genero/genero_historia_partidos.py on lines 27..31
              radar_parlamentar/importadores/camara_genero/nomes_deputadas_csv.py on lines 19..23
              radar_parlamentar/importadores/camara_genero/num_genero_legis.py on lines 25..29

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

              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

              Do not use bare 'except'
              Open

                              except:

              When catching exceptions, mention specific exceptions when possible.

              Okay: except Exception:
              Okay: except BaseException:
              E722: except:

              There are no issues that match your filters.

              Category
              Status