nondev/spoon

View on GitHub

Showing 65 of 65 total issues

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

            @content << scope_name(left)
            @content << " " unless @node.option :is_chain
            @content << operator
            @content << " " unless @node.option :is_chain
            @content << subtree(right)
Severity: Minor
Found in lib/spoon/compiler.rb and 1 other location - About 15 mins to fix
lib/spoon/compiler.rb on lines 300..304

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

      @compiler.static_scope.get.each do |key, value|
        if value
          result << "  static public var #{key}"
          result << " : #{value}" if value.is_a?(String)
          result << eol
Severity: Minor
Found in lib/spoon/compiler.rb and 1 other location - About 15 mins to fix
lib/spoon/compiler.rb on lines 118..122

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

      @compiler.instance_scope.get.each do |key, value|
        if value
          result << "  public var #{key}"
          result << " : #{value}" if value.is_a?(String)
          result << eol
Severity: Minor
Found in lib/spoon/compiler.rb and 1 other location - About 15 mins to fix
lib/spoon/compiler.rb on lines 110..114

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

    rule(:closure => { :params => simple(:params), :type => simple(:type), :body => simple(:body) }) {
      AST::Node.new :closure, [ type, params, body ], :is_typed => true
    }
Severity: Minor
Found in lib/spoon/transformer.rb and 2 other locations - About 15 mins to fix
lib/spoon/transformer.rb on lines 47..49
lib/spoon/transformer.rb on lines 115..117

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

    rule(:class => { :name => simple(:name), :extends => simple(:extends), :body => simple(:body) } ) {
      AST::Node.new :class, [ name, extends, body ], :is_extended => true
    }
Severity: Minor
Found in lib/spoon/transformer.rb and 2 other locations - About 15 mins to fix
lib/spoon/transformer.rb on lines 115..117
lib/spoon/transformer.rb on lines 188..190

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

    rule(:param => { :name => simple(:name), :type => simple(:type), :value => simple(:value) }) {
      AST::Node.new :param, [ type, name, value ], :is_typed => true
    }
Severity: Minor
Found in lib/spoon/transformer.rb and 2 other locations - About 15 mins to fix
lib/spoon/transformer.rb on lines 47..49
lib/spoon/transformer.rb on lines 188..190

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

Method Spoon::Lexer#keywords is defined at both lib/spoon/lexer.rb:6 and lib/spoon/lexer.rb:8.
Open

    def keywords
Severity: Minor
Found in lib/spoon/lexer.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end

Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition.
Open

      if tree = Spoon::Parser.new.parse_with_debug(File.read(file))
Severity: Minor
Found in lib/spoon/cli.rb by rubocop

This cop checks for assignments in the conditions of if/while/until.

Example:

# bad

if some_var = true
  do_something
end

Example:

# good

if some_var == true
  do_something
end

Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition.
Open

      if tree = Spoon::Parser.new.parse(File.read(source, :encoding => "UTF-8"))
Severity: Minor
Found in lib/spoon/cli.rb by rubocop

This cop checks for assignments in the conditions of if/while/until.

Example:

# bad

if some_var = true
  do_something
end

Example:

# good

if some_var == true
  do_something
end

FIXME found
Open

    # FIXME: Ignore parens in parser output (wait for new Parslet release)
Severity: Minor
Found in lib/spoon/lexer.rb by fixme

TODO found
Open

    # TODO: Add also "this." syntax?
Severity: Minor
Found in lib/spoon/parser.rb by fixme

TODO found
Open

    # TODO: Add existential operator
Severity: Minor
Found in lib/spoon/parser.rb by fixme

TODO found
Open

TODO
Severity: Minor
Found in README.md by fixme

TODO found
Open

    # TODO: Implement something similar for generics
Severity: Minor
Found in lib/spoon/parser.rb by fixme

TODO found
Open

    # TODO: Enable spaces between operator and value
Severity: Minor
Found in lib/spoon/parser.rb by fixme

TODO found
Open

    # TODO: Add interfaces, abstracts and enums
Severity: Minor
Found in lib/spoon/parser.rb by fixme

TODO found
Open

    # TODO: Add switch-when, try-catch, break and continue
Severity: Minor
Found in lib/spoon/parser.rb by fixme

TODO found
Open

    # TODO: Better AST output for types, maybe revisit dot.chain
Severity: Minor
Found in lib/spoon/parser.rb by fixme

TODO found
Open

    # TODO: Implement import syntax from this issue: https://github.com/nondev/spoon/issues/26
Severity: Minor
Found in lib/spoon/parser.rb by fixme

TODO found
Open

    # TODO: Add decorators (postfix if, unless, for and while)
Severity: Minor
Found in lib/spoon/parser.rb by fixme
Severity
Category
Status
Source
Language