Showing 207 of 457 total issues
Function edit
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def edit(sugg_id):
suggestion = Suggestion.query.get(sugg_id)
if suggestion is None:
abort(404)
resource = Resource.query.get(suggestion.resource_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 Criterion
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.lib.wcag2.Criterion = (function () {
// Provide default values for the assert objects
function aggregateParts(parts, defaultResult) {
var getResultPriority = quail.lib.wcag2.EarlAssertion.getResultPriority;
Function Section
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.lib.Section = (function () {
/**
* A Collection of Tests.
*/
Function elementAttributesAreValid
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.elementAttributesAreValid = function(quail, test, Case) {
quail.components.htmlSource.getHtml(function(html, parsed) {
if (!parsed) {
return;
}
Function create
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def create():
"""Add a resource."""
descriptors = Descriptor.query.all()
for descriptor in descriptors:
if descriptor.dtype == 'option' and descriptor.values:
- 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 wcag2
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.lib.wcag2 = (function () {
'use strict';
var ajaxOpt = {async: false, dataType: 'json'};
/**
Function scriptFocusIndicatorVisible
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.scriptFocusIndicatorVisible = function() {
quail.html.find(quail.focusElements).each(function() {
// Preparation for test: remove focus indicators done with CSS
var sheet, rules, rulesCache, rule;
Function scanHeaders
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function scanHeaders(tableMap, x, y, deltaX, deltaY) {
var headerList = $();
var cell = $(tableMap[y][x]);
var opaqueHeaders = [];
var inHeaderBlock;
Function invoke
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
invoke: function () {
// This test is already running.
if (this.testComplete) {
throw new Error('The test ' + this.get('name') + ' is already running.');
}
Function pNotUsedAsHeader
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.pNotUsedAsHeader = function(quail, test, Case) {
test.get('$scope').find('p').each(function() {
var _case = Case({
element : this,
expected: $(this).closest('.quail-test').data('expected')
Function acronym
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.components.acronym = function(quail, test, Case) {
test.get('$scope').each(function() {
var $scope = $(this);
var alreadyReported = { };
var predefined = { };
Function colorElementBehindBackgroundGradientContrast
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.colorElementBehindBackgroundGradientContrast = function (quail, test, Case, options) {
var colors = quail.components.color.colors;
var buildCase = quail.components.color.buildCase;
var id = 'colorElementBehindBackgroundGradientContrast';
Function predict_options
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def predict_options(self):
for i, column in enumerate(self.csv_header_row.csv_header_cells):
if column.descriptor_type == 'option':
predicted_options = set()
for j in range(len(self.csv_rows)):
- 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 colorBackgroundGradientContrast
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.colorBackgroundGradientContrast = function (quail, test, Case, options) {
var colors = quail.components.color.colors;
var buildCase = quail.components.color.buildCase;
var id = 'colorBackgroundGradientContrast';
Function step
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
step: function(row, parser) {
// Check CSV formatting before parsing first row
if (numRows == 0) {
fields = row.meta.fields.map(function(e) {
return e.trim();
Function videoMayBePresent
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.videoMayBePresent=function(quail, test, Case){
var videoExtensions = ['webm', 'flv', 'ogv', 'ogg', 'avi', 'mov', 'qt', 'wmv', 'asf',
'mp4', 'm4p', 'm4v', 'mpg', 'mp2', 'mpeg', 'mpg', 'mpe', 'mpv', 'm2v', '3gp', '3g2'];
var videoHosts = ['//www.youtube.com/embed/', '//player.vimeo.com/video/'];
Function markerListener
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function markerListener(marker, event) {
$('.list-resource').removeClass('list-selected');
$('#map').show();
$('#resource-info').hide();
Function elementsDoNotHaveDuplicateAttributes
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.elementsDoNotHaveDuplicateAttributes = function(quail, test, Case) {
quail.components.htmlSource.getHtml(function(html, parsed) {
if (!parsed) {
return;
}
Function colorElementBehindBackgroundImageContrast
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
quail.colorElementBehindBackgroundImageContrast = function (quail, test, Case, options) {
var colors = quail.components.color.colors;
var buildCase = quail.components.color.buildCase;
var id = 'colorElementBehindBackgroundImageContrast';
Function constructor
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function constructor (data, testDefinitions, preconditionDefinitions, subject) {
var testAggregators = [];
var criterion = {};
var defaultResult = data['default'] || 'untested';
var id = data.id;