app/assets/javascripts/fae/_tables.js
File _tables.js
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* global Fae, FCH, Cookies */
/**
* Fae tables
* @namespace tables
Function collapsibleTable
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
collapsibleTable: function() {
var $collapsible = $('.collapsible');
var $toggle = $('.collapsible-toggle');
// If there's only one table, don't bother with collapsing everything
Function sizeFixedHeader
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
sizeFixedHeader: function() {
var $tables = $('.content table');
var header_height = $('.js-content-header').outerHeight();
if(FCH.large_down) {
Function stickyTableHeader
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
stickyTableHeader: function() {
var $sticky_tables = $('.content table:not(.stuck-table)');
// Add sticky psuedo tables after our main table to hold the fixed header
$sticky_tables.each(function() {
Function rowSorting
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
rowSorting: function() {
$('.js-sort-row').sortable({
items: 'tbody tr',
opacity: 0.8,
handle: ('.sortable-handle'),
Function dateColumnSorting
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
dateColumnSorting: function() {
$.tablesorter.addParser({
id: 'mmddyy',
is: function(s) {
// testing for ##-##-#### or ####-##-##, so it's not perfect; time can be included
- 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 applyOffset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function applyOffset() {
var $this = $(this);
// If this is a collapsible item and the table is hidden, forget it
if($this.parent().hasClass('collapsible') && !$this.parent().hasClass('active')) {
Function sizeFixedHeader
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
sizeFixedHeader: function() {
var $tables = $('.content table');
var header_height = $('.js-content-header').outerHeight();
if(FCH.large_down) {
- 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"