shuoyao/BirdGo

View on GitHub

Showing 169 of 169 total issues

Function markTheseDataWithoutClearingBefore has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function markTheseDataWithoutClearingBefore(data) {
  map = document.map
  console.log(data)

  for (var i = 0; i < data.length; i++) {
Severity: Minor
Found in app/assets/javascripts/explorer/init_map.js - About 1 hr to fix

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

            var marker = new google.maps.Marker({
              position: {lat: parseFloat(abird.lat), lng: parseFloat(abird.lng)},
              map: map,
              icon: 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png'
            });
    Severity: Major
    Found in app/assets/javascripts/explorer/init_map.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/explorer/init_map.js on lines 148..152

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

    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

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

          var marker = new google.maps.Marker({
            position: {lat: parseFloat(abird.lat), lng: parseFloat(abird.lng)},
            map: map,
            icon: 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png'
          });
    Severity: Major
    Found in app/assets/javascripts/explorer/init_map.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/explorer/init_map.js on lines 106..110

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

    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

    Consider simplifying this complex logical expression.
    Open

        if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
    
            // Trust units reported by jQuery.css
            unit = unit || initialInUnit[ 3 ];
    
    

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

              if ( jQuery.isFunction( value ) ) {
                  return this.each( function( j ) {
                      jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
                  } );
              }
      public/assets/application-b34af937661b1e622cea2d933ff65194efa8c7968c100e4a1364a2a317ea4460.js on lines 8851..8855

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

      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

              if ( jQuery.isFunction( value ) ) {
                  return this.each( function( j ) {
                      jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
                  } );
              }
      public/assets/application-b34af937661b1e622cea2d933ff65194efa8c7968c100e4a1364a2a317ea4460.js on lines 8813..8817

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

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

          data: function( key, value ) {
              var i, name, data,
                  elem = this[ 0 ],
                  attrs = elem && elem.attributes;
      
      

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

        function initMap() {
          if (document.geoReady == undefined) {
            return;
          }
          var map = new google.maps.Map(document.getElementById('map'), {
        Severity: Minor
        Found in app/assets/javascripts/explorer/init_map.js - About 1 hr to fix

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

              addClickEvents: function () {
                  var base = this;
                  
                  base.hidePassword.on("click", function (e) {
                      var $this = $(this),

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

            function fixCloneNodeIssues( src, dest ) {
                var nodeName, e, data;
            
                // We do not need to do anything for non-Elements
                if ( dest.nodeType !== 1 ) {

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

                  cleanData: function( elems, /* internal */ forceAcceptData ) {
                      var elem, type, id, data,
                          i = 0,
                          internalKey = jQuery.expando,
                          cache = jQuery.cache,

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

                    addClickEvents: function () {
                        var base = this;
                        
                        base.hidePassword.on("click", function (e) {
                            var $this = $(this),
                Severity: Minor
                Found in app/assets/javascripts/users/sessions/new.html.js - About 1 hr to fix

                  Method view has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def view
                          search = params[:search] != "" ? params[:search] : nil
                          if search != nil
                              bird = Bird.where('name LIKE ?', "%#{search}%").first
                              search_result = bird ? Pin.where(bird_id: bird.id) : nil
                  Severity: Minor
                  Found in app/controllers/explore_controller.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

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

                  function fetchDataAtLocationAndShowWithoutClearingBefore(url) {
                    $.ajax({
                      url: url,
                      method: "GET",
                      // "BirdGo.com/eBirdData/NearesrBIrds/lng=xxx&lat=xxx&r=xxx&t=xxx"
                  Severity: Major
                  Found in app/assets/javascripts/explorer/init_map.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/explorer/init_map.js on lines 38..49

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

                  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

                  function fetchDataAtLocationAndShow(url) {
                    $.ajax({
                      url: url,
                      method: "GET",
                      // "BirdGo.com/eBirdData/NearesrBIrds/lng=xxx&lat=xxx&r=xxx&t=xxx"
                  Severity: Major
                  Found in app/assets/javascripts/explorer/init_map.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/explorer/init_map.js on lines 51..62

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

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

                      removeClass: function( value ) {
                          var classes, elem, cur, curValue, clazz, j, finalValue,
                              i = 0;
                  
                          if ( jQuery.isFunction( value ) ) {

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

                    jQuery.ready.promise = function( obj ) {
                        if ( !readyList ) {
                    
                            readyList = jQuery.Deferred();
                    
                    

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

                          handlers: function( event, handlers ) {
                              var i, matches, sel, handleObj,
                                  handlerQueue = [],
                                  delegateCount = handlers.delegateCount,
                                  cur = event.target;

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

                            attr: function( elem, name, value ) {
                                var ret, hooks,
                                    nType = elem.nodeType;
                        
                                // Don't get/set attributes on text, comment and attribute nodes

                          Function html has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              html: function( value ) {
                                  return access( this, function( value ) {
                                      var elem = this[ 0 ] || {},
                                          i = 0,
                                          l = this.length;
                            Severity
                            Category
                            Status
                            Source
                            Language