lighthouse-labs/laser_shark

View on GitHub

Showing 27 of 46 total issues

File jquery.raty.js has 574 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jQuery Raty - A Star Rating Plugin
 *
 * The MIT License
 *
Severity: Major
Found in app/assets/javascripts/jquery.raty.js - About 1 day to fix

    Function gCalReader has 119 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      $.fn.gCalReader = function(options) {
        var $div = $(this);
    
        var defaults = $.extend({
            calendarId: 'en.canadian#holiday@group.v.calendar.google.com',
    Severity: Major
    Found in app/assets/javascripts/calendar_index.js - About 4 hrs to fix

      RequestQueue has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      var RequestQueue = React.createClass({
      
        propTypes: {
          locations: React.PropTypes.array.isRequired,
          user: React.PropTypes.object.isRequired
      Severity: Minor
      Found in app/assets/javascripts/components/request_queue.js.jsx - About 2 hrs to fix

        File request_queue.js.jsx has 273 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var RequestQueue = React.createClass({
        
          propTypes: {
            locations: React.PropTypes.array.isRequired,
            user: React.PropTypes.object.isRequired
        Severity: Minor
        Found in app/assets/javascripts/components/request_queue.js.jsx - About 2 hrs to fix

          Function subscribeToSocket has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            subscribeToSocket: function() {
              var that = this;
              if(App.assistance)
                App.assistance.unsubscribe();
          
          
          Severity: Major
          Found in app/assets/javascripts/components/request_queue.js.jsx - About 2 hrs to fix

            Function value has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                value: function(target) {
                  'use strict';
                  if (target === undefined || target === null) {
                    throw new TypeError('Cannot convert first argument to object');
                  }
            Severity: Minor
            Found in app/assets/javascripts/polyfills/object_assign.js - About 2 hrs 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

            Class User has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class User < ActiveRecord::Base
            
              mount_uploader :custom_avatar, CustomAvatarUploader
            
              belongs_to :cohort
            Severity: Minor
            Found in app/models/user.rb - About 2 hrs to fix

              Function render has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render: function() {
                  var assistance = this.props.assistance;
              
                  if(assistance)
                    var assistanceRequest = assistance.assistance_request;
              Severity: Minor
              Found in app/assets/javascripts/components/request_modal.js.jsx - About 1 hr to fix

                Function toggle has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    toggle: function(trigger, element, event) {
                      if (event) {
                        event.preventDefault();
                      }
                
                
                Severity: Minor
                Found in app/assets/javascripts/readmore.js - About 1 hr to fix

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

                    render: function() {
                      var assistance = this.props.assistance;
                      var assistanceRequest = assistance.assistance_request;
                      var activitySubmission = assistanceRequest.activity_submission;
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/components/assistance.js.jsx - About 1 hr to fix

                    Function render has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      , render: function(){
                          var then = (new Date(this.props.date)).valueOf()
                          var now = Date.now()
                          var seconds = Math.round(Math.abs(now-then)/1000)
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/components/timeago.js - About 1 hr to fix

                      Function init has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          init: function() {
                            var $this = this,
                                current = $(this.element);
                      
                            current.data({
                      Severity: Minor
                      Found in app/assets/javascripts/readmore.js - About 1 hr to fix

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

                            init: function(options) {
                              return this.each(function() {
                                this.self = $(this);
                        
                                methods.destroy.call(this.self);
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.raty.js - About 1 hr to fix

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

                                received: function(data) {
                                  switch(data.type) {
                                    case "AssistanceRequest":
                                      that.handleAssistanceRequest(data.object);
                                      break;
                          Severity: Minor
                          Found in app/assets/javascripts/components/request_queue.js.jsx - About 1 hr to fix

                            Function renderLocations has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              renderLocations: function() {
                                var that = this;
                            
                                if(this.props.user.location)
                                  return (
                            Severity: Minor
                            Found in app/assets/javascripts/components/request_queue.js.jsx - About 1 hr to fix

                              Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                , render: function(){
                                    var then = (new Date(this.props.date)).valueOf()
                                    var now = Date.now()
                                    var seconds = Math.round(Math.abs(now-then)/1000)
                              
                              
                              Severity: Minor
                              Found in app/assets/javascripts/components/timeago.js - About 45 mins 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 tick has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                , tick: function(refresh){
                                    if(!this.isMounted() || !this.props.live){
                                      return
                                    }
                              
                              
                              Severity: Minor
                              Found in app/assets/javascripts/components/timeago.js - About 45 mins 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 subscribeToSocket has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                subscribeToSocket: function() {
                                  var that = this;
                                  if(App.assistance)
                                    App.assistance.unsubscribe();
                              
                              
                              Severity: Minor
                              Found in app/assets/javascripts/components/request_queue.js.jsx - About 45 mins 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 unlocked? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def unlocked?
                                  return true if @date == 'setup'
                                  return true if unlock_weekend_on_friday
                                  return false unless @cohort
                                  return false if @cohort.start_date > Date.current
                              Severity: Minor
                              Found in app/models/curriculum_day.rb - About 45 mins 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 day has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def day
                                  return @day if @day
                                  d = params[:number] || params[:day_number]
                                  @day = case d
                                  when 'today'
                              Severity: Minor
                              Found in app/controllers/concerns/course_calendar.rb - About 35 mins 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

                              Severity
                              Category
                              Status
                              Source
                              Language