JS-Tech/resj

View on GitHub

Showing 33 of 33 total issues

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

  users: function() {
    $(".selectize-users").selectize({
      valueField: "id",
      labelField: "full_name",
      searchField: "full_name",
Severity: Major
Found in app/assets/javascripts/sitewide/selectize.js and 1 other location - About 5 hrs to fix
app/assets/javascripts/sitewide/selectize.js on lines 60..81

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

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

  location: function() {
    $(".selectize-location").selectize({
      valueField: "id",
      labelField: "name",
      searchField: "name",
Severity: Major
Found in app/assets/javascripts/sitewide/selectize.js and 1 other location - About 5 hrs to fix
app/assets/javascripts/sitewide/selectize.js on lines 90..111

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

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

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

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

              that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
              .on("keydown", function(e){
                if (e.which === 40){
                  that.$selectableUl.focus();
                  return false;
        Severity: Major
        Found in app/assets/javascripts/admin/multiselect.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/admin/multiselect.js on lines 25..31

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

        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

              that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
              .on("keydown", function(e){
                if (e.which == 40){
                  that.$selectionUl.focus();
                  return false;
        Severity: Major
        Found in app/assets/javascripts/admin/multiselect.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/admin/multiselect.js on lines 17..23

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

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

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

              $scope.toggleFilter = function() {
                if($scope.filter === "fermer") {
                  $scope.filter = "voir";
                } else {
                  $scope.filter = "fermer";
            Severity: Major
            Found in app/assets/javascripts/sitewide/subjects/index.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/sitewide/orators/index.js on lines 7..13

            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

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

              $scope.toggleFilter = function() {
                if($scope.filter === "fermer") {
                  $scope.filter = "voir";
                } else {
                  $scope.filter = "fermer";
            Severity: Major
            Found in app/assets/javascripts/sitewide/orators/index.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/sitewide/subjects/index.js on lines 7..13

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

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

                  app.controller("admin/card_statuses#form", ["params", function(params) {
                  
                    google_map.display( [{ lat: params.lat ,lng: params.lng }] );
                  
                  }]);
                  Severity: Minor
                  Found in app/assets/javascripts/admin/card_statuses/form.js and 1 other location - About 55 mins to fix
                  app/assets/javascripts/admin/cards/show.js on lines 4..8

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

                  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

                  app.controller("admin/cards#show", ["params", function(params) {
                  
                    google_map.display( [{ lat: params.lat ,lng: params.lng }] );
                  
                  }]);
                  Severity: Minor
                  Found in app/assets/javascripts/admin/cards/show.js and 1 other location - About 55 mins to fix
                  app/assets/javascripts/admin/card_statuses/form.js on lines 4..8

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

                  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