radar-parlamentar/radar

View on GitHub
radar_parlamentar/importadores/cdep.py

Summary

Maintainability
D
2 days
Test Coverage

File cdep.py has 474 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (C) 2012, Leonardo Leite, Diego Rabatone, Saulo Trento,
# Carolina Ramalho, Brenddon Gontijo Furtado
#
# This file is part of Radar Parlamentar.
#
Severity: Minor
Found in radar_parlamentar/importadores/cdep.py - About 7 hrs to fix

    Function _montar_url_consulta_camara has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _montar_url_consulta_camara(self, base_url, url_params, **kwargs):
            built_url = base_url
    
            for par in list(kwargs.keys()):
                if isinstance(kwargs[par], str):
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py - About 35 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 _deputado has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _deputado(self, voto_xml):
            """Procura primeiro no cache e depois no banco; se não existir,
            cria novo parlamentar"""
            nome = voto_xml.get('Nome')
            nome_partido = voto_xml.get('Partido')
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.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

    Function lista_proposicoes_de_mulheres has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def lista_proposicoes_de_mulheres():
        camaraws = Camaraws()
        prop_finder = ProposicoesFinder()
        importador = ImportadorCamara([''])
        importador.camara_dos_deputados = importador._gera_casa_legislativa()
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.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

    Function _votacao_from_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _votacao_from_xml(self, votacao_xml, prop):
            """votacao_xml -- XML representando votação (objeto etree)
               prop -- objeto do tipo Proposicao
            """
            descricao = 'Resumo: [%s]. ObjVotacao: [%s]' % (
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.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

    Merge this if statement with the enclosing one.
    Open

                    if not nome_partido in self.partidos_desconhecidos:

    Merging collapsible if statements increases the code's readability.

    Noncompliant Code Example

    if condition1:
        if condition2:
            # ...
    

    Compliant Solution

    if condition1 and condition2:
        # ...
    

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

    def _converte_data(data_str):
        """Converte string 'd/m/a' para objeto datetime.date;
        retona None se data_str é inválido
        """
        DATA_REGEX = '(\d\d?)/(\d\d?)/(\d{4})'
    Severity: Major
    Found in radar_parlamentar/importadores/cdep.py and 1 other location - About 3 hrs to fix
    radar_parlamentar/importadores/cmsp.py on lines 106..116

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

    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

        def _init_votacoes(self):
            """(id_prop,descricao,data) -> Votacao"""
            votacoes = {}
            for v in models.Votacao.objects.filter(
                    proposicao__casa_legislativa=self.camara_dos_deputados):
    Severity: Major
    Found in radar_parlamentar/importadores/cdep.py and 3 other locations - About 2 hrs to fix
    radar_parlamentar/importadores/cdep.py on lines 310..316
    radar_parlamentar/importadores/cmsp.py on lines 95..101
    radar_parlamentar/importadores/sen.py on lines 80..87

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

    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

        def _init_parlamentares(self):
            """(nome_parlamentar,nome_partido,localidade) -> Parlamentar"""
            parlamentares = {}
            for p in models.Parlamentar.objects.filter(
                    casa_legislativa=self.camara_dos_deputados):
    Severity: Major
    Found in radar_parlamentar/importadores/cdep.py and 3 other locations - About 2 hrs to fix
    radar_parlamentar/importadores/cdep.py on lines 331..337
    radar_parlamentar/importadores/cmsp.py on lines 95..101
    radar_parlamentar/importadores/sen.py on lines 80..87

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

    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 partido.numero == 0:
                    if not nome_partido in self.partidos_desconhecidos:
                        self.partidos_desconhecidos.append(nome_partido)
                        logger.warn('Não achou o partido %s. Mapeado como "sem partido"'
    Severity: Major
    Found in radar_parlamentar/importadores/cdep.py and 1 other location - About 1 hr to fix
    radar_parlamentar/importadores/cdep.py on lines 461..464

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

    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 not voto in self.opcoes_voto_desconhecidas:
                    self.opcoes_voto_desconhecidas.append(voto)
                    logger.warning(
                        'opção de voto "%s" desconhecido! Mapeado como ABSTENCAO'
    Severity: Major
    Found in radar_parlamentar/importadores/cdep.py and 1 other location - About 1 hr to fix
    radar_parlamentar/importadores/cdep.py on lines 497..500

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

    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 tree is None or tree.tag == 'erro':
                raise ValueError('Proposicao %s nao encontrada' % id_prop)
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py and 1 other location - About 50 mins to fix
    radar_parlamentar/importadores/cdep.py on lines 172..173

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

    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 tree is None or tree.tag == 'erro':
                raise ValueError('O ano %s nao possui votacoes ainda' % ano)
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py and 1 other location - About 50 mins to fix
    radar_parlamentar/importadores/cdep.py on lines 124..125

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

    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

            contagem_proposicoes[ano]['mulheres'] = len(proposicoes[ano]['F'])
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py and 1 other location - About 35 mins to fix
    radar_parlamentar/importadores/cdep.py on lines 566..566

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

    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

            contagem_proposicoes[ano]['homens'] = len(proposicoes[ano]['M'])
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py and 1 other location - About 35 mins to fix
    radar_parlamentar/importadores/cdep.py on lines 565..565

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

    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

    Line too long (84 > 79 characters)
    Open

                        logger.warn('Não achou o partido %s. Mapeado como "sem partido"'
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Invalid escape sequence '\d'
    Open

        DATA_REGEX = '(\d\d?)/(\d\d?)/(\d{4})'
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Invalid escape sequence '\d'
    Open

        DATA_REGEX = '(\d\d?)/(\d\d?)/(\d{4})'
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Invalid escape sequence '\i'
    Open

            Cada votação é um dicionário com chaves \in {id, sigla, num, ano}.
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Line too long (80 > 79 characters)
    Open

            """Listar as siglas de proposições existentes; exemplo: "PL", "PEC" etc.
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Invalid escape sequence '\d'
    Open

        DATA_REGEX = '(\d\d?)/(\d\d?)/(\d{4})'
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Invalid escape sequence '\d'
    Open

        DATA_REGEX = '(\d\d?)/(\d\d?)/(\d{4})'
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Do not assign a lambda expression, use a def
    Open

            f = lambda dic: (dic['id'], dic['sigla'], dic['num'], dic['ano'])
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Compound statements (on the same line) are generally discouraged.

    While sometimes it's okay to put an if/for/while with a small body
    on the same line, never do this for multi-clause statements.
    Also avoid folding such long lines!
    
    Always use a def statement instead of an assignment statement that
    binds a lambda expression directly to a name.
    
    Okay: if foo == 'blah':\n    do_blah_thing()
    Okay: do_one()
    Okay: do_two()
    Okay: do_three()
    
    E701: if foo == 'blah': do_blah_thing()
    E701: for x in lst: total += x
    E701: while t < 10: t = delay()
    E701: if foo == 'blah': do_blah_thing()
    E701: else: do_non_blah_thing()
    E701: try: something()
    E701: finally: cleanup()
    E701: if foo == 'blah': one(); two(); three()
    E702: do_one(); do_two(); do_three()
    E703: do_four();  # useless semicolon
    E704: def f(x): return 2*x
    E731: f = lambda x: 2*x

    Do not use bare 'except'
    Open

            except:
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    When catching exceptions, mention specific exceptions when possible.

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

    Continuation line under-indented for visual indent
    Open

                            % nome_partido)
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Continuation lines indentation.

    Continuation lines should align wrapped elements either vertically
    using Python's implicit line joining inside parentheses, brackets
    and braces, or using a hanging indent.
    
    When using a hanging indent these considerations should be applied:
    - there should be no arguments on the first line, and
    - further indentation should be used to clearly distinguish itself
      as a continuation line.
    
    Okay: a = (\n)
    E123: a = (\n    )
    
    Okay: a = (\n    42)
    E121: a = (\n   42)
    E122: a = (\n42)
    E123: a = (\n    42\n    )
    E124: a = (24,\n     42\n)
    E125: if (\n    b):\n    pass
    E126: a = (\n        42)
    E127: a = (24,\n      42)
    E128: a = (24,\n    42)
    E129: if (a or\n    b):\n    pass
    E131: a = (\n    42\n 24)

    Invalid escape sequence '\d'
    Open

        DATA_REGEX = '(\d\d?)/(\d\d?)/(\d{4})'
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Too many blank lines (2)
    Open

            try:
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank
    line.
    
    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).
    
    Use blank lines in functions, sparingly, to indicate logical
    sections.
    
    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1
    
    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

    Test for membership should be 'not in'
    Open

                    if not nome_partido in self.partidos_desconhecidos:
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Negative comparison should be done using "not in" and "is not".

    Okay: if x not in y:\n    pass
    Okay: assert (X in Y or X is Z)
    Okay: if not (X in Y):\n    pass
    Okay: zz = x is not y
    E713: Z = not X in Y
    E713: if not X.B in Y:\n    pass
    E714: if not X is Y:\n    pass
    E714: Z = not X.B is Y

    Test for membership should be 'not in'
    Open

                if not voto in self.opcoes_voto_desconhecidas:
    Severity: Minor
    Found in radar_parlamentar/importadores/cdep.py by pep8

    Negative comparison should be done using "not in" and "is not".

    Okay: if x not in y:\n    pass
    Okay: assert (X in Y or X is Z)
    Okay: if not (X in Y):\n    pass
    Okay: zz = x is not y
    E713: Z = not X in Y
    E713: if not X.B in Y:\n    pass
    E714: if not X is Y:\n    pass
    E714: Z = not X.B is Y

    There are no issues that match your filters.

    Category
    Status