codeRIT/hackathon_manager

View on GitHub

Showing 147 of 151 total issues

File questionnaire.rb has 437 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Questionnaire < ApplicationRecord
  audited

  include ActiveModel::Dirty
  include DeletableAttachment
Severity: Minor
Found in app/models/questionnaire.rb - About 6 hrs to fix

    Function validate has 157 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      $.fn.validate = function(option) {
        var previous_invalid_inputs = [];
    
        var validateInput = function() {
          var success = true,
    Severity: Major
    Found in app/assets/javascripts/validate.js - About 6 hrs to fix

      Function render has 152 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const { config: siteConfig, language = '' } = this.props;
          const { baseUrl } = siteConfig;
      
          const Block = props => (
      Severity: Major
      Found in website/pages/en/index.js - About 6 hrs to fix

        Function setupDataTables has 133 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var setupDataTables = function () {
          $('.datatable.checkins').DataTable({
            order: [1, 'asc'],
            columns: [
              { orderable: true, data: 'first_name', visible: false },
        Severity: Major
        Found in app/assets/javascripts/manage/lib/setupDataTables.js - About 5 hrs to fix

          Function transform has a Cognitive Complexity of 28 (exceeds 7 allowed). Consider refactoring.
          Open

            transform: (commit, context) => {
              let discard = true;
              const issues = [];
          
              commit.notes.forEach(note => {
          Severity: Minor
          Found in release.config.js - About 3 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 check_in has a Cognitive Complexity of 27 (exceeds 7 allowed). Consider refactoring.
          Open

            def check_in
              respond_to do |format|
                format.json do
                  if params[:check_in] == "true"
                    check_in_attendee
          Severity: Minor
          Found in app/controllers/manage/questionnaires_controller.rb - About 3 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 validateInput has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var validateInput = function() {
                var success = true,
                  types = $(this)
                    .data('validate')
                    .split(/[ ,]+/),
          Severity: Major
          Found in app/assets/javascripts/validate.js - About 3 hrs to fix

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

                  const showcase = siteConfig.users.map(user => (
                    <a href={user.infoLink} key={user.infoLink}>
                      <img src={user.image} alt={user.caption} title={user.caption} />
                    </a>
                  ));
            Severity: Major
            Found in website/pages/en/index.js and 1 other location - About 3 hrs to fix
            website/pages/en/users.js on lines 22..26

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

            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

                const showcase = siteConfig.users.map(user => (
                  <a href={user.infoLink} key={user.infoLink}>
                    <img src={user.image} alt={user.caption} title={user.caption} />
                  </a>
                ));
            Severity: Major
            Found in website/pages/en/users.js and 1 other location - About 3 hrs to fix
            website/pages/en/index.js on lines 220..224

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

            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

                columns: [
                  { orderable: true, data: 'id', visible: false },
                  { orderable: true, data: 'first_name' },
                  { orderable: true, data: 'last_name' },
                  { orderable: true, data: 'email' },
            Severity: Major
            Found in app/assets/javascripts/manage/lib/setupDataTables.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/manage/lib/setupDataTables.js on lines 116..124

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

            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

                columns: [
                  { orderable: true, data: 'id', visible: false },
                  { orderable: true, data: 'first_name' },
                  { orderable: true, data: 'last_name' },
                  { orderable: true, data: 'email' },
            Severity: Major
            Found in app/assets/javascripts/manage/lib/setupDataTables.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/manage/lib/setupDataTables.js on lines 142..150

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

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

              transform: (commit, context) => {
                let discard = true;
                const issues = [];
            
                commit.notes.forEach(note => {
            Severity: Major
            Found in release.config.js - About 2 hrs to fix

              Function wizard has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                $.fn.wizard = function() {
                  var form = this;
              
                  var goToStage = function($newStage) {
                    $(form)
              Severity: Major
              Found in app/assets/javascripts/wizard.js - About 2 hrs to fix

                Method generate__sponsor_dump has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def generate__sponsor_dump(data_export, attendee_type)
                    print data_export.file.name
                
                    case attendee_type
                    when "rsvp_confirmed"
                Severity: Major
                Found in app/jobs/generate_data_export_job.rb - About 2 hrs to fix

                  Block has too many lines. [50/25]
                  Open

                      Dir.mktmpdir("data-export") do |dir|
                        folder_path = File.join(dir, data_export.file_basename)
                        Dir.mkdir(folder_path)
                        zipfile_name = "#{data_export.file_basename}.zip"
                        zipfile_path = File.join(dir, zipfile_name)

                  This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

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

                  $.fn.initMap = function() {
                    if (!this || this.length == 0) {
                      return;
                    }
                  
                  
                  Severity: Major
                  Found in app/assets/javascripts/manage/map.js - About 2 hrs to fix

                    Function render has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render() {
                        const { siteConfig, language = '' } = this.props;
                        const { baseUrl, docsUrl } = siteConfig;
                        const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
                        const langPart = `${language ? `${language}/` : ''}`;
                    Severity: Major
                    Found in website/pages/en/index.js - About 2 hrs to fix

                      Function bulkRowEdit has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      $.fn.bulkRowEdit = function() {
                        var applyAction = function() {
                          $('[type=submit][data-bulk-row-edit]').prop('disabled', true);
                      
                          var ids = [];
                      Severity: Minor
                      Found in app/assets/javascripts/manage/lib/jquery.bulkRowedit.js - About 2 hrs to fix

                        Perceived complexity for check_in is too high. [12/10]
                        Open

                          def check_in
                            respond_to do |format|
                              format.json do
                                if params[:check_in] == "true"
                                  check_in_attendee

                        This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

                        Example:

                        def my_method                   # 1
                          if cond                       # 1
                            case var                    # 2 (0.8 + 4 * 0.2, rounded)
                            when 1 then func_one
                            when 2 then func_two
                            when 3 then func_three
                            when 4..10 then func_other
                            end
                          else                          # 1
                            do_something until a && b   # 2
                          end                           # ===
                        end                             # 7 complexity points

                        Cyclomatic complexity for activity_chart_data is too high. [11/10]
                        Open

                          def activity_chart_data(types, group_type, range, where_filter = nil)
                            chart_data = []
                            types.each do |type|
                              case type
                              when "Applications"

                        This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

                        An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

                        Severity
                        Category
                        Status
                        Source
                        Language