18F/forecast

View on GitHub
forecast-admin/forecast/opportunities/management/commands/load_opportunities.py

Summary

Maintainability
F
3 days
Test Coverage

File load_opportunities.py has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import csv
from datetime import date
from decimal import Decimal, InvalidOperation
import re

    Cyclomatic complexity is too high in method make_opportunity. (14)
    Open

        @classmethod
        def make_opportunity(cls, row, agency='GSA'):
            if agency == "GSA":
                office = cls.insert_office(row[0], row[1])
    
    

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function make_opportunity has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_opportunity(cls, row, agency='GSA'):
            if agency == "GSA":
                office = cls.insert_office(row[0], row[1])
    
                adv = cls.parse_advisor(row[23])

    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

    Cyclomatic complexity is too high in method parse_fiscal_dates. (7)
    Open

        @staticmethod
        def parse_fiscal_dates(s):
            try:
                split = s.split("-")
                year = split[0][3:]

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method parse_fiscal_quarter_only. (6)
    Open

        @staticmethod
        def parse_fiscal_quarter_only(s):
            q = re.search(r"(\d)", s)
            if q:
                n = q.group(1)

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method parse_file. (6)
    Open

        def parse_file(self, filename, strict=False, agency='GSA'):
            with open(filename, 'rU') as f:
                reader = csv.reader(f)
    
                for _ in range(self.header_rows):

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

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

        def parse_fiscal_dates(s):
            try:
                split = s.split("-")
                year = split[0][3:]
                original_quarter = split[1]

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

        def parse_file(self, filename, strict=False, agency='GSA'):
            with open(filename, 'rU') as f:
                reader = csv.reader(f)
    
                for _ in range(self.header_rows):

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

        def parse_fiscal_quarter_only(s):
            q = re.search(r"(\d)", s)
            if q:
                n = q.group(1)
                if n == "1":

    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 too many return statements within this function.
    Open

                return opportunity

      Avoid too many return statements within this function.
      Open

                  return opportunity

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

                if q:
                    n = q.group(1)
                    if n == "1":
                        quarter = "1st"
                    elif n == "2":
        forecast-admin/forecast/opportunities/management/commands/load_opportunities.py on lines 286..297

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

        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 q:
                        n = q.group(1)
                        if n == "1":
                            quarter = "1st"
                        elif n == "2":
        forecast-admin/forecast/opportunities/management/commands/load_opportunities.py on lines 305..316

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

        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 "and" in row[6]:
                        dollars = row[6].strip().split('and')
                        opportunity.dollar_value_min=cls.parse_dollars_plus(dollars[0])
                        if len(dollars) > 1:
                            opportunity.dollar_value_max=cls.parse_dollars_plus(dollars[1])
        forecast-admin/forecast/opportunities/management/commands/load_opportunities.py on lines 238..242

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

        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 "TBD" in row[7]:
                        dollars = row[7].strip().split('and')
                        opportunity.dollar_value_min=cls.parse_dollars_plus(dollars[0])
                        if len(dollars) > 1:
                            opportunity.dollar_value_max=cls.parse_dollars_plus(dollars[1])
        forecast-admin/forecast/opportunities/management/commands/load_opportunities.py on lines 263..267

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

        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

        Missing whitespace around operator
        Open

                            opportunity.dollar_value_max=cls.parse_dollars_plus(dollars[1])

        Surround operators with a single space on either side.

        - Always surround these binary operators with a single space on
          either side: assignment (=), augmented assignment (+=, -= etc.),
          comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
          Booleans (and, or, not).
        
        - If operators with different priorities are used, consider adding
          whitespace around the operators with the lowest priorities.
        
        Okay: i = i + 1
        Okay: submitted += 1
        Okay: x = x * 2 - 1
        Okay: hypot2 = x * x + y * y
        Okay: c = (a + b) * (a - b)
        Okay: foo(bar, key='word', *args, **kwargs)
        Okay: alpha[:-i]
        
        E225: i=i+1
        E225: submitted +=1
        E225: x = x /2 - 1
        E225: z = x **y
        E225: z = 1and 1
        E226: c = (a+b) * (a-b)
        E226: hypot2 = x*x + y*y
        E227: c = a|b
        E228: msg = fmt%(errno, errmsg)

        Missing whitespace around operator
        Open

                        opportunity.dollar_value_min=cls.parse_dollars_plus(dollars[0])

        Surround operators with a single space on either side.

        - Always surround these binary operators with a single space on
          either side: assignment (=), augmented assignment (+=, -= etc.),
          comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
          Booleans (and, or, not).
        
        - If operators with different priorities are used, consider adding
          whitespace around the operators with the lowest priorities.
        
        Okay: i = i + 1
        Okay: submitted += 1
        Okay: x = x * 2 - 1
        Okay: hypot2 = x * x + y * y
        Okay: c = (a + b) * (a - b)
        Okay: foo(bar, key='word', *args, **kwargs)
        Okay: alpha[:-i]
        
        E225: i=i+1
        E225: submitted +=1
        E225: x = x /2 - 1
        E225: z = x **y
        E225: z = 1and 1
        E226: c = (a+b) * (a-b)
        E226: hypot2 = x*x + y*y
        E227: c = a|b
        E228: msg = fmt%(errno, errmsg)

        Missing whitespace after ','
        Open

                        split = s.replace(","," ").replace("  "," ").split(' ')

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Missing whitespace after ','
        Open

                        ("M","000000"),

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Line too long (86 > 79 characters)
        Open

                    # TODO: account for improper name formatting without miscapitalizing names

        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.

        Missing whitespace after ','
        Open

                        split = s.replace(","," ").replace("  "," ").split(' ')

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Do not use bare 'except'
        Open

                except:

        When catching exceptions, mention specific exceptions when possible.

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

        Line too long (85 > 79 characters)
        Open

                opportunities = list(self.parse_file(filename, strict=strict, agency=agency))

        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.

        Missing whitespace around operator
        Open

                        place_of_performance_state=row[3]

        Surround operators with a single space on either side.

        - Always surround these binary operators with a single space on
          either side: assignment (=), augmented assignment (+=, -= etc.),
          comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
          Booleans (and, or, not).
        
        - If operators with different priorities are used, consider adding
          whitespace around the operators with the lowest priorities.
        
        Okay: i = i + 1
        Okay: submitted += 1
        Okay: x = x * 2 - 1
        Okay: hypot2 = x * x + y * y
        Okay: c = (a + b) * (a - b)
        Okay: foo(bar, key='word', *args, **kwargs)
        Okay: alpha[:-i]
        
        E225: i=i+1
        E225: submitted +=1
        E225: x = x /2 - 1
        E225: z = x **y
        E225: z = 1and 1
        E226: c = (a+b) * (a-b)
        E226: hypot2 = x*x + y*y
        E227: c = a|b
        E228: msg = fmt%(errno, errmsg)

        Do not use bare 'except'
        Open

                except:

        When catching exceptions, mention specific exceptions when possible.

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

        Missing whitespace after ','
        Open

                        return [s,'','']

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Missing whitespace after ','
        Open

                    office = cls.insert_office(row[2],"")

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Line too long (84 > 79 characters)
        Open

                        estimated_fiscal_year_quarter=cls.parse_fiscal_quarter_only(row[9]),

        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.

        Do not use bare 'except'
        Open

                except:

        When catching exceptions, mention specific exceptions when possible.

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

        Missing whitespace after ','
        Open

                    return re.sub(".","", s[1:]) + "0000"

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Missing whitespace after ','
        Open

                        (" ",""),

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Missing whitespace after ','
        Open

                        ("K","000")

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Missing whitespace around operator
        Open

                        opportunity.dollar_value_min=cls.parse_dollars_plus(dollars[0])

        Surround operators with a single space on either side.

        - Always surround these binary operators with a single space on
          either side: assignment (=), augmented assignment (+=, -= etc.),
          comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
          Booleans (and, or, not).
        
        - If operators with different priorities are used, consider adding
          whitespace around the operators with the lowest priorities.
        
        Okay: i = i + 1
        Okay: submitted += 1
        Okay: x = x * 2 - 1
        Okay: hypot2 = x * x + y * y
        Okay: c = (a + b) * (a - b)
        Okay: foo(bar, key='word', *args, **kwargs)
        Okay: alpha[:-i]
        
        E225: i=i+1
        E225: submitted +=1
        E225: x = x /2 - 1
        E225: z = x **y
        E225: z = 1and 1
        E226: c = (a+b) * (a-b)
        E226: hypot2 = x*x + y*y
        E227: c = a|b
        E228: msg = fmt%(errno, errmsg)

        Missing whitespace around operator
        Open

                            opportunity.dollar_value_max=cls.parse_dollars_plus(dollars[1])

        Surround operators with a single space on either side.

        - Always surround these binary operators with a single space on
          either side: assignment (=), augmented assignment (+=, -= etc.),
          comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
          Booleans (and, or, not).
        
        - If operators with different priorities are used, consider adding
          whitespace around the operators with the lowest priorities.
        
        Okay: i = i + 1
        Okay: submitted += 1
        Okay: x = x * 2 - 1
        Okay: hypot2 = x * x + y * y
        Okay: c = (a + b) * (a - b)
        Okay: foo(bar, key='word', *args, **kwargs)
        Okay: alpha[:-i]
        
        E225: i=i+1
        E225: submitted +=1
        E225: x = x /2 - 1
        E225: z = x **y
        E225: z = 1and 1
        E226: c = (a+b) * (a-b)
        E226: hypot2 = x*x + y*y
        E227: c = a|b
        E228: msg = fmt%(errno, errmsg)

        Missing whitespace after ','
        Open

                    return ["",""]

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Missing whitespace after ','
        Open

                        return [s,'','']

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Missing whitespace after ','
        Open

                        (r"[\$,\>\<\=\n]",""),

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Line too long (81 > 79 characters)
        Open

                        opportunity.dollar_value_max = cls.parse_dollars_plus(dollars[1])

        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.

        Test for membership should be 'not in'
        Open

                    if not "TBD" in row[7]:

        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

        Missing whitespace around operator
        Open

                    SUBS=[

        Surround operators with a single space on either side.

        - Always surround these binary operators with a single space on
          either side: assignment (=), augmented assignment (+=, -= etc.),
          comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
          Booleans (and, or, not).
        
        - If operators with different priorities are used, consider adding
          whitespace around the operators with the lowest priorities.
        
        Okay: i = i + 1
        Okay: submitted += 1
        Okay: x = x * 2 - 1
        Okay: hypot2 = x * x + y * y
        Okay: c = (a + b) * (a - b)
        Okay: foo(bar, key='word', *args, **kwargs)
        Okay: alpha[:-i]
        
        E225: i=i+1
        E225: submitted +=1
        E225: x = x /2 - 1
        E225: z = x **y
        E225: z = 1and 1
        E226: c = (a+b) * (a-b)
        E226: hypot2 = x*x + y*y
        E227: c = a|b
        E228: msg = fmt%(errno, errmsg)

        Line too long (83 > 79 characters)
        Open

                            opportunity.dollar_value_max=cls.parse_dollars_plus(dollars[1])

        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.

        Line too long (165 > 79 characters)
        Open

        # And converted by Dave Zvenyach at https://github.com/18F/forecast/blob/load-command/forecast-admin/forecast/opportunities/management/commands/load_opportunities.py

        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.

        Missing whitespace after ','
        Open

                        parsed = re.sub(pattern,replacement, parsed)

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Missing whitespace around operator
        Open

                        opportunity.estimated_fiscal_year=row[15][-4:]

        Surround operators with a single space on either side.

        - Always surround these binary operators with a single space on
          either side: assignment (=), augmented assignment (+=, -= etc.),
          comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
          Booleans (and, or, not).
        
        - If operators with different priorities are used, consider adding
          whitespace around the operators with the lowest priorities.
        
        Okay: i = i + 1
        Okay: submitted += 1
        Okay: x = x * 2 - 1
        Okay: hypot2 = x * x + y * y
        Okay: c = (a + b) * (a - b)
        Okay: foo(bar, key='word', *args, **kwargs)
        Okay: alpha[:-i]
        
        E225: i=i+1
        E225: submitted +=1
        E225: x = x /2 - 1
        E225: z = x **y
        E225: z = 1and 1
        E226: c = (a+b) * (a-b)
        E226: hypot2 = x*x + y*y
        E227: c = a|b
        E228: msg = fmt%(errno, errmsg)

        Missing whitespace after ','
        Open

                        ("B","000000000"),

        Each comma, semicolon or colon should be followed by whitespace.

        Okay: [a, b]
        Okay: (3,)
        Okay: a[1:4]
        Okay: a[:4]
        Okay: a[1:]
        Okay: a[1:4:2]
        E231: ['a','b']
        E231: foo(bar,baz)
        E231: [{'a':'b'}]

        Line too long (82 > 79 characters)
        Open

                        dollar_value_max=cls.parse_dollars_plus(row[6].split('-')[1][1:]),

        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.

        Line too long (83 > 79 characters)
        Open

                            opportunity.dollar_value_max=cls.parse_dollars_plus(dollars[1])

        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.

        There are no issues that match your filters.

        Category
        Status