joshsoftware/code-curiosity

View on GitHub

Showing 64 of 64 total issues

Function exports has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(api) {
  var validEnv = ['development', 'test', 'production']
  var currentEnv = api.env()
  var isDevelopmentEnv = api.env('development')
  var isProductionEnv = api.env('production')
Severity: Major
Found in babel.config.js - About 2 hrs to fix

    Function multiLineChart has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function multiLineChart(xAxis, users, contributions){
      $('#chart-container').highcharts({
        chart: {
          type: 'line'
        },
    Severity: Major
    Found in app/assets/javascripts/home.js - About 2 hrs to fix

      Function userTrendChart has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function userTrendChart(xAxis, commits, points, username) {
        $('#users-chart-container').highcharts({
          chart: {
            type: 'line'
          },
      Severity: Major
      Found in app/assets/javascripts/home.js - About 2 hrs to fix

        Function renderTokens has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function renderTokens(tokens, writer, context, template) {
            var buffer = '';
        
            // This function is used to render an artbitrary template
            // in the current context by higher-order functions.
        Severity: Major
        Found in app/assets/javascripts/mustache.js - About 2 hrs to fix

          Function init has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
                          var $element = $(element);
                          var config = ko.toJS(valueAccessor());
          
                          $element.multiselect(config);
          Severity: Major
          Found in app/assets/javascripts/bootstrap-multiselect.js - About 2 hrs to fix

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

                                $tag = $('<option/>').attr({
                                    value: option.value,
                                    label: option.label || option.value,
                                    title: option.title,
                                    selected: !!option.selected,
            Severity: Major
            Found in app/assets/javascripts/bootstrap-multiselect.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/bootstrap-multiselect.js on lines 1209..1215

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

            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

                                    $tag.append($('<option/>').attr({
                                        value: subOption.value,
                                        label: subOption.label || subOption.value,
                                        title: subOption.title,
                                        selected: !!subOption.selected,
            Severity: Major
            Found in app/assets/javascripts/bootstrap-multiselect.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/bootstrap-multiselect.js on lines 1219..1225

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

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

            function showPointsChart(round, all_points, user_points){
              var points = uniqueValues(all_points);
              var pointGroups = buildPointGroups(all_points);
              var profilePic = $('#profile-pic').attr('src') + '&s=25';
              var tickInterval = 1;
            Severity: Minor
            Found in app/assets/javascripts/points_chart.js - About 1 hr to fix

              Function createOptionValue has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      createOptionValue: function(element) {
                          var $element = $(element);
                          if ($element.is(':selected')) {
                              $element.prop('selected', true);
                          }
              Severity: Minor
              Found in app/assets/javascripts/bootstrap-multiselect.js - About 1 hr to fix

                Function searchTimeout has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                        this.searchTimeout = this.asyncFunction($.proxy(function() {
                
                                            if (this.query !== event.target.value) {
                                                this.query = event.target.value;
                
                
                Severity: Minor
                Found in app/assets/javascripts/bootstrap-multiselect.js - About 1 hr to fix

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

                    def self.add_new(params, user)
                      repo = Repository.where(gh_id: params[:gh_id]).first
                  
                      if repo
                        repo.users << user unless repo.users.include?(user)
                  Severity: Minor
                  Found in app/models/repository.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

                                  $("option:enabled", this.$select).filter(function(index) {
                                      return $.inArray($(this).val(), values) !== -1;
                                  }).prop('selected', true);
                  Severity: Major
                  Found in app/assets/javascripts/bootstrap-multiselect.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/bootstrap-multiselect.js on lines 1141..1143

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

                  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

                                  $("option:enabled", this.$select).filter(function(index) {
                                      return $.inArray($(this).val(), values) !== -1;
                                  }).prop('selected', false);
                  Severity: Major
                  Found in app/assets/javascripts/bootstrap-multiselect.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/bootstrap-multiselect.js on lines 1113..1115

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

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

                          dataprovider: function(dataprovider) {
                              
                              var groupCounter = 0;
                              var $select = this.$select.empty();
                              
                  Severity: Minor
                  Found in app/assets/javascripts/bootstrap-multiselect.js - About 1 hr to fix

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

                            refresh: function() {
                                $('option', this.$select).each($.proxy(function(index, element) {
                                    var $input = $('li input', this.$ul).filter(function() {
                                        return $(this).val() === $(element).val();
                                    });
                    Severity: Minor
                    Found in app/assets/javascripts/bootstrap-multiselect.js - About 1 hr to fix

                      Method perform has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def perform(repo_owner: , repo_name: , branch_name: , **options)
                          from_date = options[:from_date].presence || Date.yesterday.beginning_of_day
                          to_date = options[:to_date].presence || Date.yesterday.end_of_day
                      
                          Sidekiq.logger.info "************************ Commit Job Logger Info **************************"
                      Severity: Minor
                      Found in app/jobs/fetch_commit_job.rb - About 1 hr to fix

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

                                    var attachClickHandler = function($elements) {
                                        $elements.on('click.barrating', function(event) {
                                            var $a = $(this),
                                                options = getData('userOptions'),
                                                value,
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.barrating.js - About 1 hr to fix

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

                                  buildSelectAll: function() {
                                      if (typeof this.options.selectAllValue === 'number') {
                                          this.options.selectAllValue = this.options.selectAllValue.toString();
                                      }
                                      
                          Severity: Minor
                          Found in app/assets/javascripts/bootstrap-multiselect.js - About 1 hr to fix

                            Method add_repo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def add_repo(gh_repo)
                                repo = Repository.new(name: gh_repo.name, owner: gh_repo.owner.login)
                                info = gh_repo.fork ? repo.info.source : gh_repo
                            
                                #check if the repository is not soft deleted and
                            Severity: Minor
                            Found in app/jobs/user_repos_job.rb - About 1 hr to fix

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

                                      select: function(selectValues, triggerOnChange) {
                                          if(!$.isArray(selectValues)) {
                                              selectValues = [selectValues];
                                          }
                              
                              
                              Severity: Minor
                              Found in app/assets/javascripts/bootstrap-multiselect.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language