assemblymade/coderwall

View on GitHub

Showing 189 of 189 total issues

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

  def replace_assignments_and_awards(github_usernames, badge_class)
    competition_end_date = Date.parse(@end_date)
    tags                 = ['hackathon', 'nodejs', 'award', 'nodeknockout']
    metadata             = {
      award: badge_class.name
Severity: Minor
Found in app/badges/node_knockout.rb and 1 other location - About 55 mins to fix
app/badges/node_knockout.rb on lines 66..72

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

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

  def build_speakerdeck_facts
    Rails.logger.info("[FACTS] Building SpeakerDeck facts for #{username}")
    begin
      if speakerdeck_identity
        Speakerdeck.new(speakerdeck).facts
Severity: Major
Found in app/models/concerns/user_facts.rb and 2 other locations - About 55 mins to fix
app/models/concerns/user_facts.rb on lines 29..40
app/models/concerns/user_facts.rb on lines 43..54

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

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

  def build_slideshare_facts
    Rails.logger.info("[FACTS] Building SlideShare facts for #{username}")
    begin
      if slideshare_identity
        Slideshare.new(slideshare).facts
Severity: Major
Found in app/models/concerns/user_facts.rb and 2 other locations - About 55 mins to fix
app/models/concerns/user_facts.rb on lines 15..26
app/models/concerns/user_facts.rb on lines 43..54

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

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

  def build_lanyrd_facts
    Rails.logger.info("[FACTS] Building Lanyrd facts for #{username}")
    begin
      if lanyrd_identity
        Lanyrd.new(twitter).facts
Severity: Major
Found in app/models/concerns/user_facts.rb and 2 other locations - About 55 mins to fix
app/models/concerns/user_facts.rb on lines 15..26
app/models/concerns/user_facts.rb on lines 29..40

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

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 append! has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def self.append!(identity, owner, name, date, url, tags, metadata = nil)
Severity: Major
Found in app/models/fact.rb - About 50 mins to fix

    Method visitor_data has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def visitor_data(exit_url, exit_target_type, furthest_scrolled, time_spent, user_id, visited_at, user)
    Severity: Major
    Found in app/models/team.rb - About 50 mins to fix

      Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(context, query=nil, scope=nil, sort=nil, facet=nil, options={})
      Severity: Minor
      Found in app/structs/search.rb - About 45 mins to fix

        Method get_jobs_for has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_jobs_for(chosen_location, tag, page, query = nil, remote_allowed = false)
            scope = Opportunity
        
            escaped_query = query.nil? ? query : Regexp.escape(query)
        
        
        Severity: Minor
        Found in app/controllers/opportunities_controller.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

        Avoid deeply nested control flow statements.
        Open

                expand_followers(user) unless user.nil?
        Severity: Major
        Found in app/structs/audience.rb - About 45 mins to fix

          Method event_audience has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def event_audience(event_type)
              audience = {}
              case event_type
              when :protip_view, :protip_upvote
                audience = Audience.user(self.author.id)
          Severity: Minor
          Found in app/models/protip.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

          Method expand_reach has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.expand_reach(user_or_team)
              audiences = []
              audiences.concat(expand_followers(user_or_team))
          
              if user_or_team.is_a?(Team)
          Severity: Minor
          Found in app/structs/audience.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

          Method index has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def index
              current_user.seen(:jobs) if signed_in?
              store_location! unless signed_in?
              chosen_location = (params[:location] || closest_to_user(current_user)).try(:titleize)
              chosen_location = nil if chosen_location == 'Worldwide'
          Severity: Minor
          Found in app/controllers/opportunities_controller.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

          Method add_skills_for_repo_facts! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def add_skills_for_repo_facts!
              repo_facts.each do |fact|
                fact.metadata[:languages].try(:each) do |language|
                  unless self.deleted_skill?(language)
                    skill = add_skill(language)
          Severity: Minor
          Found in app/models/concerns/user_facts.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

          Avoid deeply nested control flow statements.
          Open

                elsif target == :team_followers
                  team = Team.find(audience[target])
                  expand_followers(team) unless team.nil?
                elsif target == :all
                  expand_all_users
          Severity: Major
          Found in app/structs/audience.rb - About 45 mins to fix

            Method perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def perform(user_id, protip_ids, from, to)
                fail "Only #{protip_ids.count} protips but expected 10" unless protip_ids.count == 10
            
                begin
                  if REDIS.sismember(ProtipMailer::CAMPAIGN_ID, user_id.to_s)
            Severity: Minor
            Found in app/workers/protip_mailer_popular_protips_send_worker.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

            Method create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                @user = User.for_omniauth(oauth)
            
                ucp = user_create_params.dup
            
            
            Severity: Minor
            Found in app/controllers/users_controller.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

            Method record_exit has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def record_exit(viewer, exit_url, exit_target_type, furthest_scrolled, time_spent)
            Severity: Minor
            Found in app/models/concerns/team_analytics.rb - About 35 mins to fix

              Method search_top_trending_since has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def search_top_trending_since(query, since, tags, page = 1, per_page = 10)
              Severity: Minor
              Found in app/models/protip.rb - About 35 mins to fix

                Method get_jobs_for has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def get_jobs_for(chosen_location, tag, page, query = nil, remote_allowed = false)
                Severity: Minor
                Found in app/controllers/opportunities_controller.rb - About 35 mins to fix

                  Method user_activity has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def user_activity(user, from, to, limit, publish=false)
                  Severity: Minor
                  Found in app/structs/event.rb - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language