gregbeech/xenon

View on GitHub

Showing 14 of 51 total issues

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

module Xenon
  class Headers
    # http://tools.ietf.org/html/rfc7232#section-3.2
    class IfNoneMatch < ListHeader 'If-None-Match'
      def initialize(*etags)
Severity: Major
Found in xenon-http/lib/xenon/headers/if_none_match.rb and 1 other location - About 3 hrs to fix
xenon-http/lib/xenon/headers/if_match.rb on lines 6..50

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

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 Xenon
  class Headers
    # http://tools.ietf.org/html/rfc7232#section-3.1
    class IfMatch < ListHeader 'If-Match'
      def initialize(*etags)
Severity: Major
Found in xenon-http/lib/xenon/headers/if_match.rb and 1 other location - About 3 hrs to fix
xenon-http/lib/xenon/headers/if_none_match.rb on lines 6..50

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

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

    class AcceptCharsetHeaderTransform < HeaderTransform
      rule(charset: simple(:c), q: simple(:q)) { CharsetRange.new(c, q) }
      rule(charset: simple(:c)) { CharsetRange.new(c) }
      rule(accept_charset: sequence(:cr)) { Headers::AcceptCharset.new(*cr) }
      rule(accept_charset: simple(:cr)) { Headers::AcceptCharset.new(cr) }
Severity: Minor
Found in xenon-http/lib/xenon/headers/accept_charset.rb and 1 other location - About 55 mins to fix
xenon-http/lib/xenon/headers/accept_language.rb on lines 52..56

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

    class AcceptLanguageHeaderTransform < HeaderTransform
      rule(language: simple(:e), q: simple(:q)) { LanguageRange.new(e, q) }
      rule(language: simple(:e)) { LanguageRange.new(e) }
      rule(accept_language: sequence(:lr)) { Headers::AcceptLanguage.new(*lr) }
      rule(accept_language: simple(:lr)) { Headers::AcceptLanguage.new(lr) }
Severity: Minor
Found in xenon-http/lib/xenon/headers/accept_language.rb and 1 other location - About 55 mins to fix
xenon-http/lib/xenon/headers/accept_charset.rb on lines 52..56

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

  class CharsetRange
    attr_reader :charset, :q

    DEFAULT_Q = 1.0

Severity: Major
Found in xenon-http/lib/xenon/headers/accept_charset.rb and 2 other locations - About 40 mins to fix
xenon-http/lib/xenon/headers/accept_encoding.rb on lines 5..22
xenon-http/lib/xenon/headers/accept_language.rb on lines 5..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 38.

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

  class LanguageRange
    attr_reader :language, :q

    DEFAULT_Q = 1.0

Severity: Major
Found in xenon-http/lib/xenon/headers/accept_language.rb and 2 other locations - About 40 mins to fix
xenon-http/lib/xenon/headers/accept_charset.rb on lines 5..22
xenon-http/lib/xenon/headers/accept_encoding.rb on lines 5..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 38.

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

  class ContentCodingRange
    attr_reader :coding, :q

    DEFAULT_Q = 1.0

Severity: Major
Found in xenon-http/lib/xenon/headers/accept_encoding.rb and 2 other locations - About 40 mins to fix
xenon-http/lib/xenon/headers/accept_charset.rb on lines 5..22
xenon-http/lib/xenon/headers/accept_language.rb on lines 5..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 38.

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

  class Headers
    # http://tools.ietf.org/html/rfc7231#section-5.3.3
    class AcceptCharset < ListHeader 'Accept-Charset'
      def initialize(*charset_ranges)
        super(charset_ranges.sort_by.with_index { |mr, i| [mr, -i] }.reverse)
Severity: Major
Found in xenon-http/lib/xenon/headers/accept_charset.rb and 3 other locations - About 35 mins to fix
xenon-http/lib/xenon/headers/accept.rb on lines 6..17
xenon-http/lib/xenon/headers/accept_encoding.rb on lines 26..37
xenon-http/lib/xenon/headers/accept_language.rb on lines 26..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 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

  class Headers
    # http://tools.ietf.org/html/rfc7231#section-5.3.2
    class Accept < ListHeader 'Accept'
      def initialize(*media_ranges)
        super(media_ranges.sort_by.with_index { |mr, i| [mr, -i] }.reverse)
Severity: Major
Found in xenon-http/lib/xenon/headers/accept.rb and 3 other locations - About 35 mins to fix
xenon-http/lib/xenon/headers/accept_charset.rb on lines 26..37
xenon-http/lib/xenon/headers/accept_encoding.rb on lines 26..37
xenon-http/lib/xenon/headers/accept_language.rb on lines 26..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 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

  class Headers
    # http://tools.ietf.org/html/rfc7231#section-5.3.4
    class AcceptEncoding < ListHeader 'Accept-Encoding'
      def initialize(*coding_ranges)
        super(coding_ranges.sort_by.with_index { |mr, i| [mr, -i] }.reverse)
Severity: Major
Found in xenon-http/lib/xenon/headers/accept_encoding.rb and 3 other locations - About 35 mins to fix
xenon-http/lib/xenon/headers/accept.rb on lines 6..17
xenon-http/lib/xenon/headers/accept_charset.rb on lines 26..37
xenon-http/lib/xenon/headers/accept_language.rb on lines 26..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 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

  class Headers
    # http://tools.ietf.org/html/rfc7231#section-5.3.5
    class AcceptLanguage < ListHeader 'Accept-Language'
      def initialize(*language_ranges)
        super(language_ranges.sort_by.with_index { |mr, i| [mr, -i] }.reverse)
Severity: Major
Found in xenon-http/lib/xenon/headers/accept_language.rb and 3 other locations - About 35 mins to fix
xenon-http/lib/xenon/headers/accept.rb on lines 6..17
xenon-http/lib/xenon/headers/accept_charset.rb on lines 26..37
xenon-http/lib/xenon/headers/accept_encoding.rb on lines 26..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 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 3 locations. Consider refactoring.
Open

    def self.parse(s)
      tree = Parsers::MediaRange.new.parse(s)
      Parsers::MediaTypeTransform.new.apply(tree)
    rescue Parslet::ParseFailed
      raise Xenon::ParseError.new("Invalid media range (#{s})")
Severity: Minor
Found in xenon-http/lib/xenon/media_type.rb and 2 other locations - About 20 mins to fix
xenon-http/lib/xenon/headers/authorization.rb on lines 16..20
xenon-http/lib/xenon/media_type.rb on lines 28..32

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

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 self.parse(s)
        tree = Parsers::AuthorizationHeader.new.parse(s)
        Parsers::AuthorizationHeaderTransform.new.apply(tree)
      rescue Parslet::ParseFailed
        raise Xenon::ParseError.new("Invalid Authorization header (#{s}).")
Severity: Minor
Found in xenon-http/lib/xenon/headers/authorization.rb and 2 other locations - About 20 mins to fix
xenon-http/lib/xenon/media_type.rb on lines 28..32
xenon-http/lib/xenon/media_type.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 28.

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 self.parse(s)
      tree = Parsers::MediaType.new.parse(s)
      Parsers::MediaTypeTransform.new.apply(tree)
    rescue Parslet::ParseFailed
      raise Xenon::ParseError.new("Invalid media type (#{s}).")
Severity: Minor
Found in xenon-http/lib/xenon/media_type.rb and 2 other locations - About 20 mins to fix
xenon-http/lib/xenon/headers/authorization.rb on lines 16..20
xenon-http/lib/xenon/media_type.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 28.

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