Showing 18 of 76 total issues
File test_job_views.py
has 504 lines of code (exceeds 250 allowed). Consider refactoring. Open
from unittest.mock import patch
from django.contrib.auth.models import User
from django.http import HttpRequest
from django.test import Client, TestCase, override_settings
File test_job_model.py
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
from datetime import datetime, timedelta
from hashlib import sha512
from unittest.mock import patch
import responses
from django.contrib.auth.models import User
Function process_response
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process_response(self, request, response):
response["Cache-Control"] = "max-age=%d" % MAX_AGE
if response.status_code != 404:
return response
- 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 subscribe
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function subscribe(reg) {
// Get the Subscription or register one
reg.pushManager.getSubscription().then(
function(subscription) {
var metaObj, applicationServerKey, options;
Function unsubscribe
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function unsubscribe(reg) {
// Get the Subscription to unregister
reg.pushManager.getSubscription()
.then(
function(subscription) {
Function handle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
if not settings.GITHUB_ACCESS_TOKEN or not settings.GITHUB_DEFAULT_REPO:
return "False"
g = Github(settings.GITHUB_ACCESS_TOKEN)
- 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 initialiseState
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initialiseState(reg) {
// Are Notifications supported in the service worker?
if (!(reg.showNotification)) {
// Show a message and activate the button
subBtn.textContent = document.getElementById('push-subscribe').getAttribute("data-push-subscribe-label");
Function section_reshaping
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def section_reshaping(sections, issue_content):
"""
This function enables markdown <h2> to be detected and inserted
in the right section of the original dictionary.
- 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 setup_labels
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def setup_labels(labels, content):
content["salary_range"] = 10
content["contract_form"] = 1
content["job_level"] = 5
content["remote"] = False
- 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 format_issue_content
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def format_issue_content(issue_content):
sections = {
"Nossa empresa": "",
"Descrição da vaga": "",
"Local": "",
- 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 handle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
for user in tqdm(User.objects.exclude(profile__github__isnull=True)):
user_data = {
"github": {
- 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 test
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def test(sender, instance, created, **kwargs):
if not created or not instance.receive_emails:
return False
message_text = " ".join(
- 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 job_view
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def job_view(request, unique_slug):
job = get_object_or_404(Job, unique_slug=unique_slug)
context = {
"job": job,
"logged_in": False,
- 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 handle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
driver = driver_factory()
for user in tqdm(
User.objects.filter(profile__linkedin__isnull=False).exclude(
- 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 handle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
headers = {
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS 11.1.0; rv:42.0) Gecko/20100101 Firefox/42.0"
}
response = requests.get(
- 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 redirect("/")
Function append_social_info_to_context
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def append_social_info_to_context(request):
return_content = {}
try:
user = request.user
- 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 pythonista_change_password
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pythonista_change_password(request):
template_name = "user_area/pythonistas-area-password-change.html"
if request.user.has_usable_password():
form = PasswordChangeForm
else:
- 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"