panterch/ananas

View on GitHub

Showing 5 of 14 total issues

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

function initMaterialize() {
    $('form .datepicker').pickadate();
    $('.modal-trigger').leanModal();

    // collect splitted up date and time values and submit them in one
Severity: Minor
Found in app/assets/javascripts/materialize-adaptions.js - About 1 hr to fix

    Method initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def initialize(user)
    
        can :read, Mentor
        can :read, Event, mentor_id: nil, team_id: nil
        can :read, Team
    Severity: Minor
    Found in app/models/ability.rb - About 1 hr to fix

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

      function initImagePreviewInput() {
      
          function readURL() {
              if (this.files && this.files[0]) {
                  var name = this.name;
      Severity: Minor
      Found in app/assets/javascripts/image-preview-input.js - About 1 hr to fix

        Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def initialize(user)
        
            can :read, Mentor
            can :read, Event, mentor_id: nil, team_id: nil
            can :read, Team
        Severity: Minor
        Found in app/models/ability.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            # Don't try to update password if not provided
            if user_params[:password].blank?
              [:password, :password_confirmation].collect{|p| user_params.delete(p) }
            end
        Severity: Minor
        Found in app/controllers/users_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

        Severity
        Category
        Status
        Source
        Language