codeRIT/hackathon_manager

View on GitHub

Showing 147 of 151 total issues

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

    const Admissions = () => (
      <Block>
        {[
          {
            content:
Severity: Major
Found in website/pages/en/index.js and 2 other locations - About 1 hr to fix
website/pages/en/index.js on lines 173..185
website/pages/en/index.js on lines 201..213

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

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 3 locations. Consider refactoring.
Open

    const MyMLHSupport = () => (
      <Block>
        {[
          {
            content:
Severity: Major
Found in website/pages/en/index.js and 2 other locations - About 1 hr to fix
website/pages/en/index.js on lines 145..157
website/pages/en/index.js on lines 201..213

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

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 display_datetime has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
Open

  def display_datetime(datetime, opts = {})
    if datetime.blank?
      return ""
    end
    opts[:relative] = true if opts[:relative].nil?
Severity: Minor
Found in app/helpers/hackathon_manager_helper.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

Method data has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
Open

  def data
    records.map do |record|
      {
        id: record.id,
        link: link_to('<i class="fa fa-search"></i>'.html_safe, manage_user_path(record)),
Severity: Minor
Found in app/datatables/user_datatable.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 render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const {config: siteConfig} = this.props;
    if ((siteConfig.users || []).length === 0) {
      return null;
    }
Severity: Minor
Found in website/pages/en/users.js - About 1 hr to fix

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

      def schools_applied_data
        counted_schools = {
          "pending" => {},
          "denied" => {},
          "rsvp_denied" => {},
    Severity: Minor
    Found in app/controllers/manage/dashboard_controller.rb - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

          return true unless info["phone_number"].blank? || info["level_of_study"].blank? || info["major"].blank? ||
                             info["date_of_birth"].blank? || info["gender"].blank? || info["school"].blank? ||
                             info["school"]["name"].blank?
      Severity: Major
      Found in app/controllers/questionnaires_controller.rb - About 1 hr to fix

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

                  case 'email':
                    if (value) {
                      var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
                      if (!re.test(value)) {
                        notify(this, 'Invalid Email');
        Severity: Minor
        Found in app/assets/javascripts/validate.js and 1 other location - About 50 mins to fix
        app/assets/javascripts/validate.js on lines 38..46

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

        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

                  case 'phone':
                    if (value) {
                      var phoneReg = /^[\+]?[0-9]{0,3}[-\s\.]?[(]?[0-9]{1,3}[)]?[-\s\.]?[0-9]{1,3}[-\s\.]?[0-9]{4,6}$/;
                      if (!phoneReg.test(value)) {
                        notify(this, 'Please enter a valid phone number');
        Severity: Minor
        Found in app/assets/javascripts/validate.js and 1 other location - About 50 mins to fix
        app/assets/javascripts/validate.js on lines 29..37

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

        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

            def bs_horizontal_simple_form_for(path, options = {}, &block)
              bootstrap_options = {
                wrapper: :bootstrap_horizontal_form,
                wrapper_mappings: {
                  boolean:       :bootstrap_horizontal_boolean,
        Severity: Minor
        Found in app/helpers/manage/bootstrap_form_helper.rb and 1 other location - About 40 mins to fix
        app/helpers/manage/bootstrap_form_helper.rb on lines 3..19

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

        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

            def bs_vertical_simple_form(path, options = {}, &block)
              bootstrap_options = {
                wrapper: :bootstrap_vertical_form,
                wrapper_mappings: {
                  boolean:       :bootstrap_vertical_boolean,
        Severity: Minor
        Found in app/helpers/manage/bootstrap_form_helper.rb and 1 other location - About 40 mins to fix
        app/helpers/manage/bootstrap_form_helper.rb on lines 23..39

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

        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 bus_captain has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
        Open

          def bus_captain(record)
            return "No" unless record.bus_list_id?
            return record.is_bus_captain? ? '<span class="badge badge-success">Yes</span>' : "No" unless current_user.director?
        
            if record.is_bus_captain?
        Severity: Minor
        Found in app/datatables/questionnaire_datatable.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

        Method data has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
        Open

          def data
            records.map do |record|
              {
                id: record.id,
                name: link_to(bold(record.name), manage_message_path(record)),
        Severity: Minor
        Found in app/datatables/bulk_message_datatable.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

        Method new has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
        Open

          def new
            if current_user.questionnaire.present?
              return redirect_to questionnaires_path
            end
            @questionnaire = Questionnaire.new
        Severity: Minor
        Found in app/controllers/questionnaires_controller.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

        Method data has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
        Open

          def data
            records.map do |record|
              {
                id: record.id,
                link: link_to('<i class="fa fa-search"></i>'.html_safe, manage_user_path(record)),
        Severity: Minor
        Found in app/datatables/staff_datatable.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

        Method create has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
        Open

          def create
            create_params = questionnaire_params
            email = create_params.delete(:email)
            create_params = convert_school_name_to_id(create_params)
            create_params = convert_boarded_bus_param(create_params)
        Severity: Minor
        Found in app/controllers/manage/questionnaires_controller.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

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

          def view_columns
            @view_columns ||= {
              id: { source: "Questionnaire.id" },
              first_name: { source: "User.first_name" },
              last_name: { source: "User.last_name" },
        Severity: Major
        Found in app/datatables/applied_datatable.rb and 3 other locations - About 35 mins to fix
        app/datatables/alt_travel_datatable.rb on lines 4..14
        app/datatables/attendee_sponsor_info_datatable.rb on lines 4..14
        app/datatables/checked_in_datatable.rb on lines 4..14

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

        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 4 locations. Consider refactoring.
        Open

          def view_columns
            @view_columns ||= {
              id: { source: "Questionnaire.id" },
              first_name: { source: "User.first_name" },
              last_name: { source: "User.last_name" },
        Severity: Major
        Found in app/datatables/checked_in_datatable.rb and 3 other locations - About 35 mins to fix
        app/datatables/alt_travel_datatable.rb on lines 4..14
        app/datatables/applied_datatable.rb on lines 4..14
        app/datatables/attendee_sponsor_info_datatable.rb on lines 4..14

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

        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 4 locations. Consider refactoring.
        Open

          def view_columns
            @view_columns ||= {
              id: { source: "Questionnaire.id" },
              first_name: { source: "User.first_name" },
              last_name: { source: "User.last_name" },
        Severity: Major
        Found in app/datatables/alt_travel_datatable.rb and 3 other locations - About 35 mins to fix
        app/datatables/applied_datatable.rb on lines 4..14
        app/datatables/attendee_sponsor_info_datatable.rb on lines 4..14
        app/datatables/checked_in_datatable.rb on lines 4..14

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

        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 4 locations. Consider refactoring.
        Open

          def view_columns
            @view_columns ||= {
              id: { source: "Questionnaire.id" },
              first_name: { source: "User.first_name" },
              last_name: { source: "User.last_name" },
        Severity: Major
        Found in app/datatables/attendee_sponsor_info_datatable.rb and 3 other locations - About 35 mins to fix
        app/datatables/alt_travel_datatable.rb on lines 4..14
        app/datatables/applied_datatable.rb on lines 4..14
        app/datatables/checked_in_datatable.rb on lines 4..14

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

        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