mhuggins/a2z

View on GitHub

Showing 9 of 17 total issues

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

          if data['HTTPHeaders'] && data['HTTPHeaders']['Header']
            headers = array_wrap(data['HTTPHeaders']['Header'])
            headers = headers.collect { |h| [ h['Name'], h['Value'] ] }
            operation_request.headers = Hash[headers]
          end
Severity: Minor
Found in lib/a2z/responses/operation_request.rb and 1 other location - About 35 mins to fix
lib/a2z/responses/operation_request.rb on lines 24..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 35.

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

          if data['Arguments'] && data['Arguments']['Argument']
            arguments = array_wrap(data['Arguments']['Argument'])
            arguments = arguments.collect { |a| [ a['Name'], a['Value'] ] }
            operation_request.arguments = Hash[arguments]
          end
Severity: Minor
Found in lib/a2z/responses/operation_request.rb and 1 other location - About 35 mins to fix
lib/a2z/responses/operation_request.rb on lines 18..22

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

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

            if data['Children'] && data['Children']['BrowseNode']
              children = array_wrap(data['Children']['BrowseNode'])
              browse_node.children = children.collect { |child| BrowseNode.from_response(child) }
            end
Severity: Minor
Found in lib/a2z/responses/browse_node.rb and 4 other locations - About 20 mins to fix
lib/a2z/responses/browse_node.rb on lines 43..46
lib/a2z/responses/item.rb on lines 62..65
lib/a2z/responses/item.rb on lines 79..82
lib/a2z/responses/item.rb on lines 84..87

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

          if data['Offers'] && data['Offers']['Offer']
            offers = array_wrap(data['Offers']['Offer'])
            item.offers = offers.collect { |offer| Offer.from_response(offer) }
          end
Severity: Minor
Found in lib/a2z/responses/item.rb and 4 other locations - About 20 mins to fix
lib/a2z/responses/browse_node.rb on lines 38..41
lib/a2z/responses/browse_node.rb on lines 43..46
lib/a2z/responses/item.rb on lines 62..65
lib/a2z/responses/item.rb on lines 79..82

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

          if data['ItemLinks'] && data['ItemLinks']['ItemLink']
            item_links = array_wrap(data['ItemLinks']['ItemLink'])
            item.links = item_links.collect { |link| ItemLink.from_response(link) }
          end
Severity: Minor
Found in lib/a2z/responses/item.rb and 4 other locations - About 20 mins to fix
lib/a2z/responses/browse_node.rb on lines 38..41
lib/a2z/responses/browse_node.rb on lines 43..46
lib/a2z/responses/item.rb on lines 79..82
lib/a2z/responses/item.rb on lines 84..87

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

          if data['EditorialReviews'] && data['EditorialReviews']['EditorialReview']
            reviews = array_wrap(data['EditorialReviews']['EditorialReview'])
            item.editorial_reviews = reviews.collect { |review| EditorialReview.from_response(review) }
          end
Severity: Minor
Found in lib/a2z/responses/item.rb and 4 other locations - About 20 mins to fix
lib/a2z/responses/browse_node.rb on lines 38..41
lib/a2z/responses/browse_node.rb on lines 43..46
lib/a2z/responses/item.rb on lines 62..65
lib/a2z/responses/item.rb on lines 84..87

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

            if data['Ancestors'] && data['Ancestors']['BrowseNode']
              ancestors = array_wrap(data['Ancestors']['BrowseNode'])
              browse_node.ancestors = ancestors.collect { |ancestor| BrowseNode.from_response(ancestor) }
            end
Severity: Minor
Found in lib/a2z/responses/browse_node.rb and 4 other locations - About 20 mins to fix
lib/a2z/responses/browse_node.rb on lines 38..41
lib/a2z/responses/item.rb on lines 62..65
lib/a2z/responses/item.rb on lines 79..82
lib/a2z/responses/item.rb on lines 84..87

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

  module Responses
    class ItemLink
      attr_accessor :description, :url
      
      def self.from_response(data)
Severity: Minor
Found in lib/a2z/responses/item_link.rb and 1 other location - About 15 mins to fix
lib/a2z/responses/editorial_review.rb on lines 2..10

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

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

  module Responses
    class EditorialReview
      attr_accessor :source, :content
      
      def self.from_response(data)
Severity: Minor
Found in lib/a2z/responses/editorial_review.rb and 1 other location - About 15 mins to fix
lib/a2z/responses/item_link.rb on lines 2..10

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

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