Showing 95 of 177 total issues
Avoid too many return
statements within this function. Open
return step.render(request, {
Avoid too many return
statements within this function. Open
return redirect('data_capture:step_5')
Function wait_for_db
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def wait_for_db(max_attempts=15, seconds_between_attempts=1):
# type: (int, int) -> None
'''
Some manage.py commands interact with the database, and we want
them to be directly callable from `docker-compose run`. However,
- Read upRead up
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 convert_next
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def convert_next(self):
'''
Returns a generator that yields converted rows. The conversion is
from the related xls_file to the CSV row format expected by
contracts.loaders.region_10.Region10Loader
- Read upRead up
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 has_existing_contract_number_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def has_existing_contract_number_error(self):
if 'contract_number' in self.errors:
for err in self.errors.as_data()['contract_number']:
if isinstance(err, DuplicateContractValidationError):
return True
- Read upRead up
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 toggleErrorMsg
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function toggleErrorMsg(window, options) {
if (options.parent) {
// I'm tired of typing `options`
const { parent } = options;
const errorContainer = parent.querySelector(`.${INVALID_MESSAGE_CLASS}`)
- Read upRead up
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 bulk_update_normalized_labor_categories
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def bulk_update_normalized_labor_categories(self):
'''
Iterate through all Contract models and update their
normalized labor categories if necessary.
- Read upRead up
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 generate_username
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_username(self, email, max_attempts=100):
'''
Generate a unique username based on the given email address
by slugifying the first several characters of the username
part of the email. If needed, a number is added at the end
- Read upRead up
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 recordable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def recordable(self, func):
'''
A view decorator that makes a view recordable and replayable.
The view will be passed 'recorder' as a keyword argument;
- Read upRead up
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 write_roman
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_roman(num):
roman: OrderedDict[int, str] = OrderedDict()
roman[1000] = "M"
roman[900] = "CM"
roman[500] = "D"
- Read upRead up
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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function initialize(el, {
api,
getQueryType,
setFieldValue,
}) {
- Read upRead up
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 componentDidUpdate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
componentDidUpdate(_, prevState) {
if (prevState.typed !== this.state.typed) {
const value = this.state.typed;
const floatValue = value ? parseFloat(value) : 0;
if (!isNaN(floatValue) && floatValue >= 0) { /* eslint-disable-line no-restricted-globals */
- Read upRead up
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 order_by
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def order_by(self, *args, **kwargs):
edu_sort_sql = """
case
when education_level = 'HS' then 1
when education_level = 'AA' then 2
- Read upRead up
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 from_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def from_list(cls, docs):
vocab = cls()
for doc in docs:
words = doc.split()
for word in words:
- Read upRead up
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 absolutify_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def absolutify_url(url: str) -> str:
'''
If the URL is an absolute path, returns the URL prefixed with
the current Site's protocol and host information.
- Read upRead up
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"