lib/spoon/parser.rb
Class has too many lines. [324/250] Open
Open
class Parser < Lexer
def self.keywords(*names)
names.each do |name|
rule("#{name}_keyword") { str(name.to_s).as(:keyword) >> spaces? }
end
- Read upRead up
- Exclude checks
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
Open
require "parslet"
require "parslet/convenience"
require "spoon/lexer"
Method operators
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.operators(operators={})
trailing_chars = Hash.new { |hash,symbol| hash[symbol] = [] }
operators.each_value do |symbol|
operators.each_value do |op|
- Read upRead up
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
Open
# TODO: Enable spaces between operator and value
- Exclude checks
TODO found Open
Open
# TODO: Add also "implements", to implement interfaces
- Exclude checks
TODO found Open
Open
# TODO: Add decorators (postfix if, unless, for and while)
- Exclude checks
TODO found Open
Open
# TODO: Better AST output for types, maybe revisit dot.chain
- Exclude checks
TODO found Open
Open
# TODO: Implement import syntax from this issue: https://github.com/nondev/spoon/issues/26
- Exclude checks
TODO found Open
Open
# TODO: Add support for block comments
- Exclude checks
TODO found Open
Open
# TODO: Add existential operator
- Exclude checks
TODO found Open
Open
# TODO: Add "null" and "void" literal
- Exclude checks
TODO found Open
Open
# TODO: Add interfaces, abstracts and enums
- Exclude checks
TODO found Open
Open
# TODO: Add support for single quotes
- Exclude checks
TODO found Open
Open
# TODO: Add also "self." syntax?
- Exclude checks
TODO found Open
Open
# TODO: Add switch-when, try-catch, break and continue
- Exclude checks
TODO found Open
Open
# TODO: Add also "this." syntax?
- Exclude checks
TODO found Open
Open
# TODO: Implement something similar for generics
- Exclude checks