Showing 99 of 885 total issues
Function get_log
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def get_log(log_name, size=1000):
lines = ""
file_name = f"{log_dir}{log_name}"
if os.path.exists(f"{file_name}"):
try:
- 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 send_count_request
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def send_count_request(uri, query, query_mapping_function, jwt_token, host=None, api_root=API_ROOT, use_post=False, is_template=False):
'''
Gets the total number of items for a filterset
'''
args = {}
- 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
Avoid too many return
statements within this function. Open
return "Invalid date"
Avoid too many return
statements within this function. Open
return Bid.Status.draft
Avoid too many return
statements within this function. Open
return Response(status=status.HTTP_204_NO_CONTENT)
Avoid too many return
statements within this function. Open
return Bid.Status.handshake_accepted
Avoid too many return
statements within this function. Open
return Bid.Status.submitted
Avoid too many return
statements within this function. Open
return Bid.Status.handshake_needs_registered
Avoid too many return
statements within this function. Open
return newly_created_ai_seq_num or existing_ai_seq_num
Avoid too many return
statements within this function. Open
return Bid.Status.in_panel
Avoid too many return
statements within this function. Open
return parser.parse(date + '.000Z').astimezone(datetime.timezone.utc) - datetime.timedelta(hours=utc_offset)
Function update_counts_for_endpoint
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def update_counts_for_endpoint(endpoint=None, contains=False, jwt_token='', user=''):
'''
Update all saved searches counts whose endpoint matches the specified endpoint.
If the endpoint is omitted, updates all saved search counts.
- 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 get_aih_csv
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def get_aih_csv(data, filename):
filename = re.sub(r'(\_)\1+', r'\1', filename.replace(',', '_').replace(' ', '_').replace("'", '_'))
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = f"attachment; filename={filename}_{datetime.now().strftime('%Y_%m_%d_%H%M%S')}.csv"
- 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 get_bidders_csv
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def get_bidders_csv(self, pk, data, filename, jwt_token):
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = f"attachment; filename={filename}_{datetime.now().strftime('%Y_%m_%d_%H%M%S')}.csv"
writer = csv.writer(response, csv.excel)
- 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 destroy
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def destroy(self, request, *args, **kwargs):
'''
Closes or deletes specified bid
This endpoint will delete bids which are still in a draft status, but close any other status
- 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 save_assignment_cycle_req_mapping
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def save_assignment_cycle_req_mapping(req, is_update=False):
data = req['data']
name = data['assignmentCycle']
cycle_category = data['cycleCategory']
cycle_status = data['cycleStatus']
- 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 bidderHandshakeNotification
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def bidderHandshakeNotification(bureau_user, cp_id, perdet, jwt, is_accept=True):
from talentmap_api.fsbid.services.cdo import single_cdo
action = "accepted" if is_accept else "declined"
message = f"Bidder has {action} your handshake for a position."
- 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 map_fsbid_template_to_tm
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def map_fsbid_template_to_tm(data, mapping):
mapped_items = {}
for x in mapping.items():
if isinstance(x[1], dict):
- 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 fsbid_languages_to_tmap
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def fsbid_languages_to_tmap(languages):
tmap_languages = []
empty_score = '--'
for x in languages:
if not x.get('empl_language', None) or not str(x.get('empl_language')).strip():
- 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"