hussar-lang/hussar

View on GitHub
ast/ast.go

Summary

Maintainability
A
1 hr
Test Coverage

2: cannot find package "github.com/hussar-lang/hussar/token" in any of:
Open

    "github.com/hussar-lang/hussar/token"
Severity: Minor
Found in ast/ast.go by govet

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

func (al *ArrayLiteral) String() string {
    var out bytes.Buffer

    elements := []string{}
    for _, el := range al.Elements {
Severity: Minor
Found in ast/ast.go and 1 other location - About 1 hr to fix
object/object.go on lines 132..145

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

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

exported type Identifier should have comment or be unexported
Open

type Identifier struct {
Severity: Minor
Found in ast/ast.go by golint

exported method IntegerLiteral.TokenLiteral should have comment or be unexported
Open

func (il *IntegerLiteral) TokenLiteral() string { return il.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported type IfExpression should have comment or be unexported
Open

type IfExpression struct {
Severity: Minor
Found in ast/ast.go by golint

exported type BlockStatement should have comment or be unexported
Open

type BlockStatement struct {
Severity: Minor
Found in ast/ast.go by golint

exported type FunctionLiteral should have comment or be unexported
Open

type FunctionLiteral struct {
Severity: Minor
Found in ast/ast.go by golint

exported type CallExpression should have comment or be unexported
Open

type CallExpression struct {
Severity: Minor
Found in ast/ast.go by golint

exported method ReturnStatement.TokenLiteral should have comment or be unexported
Open

func (rs *ReturnStatement) TokenLiteral() string { return rs.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method FunctionLiteral.TokenLiteral should have comment or be unexported
Open

func (fl *FunctionLiteral) TokenLiteral() string { return fl.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method IfExpression.TokenLiteral should have comment or be unexported
Open

func (ie *IfExpression) TokenLiteral() string { return ie.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method ExitLiteral.TokenLiteral should have comment or be unexported
Open

func (el *ExitLiteral) TokenLiteral() string { return el.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method Program.TokenLiteral should have comment or be unexported
Open

func (p *Program) TokenLiteral() string {
Severity: Minor
Found in ast/ast.go by golint

exported method LetStatement.TokenLiteral should have comment or be unexported
Open

func (ls *LetStatement) TokenLiteral() string { return ls.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

if block ends with a return statement, so drop this else and outdent its block
Open

    } else {
Severity: Minor
Found in ast/ast.go by golint

exported method Identifier.TokenLiteral should have comment or be unexported
Open

func (i *Identifier) TokenLiteral() string { return i.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method InfixExpression.TokenLiteral should have comment or be unexported
Open

func (ie *InfixExpression) TokenLiteral() string { return ie.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method BlockStatement.TokenLiteral should have comment or be unexported
Open

func (bs *BlockStatement) TokenLiteral() string { return bs.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method Boolean.TokenLiteral should have comment or be unexported
Open

func (b *Boolean) TokenLiteral() string { return b.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported type Statement should have comment or be unexported
Open

type Statement interface {
Severity: Minor
Found in ast/ast.go by golint

exported method StringLiteral.TokenLiteral should have comment or be unexported
Open

func (sl *StringLiteral) TokenLiteral() string { return sl.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method PrefixExpression.TokenLiteral should have comment or be unexported
Open

func (pe *PrefixExpression) TokenLiteral() string { return pe.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method WhileExpression.TokenLiteral should have comment or be unexported
Open

func (we *WhileExpression) TokenLiteral() string { return we.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method ArrayLiteral.TokenLiteral should have comment or be unexported
Open

func (al *ArrayLiteral) TokenLiteral() string { return al.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported type IntegerLiteral should have comment or be unexported
Open

type IntegerLiteral struct {
Severity: Minor
Found in ast/ast.go by golint

exported type Boolean should have comment or be unexported
Open

type Boolean struct {
Severity: Minor
Found in ast/ast.go by golint

exported type IndexExpression should have comment or be unexported
Open

type IndexExpression struct {
Severity: Minor
Found in ast/ast.go by golint

comment on exported type Program should be of the form "Program ..." (with optional leading article)
Open

// === PROGRAM ===
Severity: Minor
Found in ast/ast.go by golint

exported method CallExpression.TokenLiteral should have comment or be unexported
Open

func (ce *CallExpression) TokenLiteral() string { return ce.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported type Expression should have comment or be unexported
Open

type Expression interface {
Severity: Minor
Found in ast/ast.go by golint

exported type LetStatement should have comment or be unexported
Open

type LetStatement struct {
Severity: Minor
Found in ast/ast.go by golint

exported type ReturnStatement should have comment or be unexported
Open

type ReturnStatement struct {
Severity: Minor
Found in ast/ast.go by golint

exported method IndexExpression.TokenLiteral should have comment or be unexported
Open

func (ie *IndexExpression) TokenLiteral() string { return ie.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported method ExpressionStatement.TokenLiteral should have comment or be unexported
Open

func (es *ExpressionStatement) TokenLiteral() string { return es.Token.Literal }
Severity: Minor
Found in ast/ast.go by golint

exported type ExitLiteral should have comment or be unexported
Open

type ExitLiteral struct {
Severity: Minor
Found in ast/ast.go by golint

exported type StringLiteral should have comment or be unexported
Open

type StringLiteral struct {
Severity: Minor
Found in ast/ast.go by golint

exported type PrefixExpression should have comment or be unexported
Open

type PrefixExpression struct {
Severity: Minor
Found in ast/ast.go by golint

exported type InfixExpression should have comment or be unexported
Open

type InfixExpression struct {
Severity: Minor
Found in ast/ast.go by golint

exported type ArrayLiteral should have comment or be unexported
Open

type ArrayLiteral struct {
Severity: Minor
Found in ast/ast.go by golint

exported type Node should have comment or be unexported
Open

type Node interface {
Severity: Minor
Found in ast/ast.go by golint

exported type WhileExpression should have comment or be unexported
Open

type WhileExpression struct {
Severity: Minor
Found in ast/ast.go by golint

exported type ExpressionStatement should have comment or be unexported
Open

type ExpressionStatement struct {
Severity: Minor
Found in ast/ast.go by golint

There are no issues that match your filters.

Category
Status