Showing 885 of 885 total issues
File available_position.py
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import coreapi
import pydash
from django.core.exceptions import PermissionDenied, SuspiciousOperation
Function get_ap_and_pv_csv
has a Cognitive Complexity of 29 (exceeds 7 allowed). Consider refactoring. Open
def get_ap_and_pv_csv(data, filename, ap=False, tandem=False):
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 modify_panel_meeting_and_dates
has a Cognitive Complexity of 28 (exceeds 7 allowed). Consider refactoring. Open
def modify_panel_meeting_and_dates(query, jwt_token):
'''
Modify Panel Meeting and Panel Meeting Dates
'''
# Inject decoded hru
- 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 create_models_from_csv
has a Cognitive Complexity of 27 (exceeds 7 allowed). Consider refactoring. Open
def create_models_from_csv(self, csv_filepath):
'''
Loads data from an CSV file into a model, using a defined mapping of fields
to CSV column titles.
- 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
File employee.py
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from functools import partial
from urllib.parse import urlencode, quote
from django.conf import settings
Function fsbid_available_bidder_to_talentmap
has a Cognitive Complexity of 25 (exceeds 7 allowed). Consider refactoring. Open
def fsbid_available_bidder_to_talentmap(data):
employee = data.get('employee', None)
current_assignment = None
assignments = None
position = None
- 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_clients_to_talentmap_clients
has a Cognitive Complexity of 25 (exceeds 7 allowed). Consider refactoring. Open
def fsbid_clients_to_talentmap_clients(data):
employee = data.get('employee', None)
current_assignment = None
assignments = None
position = None
- 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
File bidding_tool.py
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from talentmap_api.fsbid.services import common as services
from talentmap_api.common.common_helpers import service_response
Function formatCSV
has a Cognitive Complexity of 24 (exceeds 7 allowed). Consider refactoring. Open
def formatCSV(data, fieldsInfo):
fields_formatted = {}
for f in fieldsInfo:
if f == "skills":
- 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
File projected_vacancies.py
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from functools import partial
import requests # pylint: disable=unused-import
import pydash
Function archive_favorites
has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring. Open
def archive_favorites(ids, request, isPV=False, favoritesLimit=FAVORITES_LIMIT):
fav_length = len(ids)
if fav_length >= favoritesLimit or fav_length == round(favoritesLimit / 2):
# Pos nums is string to pass correctly to services url
pos_nums = ','.join(ids)
- 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_single_agenda_item_to_talentmap_single_agenda_item
has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring. Open
def fsbid_single_agenda_item_to_talentmap_single_agenda_item(data, ref_skills={}):
agendaStatusAbbrev = {
"Approved": "APR",
"Deferred - Proposed Position": "XXX",
"Disapproved": "DIS",
- 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
File panel.py
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from urllib.parse import urlencode, quote
from functools import partial
from copy import deepcopy
import csv
File reference.py
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from urllib.parse import urlencode, quote
from functools import partial
import pydash
Function get_agendas_by_panel
has a Cognitive Complexity of 20 (exceeds 7 allowed). Consider refactoring. Open
def get_agendas_by_panel(pk, jwt_token):
'''
Get agendas for panel meeting
'''
skillUrl = f"{API_ROOT}/v1/references/skills"
- 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_single_agenda_item
has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring. Open
def get_single_agenda_item(jwt_token=None, pk=None):
'''
Get single agenda item
'''
- 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 prefetch_model
has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring. Open
def prefetch_model(cls, model, queryset, prefix="", parent_method=None, visited=None):
'''
This method sets up prefetch and selected related statements when applicable
for foreign key relationships.
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function __init__
has a Cognitive Complexity of 18 (exceeds 7 allowed). Consider refactoring. Open
def __init__(self, *args, **kwargs):
override_fields = kwargs.pop("override_fields", [])
override_exclude = kwargs.pop("override_exclude", [])
# Initializer our parent serializer
- 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"