volontariat/voluntary_text_creation

View on GitHub

Showing 22 of 22 total issues

Method up has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def up
    MongoDatabaseCleaner.clean
    
    create_table :users do |t|
      t.string :name
Severity: Major
Found in dummy/db/migrate/20130606230121_create_schema.voluntary_engine.rb - About 6 hrs to fix

    Method create_from_table has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def create_from_table(model_name, table, extra = {})
        factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
        is_singular = model_name.to_s.singularize == model_name.to_s
        
        hashes = if is_singular
    Severity: Minor
    Found in dummy/features/step_definitions/factory_steps.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

    Method path_to has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def path_to(page_name)
        case page_name
    
        when /^the home\s?page$/
          '/'
    Severity: Minor
    Found in dummy/features/support/paths.rb - About 1 hr to fix

      Method down has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def down
          unless (Product::Recruiting rescue nil)
            create_table 'vacancies', force: true do |t|
              t.string   'type'
              t.integer  'project_id'

        Method create_from_table has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create_from_table(model_name, table, extra = {})
            factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
            is_singular = model_name.to_s.singularize == model_name.to_s
            
            hashes = if is_singular
        Severity: Minor
        Found in dummy/features/step_definitions/factory_steps.rb - About 1 hr to fix

          Method set_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def set_value(hash, attribute)
              value = hash[attribute]
              
              if value.match '@' 
                if eval(value)
          Severity: Minor
          Found in dummy/features/step_definitions/factory_steps.rb - About 55 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 set_project_defaults has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def set_project_defaults(attributes)
              attributes[:user_id] ||= @me.id if @me && !attributes[:user_id]
              attributes[:product_id] ||= @product.id if @product && !attributes[:product_id]
              attributes[:area_ids] ||= [Area.last.id] if Area.any? && !attributes[:area_ids]
            end
          Severity: Minor
          Found in dummy/features/step_definitions/project_steps.rb - About 45 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 2 locations. Consider refactoring.
          Open

          Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
            with_scope(parent) do
              field = find_field(field)
              field_value = (field.tag_name == 'textarea') ? field.text : field.value
              if field_value.respond_to? :should
          Severity: Minor
          Found in dummy/features/step_definitions/web_steps.rb and 1 other location - About 35 mins to fix
          dummy/features/step_definitions/web_steps.rb on lines 170..177

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

          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

          Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
            with_scope(parent) do
              field = find_field(field)
              field_value = (field.tag_name == 'textarea') ? field.text : field.value
              if field_value.respond_to? :should_not
          Severity: Minor
          Found in dummy/features/step_definitions/web_steps.rb and 1 other location - About 35 mins to fix
          dummy/features/step_definitions/web_steps.rb on lines 158..165

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

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

            def up
              Product.each do |product|
                next if product.klass_name.present?
                
                if product.name == 'Product'

          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

          Then /^I should see the following projects:$/ do |expected_table|
            rows = find('table').all('tr')
            table = rows.map { |r| r.all('th,td').map { |c| c.text.strip } }
            expected_table.diff!(table)
          Severity: Minor
          Found in dummy/features/step_definitions/project_steps.rb and 3 other locations - About 20 mins to fix
          dummy/features/step_definitions/product_steps.rb on lines 11..14
          dummy/features/step_definitions/story_steps.rb on lines 32..35
          dummy/features/step_definitions/task_steps.rb on lines 25..28

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

          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

          Then /^I should see the following products:$/ do |expected_table|
            rows = find('table').all('tr')
            table = rows.map { |r| r.all('th,td').map { |c| c.text.strip } }
            expected_table.diff!(table)
          Severity: Minor
          Found in dummy/features/step_definitions/product_steps.rb and 3 other locations - About 20 mins to fix
          dummy/features/step_definitions/project_steps.rb on lines 27..30
          dummy/features/step_definitions/story_steps.rb on lines 32..35
          dummy/features/step_definitions/task_steps.rb on lines 25..28

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

          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

          Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
            regexp = Regexp.new(regexp)
          
            if page.respond_to? :should
              page.should have_no_xpath('//*', :text => regexp)
          Severity: Minor
          Found in dummy/features/step_definitions/web_steps.rb and 1 other location - About 20 mins to fix
          dummy/features/step_definitions/web_steps.rb on lines 130..136

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

          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

          Then /^I should see the following tasks:$/ do |expected_table|
            rows = find('table').all('tr')
            table = rows.map { |r| r.all('th,td').map { |c| c.text.strip } }
            expected_table.diff!(table)
          Severity: Minor
          Found in dummy/features/step_definitions/task_steps.rb and 3 other locations - About 20 mins to fix
          dummy/features/step_definitions/product_steps.rb on lines 11..14
          dummy/features/step_definitions/project_steps.rb on lines 27..30
          dummy/features/step_definitions/story_steps.rb on lines 32..35

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

          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

          Then /^I should see the following stories:$/ do |expected_table|
            rows = find('table').all('tr')
            table = rows.map { |r| r.all('th,td').map { |c| c.text.strip } }
            expected_table.diff!(table)
          Severity: Minor
          Found in dummy/features/step_definitions/story_steps.rb and 3 other locations - About 20 mins to fix
          dummy/features/step_definitions/product_steps.rb on lines 11..14
          dummy/features/step_definitions/project_steps.rb on lines 27..30
          dummy/features/step_definitions/task_steps.rb on lines 25..28

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

          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

          Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
            regexp = Regexp.new(regexp)
          
            if page.respond_to? :should
              page.should have_xpath('//*', :text => regexp)
          Severity: Minor
          Found in dummy/features/step_definitions/web_steps.rb and 1 other location - About 20 mins to fix
          dummy/features/step_definitions/web_steps.rb on lines 148..154

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

          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

            create_table "projects_users", force: :cascade do |t|
              t.integer "project_id", limit: 4
              t.integer "user_id",    limit: 4
              t.string  "state",      limit: 255
            end
          Severity: Minor
          Found in dummy/db/schema.rb and 1 other location - About 15 mins to fix
          dummy/db/migrate/20151002142953_remove_roles_model.voluntary_engine.rb on lines 45..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 26.

          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

            create_table "lists", force: :cascade do |t|
              t.integer  "user_id",    limit: 4
              t.string   "name",       limit: 255
              t.datetime "created_at"
              t.datetime "updated_at"
          Severity: Minor
          Found in dummy/db/schema.rb and 1 other location - About 15 mins to fix
          dummy/db/schema.rb on lines 49..53

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

          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

              create_table "users_roles", force: :cascade do |t|
                t.integer "role_id", limit: 4
                t.integer "user_id", limit: 4
                t.string  "state",   limit: 255
              end
          dummy/db/schema.rb on lines 178..182

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

          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

            create_table "argument_topics", force: :cascade do |t|
              t.string   "name",       limit: 255
              t.text     "text",       limit: 65535
              t.datetime "created_at"
              t.datetime "updated_at"
          Severity: Minor
          Found in dummy/db/schema.rb and 1 other location - About 15 mins to fix
          dummy/db/schema.rb on lines 123..127

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

          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