lighthouse-labs/laser_shark

View on GitHub

Showing 46 of 46 total issues

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 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 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 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    <p className="assistance-timestamp">
                      Generated code review 
                      <abbr className="timeago" title="{codeReview.start_at}">
                        <TimeAgo date={codeReview.start_at} />
                      </abbr>
            Severity: Major
            Found in app/assets/javascripts/components/code_review.js.jsx and 1 other location - About 1 hr to fix
            app/assets/javascripts/components/request.js.jsx on lines 27..32

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 59.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    <p className="assistance-timestamp">
                      Requested assistance: 
                      <abbr className="timeago" title="{request.start_at}">
                        <TimeAgo date={request.start_at} />
                      </abbr>
            Severity: Major
            Found in app/assets/javascripts/components/request.js.jsx and 1 other location - About 1 hr to fix
            app/assets/javascripts/components/code_review.js.jsx on lines 47..52

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 59.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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 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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                  stopAssisting: function() {
                    this.setState({disabled: true})
                    App.assistance.stopAssisting(this.props.assistance)
                  },
                Severity: Major
                Found in app/assets/javascripts/components/assistance.js.jsx and 2 other locations - About 45 mins to fix
                app/assets/javascripts/components/code_review.js.jsx on lines 9..12
                app/assets/javascripts/components/request.js.jsx on lines 9..12

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 50.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                  startAssisting: function() {
                    this.setState({disabled: true})
                    App.assistance.startAssisting(this.props.request);
                  },
                Severity: Major
                Found in app/assets/javascripts/components/request.js.jsx and 2 other locations - About 45 mins to fix
                app/assets/javascripts/components/assistance.js.jsx on lines 62..65
                app/assets/javascripts/components/code_review.js.jsx on lines 9..12

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 50.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                  startAssisting: function() {
                    this.setState({disabled: true})
                    App.assistance.startAssisting(this.props.codeReview);
                  },
                Severity: Major
                Found in app/assets/javascripts/components/code_review.js.jsx and 2 other locations - About 45 mins to fix
                app/assets/javascripts/components/assistance.js.jsx on lines 62..65
                app/assets/javascripts/components/request.js.jsx on lines 9..12

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 50.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                Method create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create
                    @current_user = User.authenticate_via_github auth_hash_params
                    session[:user_id] = @current_user.id
                    cookies.signed[:user_id] = @current_user.id
                    if @current_user.completed_registration?
                Severity: Minor
                Found in app/controllers/sessions_controller.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

                Method commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def commit
                    return nil unless client
                    if @activity.revisions_gistid?
                      update
                    else
                Severity: Minor
                Found in lib/github/activity_revision.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

                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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      endAssistance: function(assistance, notes, rating) {
                        this.perform('end_assistance', {assistance_id: assistance.id, notes: notes, rating: rating})
                      },
                Severity: Minor
                Found in app/assets/javascripts/components/request_queue.js.jsx and 1 other location - About 30 mins to fix
                app/assets/javascripts/components/request_queue.js.jsx on lines 85..87

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 45.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language