Showing 24 of 388 total issues
File views.py
has 525 lines of code (exceeds 250 allowed). Consider refactoring. Open
from urllib.parse import urlparse
from directory_constants import urls, user_roles
from directory_forms_api_client.helpers import FormSessionMixin
from django.contrib import messages
File views.py
has 490 lines of code (exceeds 250 allowed). Consider refactoring. Open
from profile.business_profile import forms, helpers
import sentry_sdk
from directory_api_client.client import api_client
from directory_constants import urls, user_roles
File forms.py
has 418 lines of code (exceeds 250 allowed). Consider refactoring. Open
from profile.business_profile import constants, validators
import directory_validators.file
import directory_validators.string
import directory_validators.url
Function productsServicesTypeahead
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
dit.components.productsServicesTypeahead = (function() {
function ProductsServicesTypeahead(options) {
var multiselectElement = options.multiselectElement;
var choices = options.choices;
Function ProductsServicesTypeahead
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ProductsServicesTypeahead(options) {
var multiselectElement = options.multiselectElement;
var choices = options.choices;
var selectedValuesElement = options.selectedValuesElement;
Function expertise
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
dit.components.expertise = (function() {
function ExpertiseTypeahead(options) {
var multiselectElement = options.multiselectElement;
var selectedValuesElement = options.selectedValuesElement;
Function ExpertiseTypeahead
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ExpertiseTypeahead(options) {
var multiselectElement = options.multiselectElement;
var selectedValuesElement = options.selectedValuesElement;
var noResultsLabel = options.noResultsLabel;
File urls.py
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
import profile.business_profile.views
import profile.exops.views
import profile.personal_profile.views
import profile.soo.views
Function expertise
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
dit.components.expertise = (function() {
function ExpertiseTypeahead(options) {
var multiselectElement = options.multiselectElement;
var selectedValuesElement = options.selectedValuesElement;
- 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 productsServicesTypeahead
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
dit.components.productsServicesTypeahead = (function() {
function ProductsServicesTypeahead(options) {
var multiselectElement = options.multiselectElement;
var choices = options.choices;
- 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 mixins.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import abc
from urllib.parse import unquote
from directory_sso_api_client import sso_api_client
from django.contrib import messages
Function cookie
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
GOVUK.cookie = (new function() {
/* Set a cookie.
* @name (String) Name of cookie
* @value (String) Value to store
- 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 utm
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
GOVUK.utm = (new function() {
var utils = GOVUK.utils;
this.set = function() {
// params = [utm_campaign|utm_content|utm_medium|utm_source\utm_term]
- 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 cookie
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
GOVUK.cookie = (new function() {
/* Set a cookie.
* @name (String) Name of cookie
* @value (String) Value to store
Function __init__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, initial, is_enrolled=False, *args, **kwargs):
super().__init__(initial=initial, *args, **kwargs)
for field_name in ['sic', 'address']:
if initial.get(field_name):
character_count = len(initial[field_name])
- 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 utm
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
GOVUK.utm = (new function() {
var utils = GOVUK.utils;
this.set = function() {
// params = [utm_campaign|utm_content|utm_medium|utm_source\utm_term]
Function form_valid
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def form_valid(self, form):
try:
if form.cleaned_data['collaborator_email']:
helpers.collaborator_invite_create(
sso_session_id=self.request.user.session_id,
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def get(self, *args, **kwargs):
key = self.request.GET.get('key')
if key:
data = helpers.retrieve_preverified_company(key)
if data:
- 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 process_step
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_step(self, form):
if form.prefix == constants.USER_ACCOUNT:
response = sso_api_client.user.create_user(
email=form.cleaned_data['email'], password=form.cleaned_data['password']
)
- 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 form_valid
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def form_valid(self, form):
choice = form.cleaned_data['choice']
if choice == constants.COMPANIES_HOUSE_COMPANY:
url = URL_COMPANIES_HOUSE_ENROLMENT
elif choice == constants.NON_COMPANIES_HOUSE_COMPANY:
- 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"