JS-Tech/resj

View on GitHub

Showing 18 of 33 total issues

Method search has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def search(params)
      query = Jbuilder.encode do |j|
        j.size 1000
        j.query do
          j.filtered do
Severity: Minor
Found in app/models/concerns/card_search.rb - About 4 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

Method search has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def search(params)
      query = Jbuilder.encode do |j|
        j.size 1000
        j.query do
          j.filtered do
Severity: Minor
Found in app/models/concerns/orator_search.rb - 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

Function _setGetCoord has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

   _setGetCoord: function() {
     var gmap = {
       map: null,
       geocoder: null,
       marker: null,
Severity: Major
Found in app/assets/javascripts/sitewide/google_map.js - About 2 hrs to fix

    Method default_settings has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def default_settings
        {
          number_of_replicas: 0,
          number_of_shards: 1,
          analysis: {
    Severity: Minor
    Found in app/models/concerns/es_settings.rb - About 1 hr to fix

      Method search has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def search(params)
            query = Jbuilder.encode do |j|
              j.size 1000
              j.query do
                j.filtered do
      Severity: Minor
      Found in app/models/concerns/subject_search.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 GoogleAnalytics has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      this.GoogleAnalytics = (function() {
        function GoogleAnalytics() {}
      
        GoogleAnalytics.load = function() {
          var firstScript, ga;
      Severity: Minor
      Found in app/assets/javascripts/sitewide/google_analytics.js - About 1 hr to fix

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

        this.GoogleAnalytics = (function() {
          function GoogleAnalytics() {}
        
          GoogleAnalytics.load = function() {
            var firstScript, ga;
        Severity: Minor
        Found in app/assets/javascripts/sitewide/google_analytics.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 multiSelect has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function multiSelect() {
        
          $("#email-select").multiSelect({
            selectableOptgroup: true,
            selectableHeader: "<input type='text' class='search-input' autocomplete='off'>",
        Severity: Minor
        Found in app/assets/javascripts/admin/multiselect.js - About 1 hr to fix

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

            tags: function() {
              $(".selectize-tags").selectize({
                delimiter: " ",
                valueField: "name",
                labelField: "name",
          Severity: Minor
          Found in app/assets/javascripts/sitewide/selectize.js - About 1 hr to fix

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

              _display: function() {
                // create map options
                var mapOptions = {
                  mapTypeId: google.maps.MapTypeId.PLAN
                };
            Severity: Minor
            Found in app/assets/javascripts/sitewide/google_map.js - About 1 hr to fix

              Method search has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def search(params)
                    query = Jbuilder.encode do |j|
                      j.size 1000
                      j.query do
                        j.filtered do
              Severity: Minor
              Found in app/models/concerns/card_search.rb - About 1 hr to fix

                Method search has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def search(params)
                      query = Jbuilder.encode do |j|
                        j.size 1000
                        j.query do
                          j.filtered do
                Severity: Minor
                Found in app/models/concerns/orator_search.rb - About 1 hr to fix

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

                      def subject_type(subject)
                          if subject.documents.count > 1
                              subject.documents.each{|a| return "dossier" unless a.extension[0..2].in?(Document::VIDEO_EXT)}
                              return "videos"
                          elsif subject.documents.last.extension[0..2].in?(Document::VIDEO_EXT)
                  Severity: Minor
                  Found in app/helpers/resources_helper.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

                  Function _setGetCoord has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                     _setGetCoord: function() {
                       var gmap = {
                         map: null,
                         geocoder: null,
                         marker: null,
                  Severity: Minor
                  Found in app/assets/javascripts/sitewide/google_map.js - 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def update
                          card = Card.find_by_id(params[:id])
                          success, card_user = Request.new(:user, user: current_user, card: card).answer(params[:validated])
                          if card && success
                              if params[:validated] == "true"
                  Severity: Minor
                  Found in app/controllers/users/affiliations_controller.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def update
                          user = User.users.find_by_id(params[:id])
                          success, card_user = Request.new(:card, user: user, card: @card).answer(params[:validated])
                          if user && success
                              if params[:validated] == "true"
                  Severity: Minor
                  Found in app/controllers/cards/affiliations_controller.rb - About 25 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 multiSelect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function multiSelect() {
                  
                    $("#email-select").multiSelect({
                      selectableOptgroup: true,
                      selectableHeader: "<input type='text' class='search-input' autocomplete='off'>",
                  Severity: Minor
                  Found in app/assets/javascripts/admin/multiselect.js - About 25 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_with_password has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update_with_password(params)
                      authenticated = authenticate(params[:current_password])
                      assign_attributes(params)
                      if valid? && authenticated
                        save
                  Severity: Minor
                  Found in app/models/users/user.rb - About 25 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