Showing 108 of 108 total issues
File urls_redirect.py
has 3416 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.conf.urls import url
from django.http import HttpResponseNotFound, HttpResponseServerError
from django.views import View
from django.views.generic import RedirectView
from directory_constants import urls
Function invest
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
dit.tagging.invest = new function() {
this.init = function(page) {
$(document).ready(function() {
File dit.js
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Main dit.js file
// Expected to hold global variables, messages, and provide base to namespaces
var dit = {
// Namespace to be populated by external files
Function responsive
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
dit.responsive = (new function () {
// Constants
var RESET_EVENT = "dit:responsive:reset";
var RESPONSIVE_ELEMENT_ID = "dit-responsive-size";
Function Expander
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Expander($target, options) {
var EXPANDER = this;
var id = utils.generateUniqueStr(TYPE + "_");
var $wrapper, $control;
Function home
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
dit.home = (new function () {
// Page init
this.init = function() {
dit.responsive.init({
"desktop": "min-width: 768px",
Function languageSelector
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
dit.components.languageSelector = (new function() {
var LANG_SELECT_CLOSE_BUTTON_ID = "header-language-selector-close";
/* Extends SelectTracker to meet additional display requirement
Similar blocks of code found in 2 locations. Consider refactoring. Open
class HighPotentialOpportunityDetailView(
GetSlugFromKwargsMixin,
CMSPageView,
):
active_view_name = 'high-potential-opportunity-detail'
- 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 50.
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
class UKRegionPageCMSView(GetSlugFromKwargsMixin, CMSPageView):
active_view_name = ''
template_name = 'core/accordion_content_page.html'
def __init__(self):
- 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 50.
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 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.init = function(page) {
$(document).ready(function() {
addTaggingForFeedbackLink();
Function move
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Expander.move = function(e) {
var counter = this.links.counter;
var $links = this.links.$found;
if($links) {
switch(e.which) {
Function languageSelector
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
dit.components.languageSelector = (new function() {
var LANG_SELECT_CLOSE_BUTTON_ID = "header-language-selector-close";
/* Extends SelectTracker to meet additional display requirement
- 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 Modal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Modal($container, options) {
var modal = this;
var config = $.extend({
$activators: $(), // (optional) Element(s) to control the Modal
closeOnBuild: true, // Whether intial Modal view is open or closed
Function responsive
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
dit.responsive = (new function () {
// Constants
var RESET_EVENT = "dit:responsive:reset";
var RESPONSIVE_ELEMENT_ID = "dit-responsive-size";
- 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 localised_urls
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def localised_urls(self):
localised = []
requested_language = translation.get_language()
url_parts = urlparse(self.request.build_absolute_uri())
base_url = f'{url_parts.scheme}://{url_parts.netloc}/'
- 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 __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function process_request
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_request(self, request):
if not request.session.get('utm'):
request.session['utm'] = {}
if request.GET.get('utm_source'):
- 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
def __init__(self):
super().__init__()
self.set_ga360_payload(
- 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 32.
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
def __init__(self):
super().__init__()
self.set_ga360_payload(
- 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 32.
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
At least two spaces before inline comment Open
url='https://great.gov.uk/privacy-and-cookies/fair-processing-notice-zendesk/', # noqa
- Read upRead up
- Exclude checks
Separate inline comments by at least two spaces.
An inline comment is a comment on the same line as a statement.
Inline comments should be separated by at least two spaces from the
statement. They should start with a # and a single space.
Each line of a block comment starts with a # and a single space
(unless it is indented text inside the comment).
Okay: x = x + 1 # Increment x
Okay: x = x + 1 # Increment x
Okay: # Block comment
E261: x = x + 1 # Increment x
E262: x = x + 1 #Increment x
E262: x = x + 1 # Increment x
E265: #Block comment
E266: ### Block comment