Showing 92 of 4,113 total issues
Function events
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
events : function (instance) {
var self = this;
var S = this.S;
self.create(this.S(instance));
Function hide
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
hide : function (el, css) {
// is modal
if (css) {
var settings = el.data(this.attr_name(true) + '-init'),
context = this;
Function events
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
events : function (scope) {
var self = this,
S = self.S,
$scroll_container = $('.scroll-container');
Function set_ui
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
set_ui : function ($handle, value) {
var settings = $.data($handle[0], 'settings'),
handle_l = $.data($handle[0], 'handle_l'),
bar_l = $.data($handle[0], 'bar_l'),
norm_pct = this.normalized_percentage(value, settings.start, settings.end),
Function equalize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
equalize : function (equalizer) {
var isStacked = false,
group = equalizer.data('equalizer'),
settings = equalizer.data(this.attr_name(true)+'-init') || this.settings,
vals,
Method pick_em_button
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def pick_em_button(pick, *args)
opts = args.extract_options!
user = opts[:user] || h.current_user
team = model.send("#{pick}_team") if pick.in? %i(home away)
html_classes = ['choice', pick == :draw ? ['secondary'] : ['primary-bg', team.abbrv.downcase]].flatten
Function events
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
events : function () {
var self = this,
S = this.S;
var usual_tab_behavior = function (e, target) {
Function init
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init: function (section, method, options) {
Foundation.inherit(this, 'add_custom_rule register_media throttle');
var self = this;
self.register_media('topbar', 'foundation-mq-topbar');
Function _base
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_base : function (t, s) {
var o_p = this.offsetParent(),
o = o_p.offset(),
p = t.offset();
Function events
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
events : function () {
var self = this,
S = self.S,
settings = self.settings;
Function is_sticky
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
is_sticky: function (topbar, topbarContainer, settings) {
var sticky = topbarContainer.hasClass(settings.sticky_class);
var smallMatch = matchMedia(Foundation.media_queries.small).matches;
var medMatch = matchMedia(Foundation.media_queries.medium).matches;
var lrgMatch = matchMedia(Foundation.media_queries.large).matches;
Function close
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
close : function (modal) {
var modal = modal && modal.length ? modal : this.S(this.scope),
open_modals = this.S('[' + this.attr_name() + '].open'),
settings = modal.data(this.attr_name(true) + '-init') || this.settings,
self = this;
Function assemble
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
assemble: function (topbar) {
var self = this,
settings = topbar.data(this.attr_name(true) + '-init'),
section = self.S('section, .top-bar-section', topbar);
Function webforms
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function webforms() {
/*>>input*/
// Run through HTML5's new input attributes to see if the UA understands any.
// We're using f which is the <input> element created early on
// Mike Taylr has created a comprehensive resource for testing these attributes
Function adjust_pip
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
adjust_pip : function (dropdown, target, settings, position) {
var sheet = Foundation.stylesheet,
pip_offset_base = 8;
if (dropdown.hasClass(settings.mega_class)) {
Function resize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
resize: function () {
var self = this;
self.S('[' + this.attr_name() + ']').each(function () {
var topbar = self.S(this),
settings = topbar.data(self.attr_name(true) + '-init');
Method index
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def index
@start_date = (params[:date].try(:in_time_zone, Time.zone) || Time.current).beginning_of_week
@matches = Match.unscoped.with_clubs.includes(:pick_ems).where(kickoff: (@start_date..@start_date + 7.days)).order(kickoff: :asc, location: :asc)
@prev_link = "Previous #{'Game ' if @matches.empty?}Week"
@next_link = "Next #{'Game ' if @matches.empty?}Week"
- 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 build_markup
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
self.build_markup = function () {
slides_container.wrap('<div class="' + settings.container_class + '"></div>');
container = slides_container.parent();
slides_container.addClass(settings.slides_container_class);
Method sync
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def sync
year = Date.current > Date.current.end_of_year - 15.days ? Date.current.year + 1 : Date.current.year
uri = URI.parse("https://v3.football.api-sports.io/fixtures?league=253&season=#{year}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
Function injectElementWithStyles
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
injectElementWithStyles = function( rule, callback, nodes, testnames ) {
var style, ret, node, docOverflow,
div = document.createElement('div'),
// After page load injecting a fake body doesn't work so check if body exists