nondev/spoon

View on GitHub
lib/spoon/parser.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class has too many lines. [324/250]
Open

  class Parser < Lexer
    def self.keywords(*names)
      names.each do |name|
        rule("#{name}_keyword") { str(name.to_s).as(:keyword) >> spaces? }
      end
Severity: Minor
Found in lib/spoon/parser.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

File parser.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "parslet"
require "parslet/convenience"

require "spoon/lexer"

Severity: Minor
Found in lib/spoon/parser.rb - About 3 hrs to fix

    Method operators has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.operators(operators={})
          trailing_chars = Hash.new { |hash,symbol| hash[symbol] = [] }
    
          operators.each_value do |symbol|
            operators.each_value do |op|
    Severity: Minor
    Found in lib/spoon/parser.rb - About 1 hr 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

    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 also "implements", to implement interfaces
    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

    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 support for block comments
    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: Add "null" and "void" literal
    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 support for single quotes
    Severity: Minor
    Found in lib/spoon/parser.rb by fixme

    TODO found
    Open

        # TODO: Add also "self." syntax?
    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: Add also "this." syntax?
    Severity: Minor
    Found in lib/spoon/parser.rb by fixme

    TODO found
    Open

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

    There are no issues that match your filters.

    Category
    Status