AgileVentures/WebsiteOne

View on GitHub

Showing 197 of 206 total issues

Function css has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var css = (function() {
    var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
        cssProps    = {};

    function camelCase(string) {
Severity: Minor
Found in app/assets/javascripts/nprogress.js - About 1 hr to fix

Function getClassNames has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        getClassNames: function(date){
            var cls = [],
                year = this.viewDate.getUTCFullYear(),
                month = this.viewDate.getUTCMonth(),
                today = UTCToday();
Severity: Minor
Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

Function DateArray has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var DateArray = (function(){
        var extras = {
            get: function(i){
                return this.slice(i)[0];
            },
Severity: Minor
Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

Function datepickerPlugin has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var datepickerPlugin = function(option){
        var args = Array.apply(null, arguments);
        args.shift();
        var internal_return;
        this.each(function(){
Severity: Minor
Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

Function moveMonth has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        moveMonth: function(date, dir){
            if (!isValidDate(date))
                return this.o.defaultViewDate;
            if (!dir)
                return date;
Severity: Minor
Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

Function WebsiteOne has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  (function() {
    var modules = [],
      newPageLoaded = false,
      runOnceCallbacks = {},
      moduleFactories = {};
Severity: Minor
Found in app/assets/javascripts/websiteone.js - About 1 hr to fix

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 Typeahead has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function Typeahead(o, www) {
            var onFocused, onBlurred, onEnterKeyed, onTabKeyed, onEscKeyed, onUpKeyed, onDownKeyed, onLeftKeyed, onRightKeyed, onQueryChanged, onWhitespaceChanged;
            o = o || {};
            if (!o.input) {
                $.error("missing input");
Severity: Minor
Found in app/assets/javascripts/typeahead.jquery.js - About 1 hr to fix

Function EventBus has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var EventBus = function() {
        "use strict";
        var namespace, deprecationMap;
        namespace = "typeahead:";
        deprecationMap = {
Severity: Minor
Found in app/assets/javascripts/typeahead.jquery.js - About 1 hr to fix

Function update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            update: function update(query) {
                var that = this, canceled = false, syncCalled = false, rendered = 0;
                this.cancel();
                this.cancel = function cancel() {
                    canceled = true;
Severity: Minor
Found in app/assets/javascripts/typeahead.jquery.js - About 1 hr to fix

Function hightlight has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        return function hightlight(o) {
            var regex;
            o = _.mixin({}, defaults, o);
            if (!o.node || !o.pattern) {
                return;
Severity: Minor
Found in app/assets/javascripts/typeahead.jquery.js - About 1 hr to fix

Function updateNavArrows has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        updateNavArrows: function(){
            if (!this._allow_update)
                return;

            var d = new Date(this.viewDate),
Severity: Minor
Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

Function dateUpdated has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        dateUpdated: function(e){
            // `this.updating` is a workaround for preventing infinite recursion
            // between `changeDate` triggering and `setUTCDate` calling.  Until
            // there is a better mechanism.
            if (this.updating)
Severity: Minor
Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

Function set has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  NProgress.set = function(n) {
    var started = NProgress.isStarted();

    n = clamp(n, Settings.minimum, 1);
    NProgress.status = (n === 1 ? null : n);
Severity: Minor
Found in app/assets/javascripts/nprogress.js - About 1 hr to fix

Function Input has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function Input(o, www) {
            var id;
            o = o || {};
            if (!o.input) {
                $.error("input is missing");
Severity: Minor
Found in app/assets/javascripts/typeahead.jquery.js - About 1 hr to fix

Method update_user_commit_counts_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def update_user_commit_counts_for(project)
    contributors = get_contributor_stats(project.github_repo)

    contributors.map do |contributor|
      user = User.find_by_github_username(contributor.author.login)
Severity: Minor
Found in app/jobs/github_commits_job.rb - About 1 hr to fix

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

Method display_countdown has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def display_countdown(event)
    time_to_next_event_instance = Time.now.to_datetime.distance_to(event.next_occurrence_time_attr.to_datetime)
    minutes_left = time_to_next_event_instance[:minutes]
    hours_left = time_to_next_event_instance[:hours]
    days_left = time_to_next_event_instance[:days]
Severity: Minor
Found in app/helpers/visitors_helper.rb - About 1 hr to fix

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 AffixedNavbar has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function AffixedNavbar() {
    var isAffixed, affixedNav, header, main, footer, thresholdTop,
        isListening = false;

    this.onScroll = function() {
Severity: Minor
Found in app/assets/javascripts/global-modules/affix_navbar.js - About 1 hr to fix

Function formatDate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        formatDate: function(date, format, language){
            if (!date)
                return '';
            if (typeof format === 'string')
                format = DPGlobal.parseFormat(format);
Severity: Minor
Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix

Function _fill_yearsView has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        _fill_yearsView: function(selector, cssClass, factor, year, startYear, endYear, beforeFn){
Severity: Major
Found in app/assets/javascripts/bootstrap-datepicker.js - About 50 mins to fix

Avoid deeply nested control flow statements.
Open

            if (e.keyCode === 38 || e.keyCode === 40) {
              dir = dir * 4;
            }
Severity: Major
Found in app/assets/javascripts/bootstrap-datepicker.js - About 45 mins to fix
Severity
Category
Status
Source
Language