Showing 100 of 2,397 total issues
Function Score
has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring. Open
def Score(questionid, answer):
if questionid.Question == 'Felt your life had a sense of purpose':
if answer == 'Yes':
return 2
elif answer == 'No':
- 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
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, UserId):
"""Here We Get the Session Scoring The User Have Fill All The Questions For Every Session Then We Get The Scoring For All Sessions
Or Else He/She Fill Only One Session Questions Then They Will Only Get That One Session Scoring Which They Are Filled By Using UserId
(Here We Get Scoring From Different Tables
1.Table_Name:'User_Diabetes_Assessment_table'
- 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
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, UserId):
"""Here We Get The Lifestyle assessment Data Based On UserId Include All the MasterData
(Table_Name : 'Lifestyle scoring Questions',
Table_Name : 'Openhealth_Lifestyle_Assessment_table')"""
- 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
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, UserId):
"""Here We Get The Depression assessment Data Based On UserId Include All the MasterData
(Table_Name : 'Depression Questions',
Table_Name : 'Openhealth_Depression_Assessment_table')"""
- 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
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, UserId):
"""Here We Get The Diabetes assessment Data Based On UserId Include All the MasterData
(Table_Name : 'Diabetes Questions',
Table_Name : 'Openhealth_Diabetes_Assessment_table')"""
- 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
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def get(self,request,state_name,district_name):
"""Here We're getting The available vaccine slots Based On district
(example: district= Visakhapatnam )"""
- 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
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def get(self,request,state_name,district_name,Date):
print(f"Showing you vaccination slots for DistricName: {district_name} and {Date} for next 7 days")
try:
b = datetime.datetime.strptime(Date, '%d-%m-%Y')
if b:
- 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 post
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request):
"""Here We Post The Open health bot Diabetes Assessment And We Get Score Of Each Question User
(Table_Name:'Openhealth_Diabetes_Assessment_table')"""
try:
question = request.data.get('QuestionId')
- 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 post
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request):
"""Here We Post The Open health bot LifeStyle Assessment And We Get Score Of Each Question User
(Table_Name:'Openhealth_Lifestyle_Assessment_table')"""
try:
question = request.data.get('QuestionId')
- 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 post
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request):
"""Here We Post The Open health bot Depression Assessment And We Get Score Of Each Question User
(Table_Name:'Openhealth_Depression_Assessment_table')"""
try:
question = request.data.get('QuestionId')
- 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 deeply nested control flow statements. Open
if int(i['id']) not in count:
if a==1:
a+=1
i['Diabetes'] = "Not Answered"
data.append(i)
Avoid deeply nested control flow statements. Open
if int(i['id']) not in count:
if a==1:
a+=1
i['Lifestyle'] = "Not Answered"
data.append(i)
Avoid deeply nested control flow statements. Open
if j['district_name'] == district_name:
district_id = j['district_id']
# datee = str(Date)
Avoid deeply nested control flow statements. Open
for i in range(10):
day = (datetime.date.today() + datetime.timedelta(i)).day
month = (datetime.date.today() + datetime.timedelta(i)).month
year = (datetime.date.today() + datetime.timedelta(i)).year
slot = 0
Avoid deeply nested control flow statements. Open
if int(i['id']) in count:
i['Lifestyle'] = j
data.append(i)
else:
pass
Avoid deeply nested control flow statements. Open
if int(i['id']) in count:
i['Depression'] = j
data.append(i)
else:
pass
Avoid deeply nested control flow statements. Open
if int(i['id']) in count:
i['Diabetes'] = j
data.append(i)
else:
pass
Avoid deeply nested control flow statements. Open
if int(i['id']) not in count:
if a==1:
a+=1
i['Depression'] = "Not Answered"
data.append(i)
Function get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get(self,request,pincode,Date):
"""Here We're getting The available vaccine slots Based On pincode and Date
(example: pincode= 530016 ,Date= 29-11-2022 )"""
# datee = str(Date)
# datem = datetime.datetime.strptime(datee, '%Y-%m-%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
Avoid too many return
statements within this function. Open
return s