2: cannot find package "github.com/hussar-lang/hussar/token" in any of: Open
"github.com/hussar-lang/hussar/token"
- Exclude checks
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 {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
exported type Identifier should have comment or be unexported Open
type Identifier struct {
- Exclude checks
exported method IntegerLiteral.TokenLiteral should have comment or be unexported Open
func (il *IntegerLiteral) TokenLiteral() string { return il.Token.Literal }
- Exclude checks
exported type IfExpression should have comment or be unexported Open
type IfExpression struct {
- Exclude checks
exported type BlockStatement should have comment or be unexported Open
type BlockStatement struct {
- Exclude checks
exported type FunctionLiteral should have comment or be unexported Open
type FunctionLiteral struct {
- Exclude checks
exported type CallExpression should have comment or be unexported Open
type CallExpression struct {
- Exclude checks
exported method ReturnStatement.TokenLiteral should have comment or be unexported Open
func (rs *ReturnStatement) TokenLiteral() string { return rs.Token.Literal }
- Exclude checks
exported method FunctionLiteral.TokenLiteral should have comment or be unexported Open
func (fl *FunctionLiteral) TokenLiteral() string { return fl.Token.Literal }
- Exclude checks
exported method IfExpression.TokenLiteral should have comment or be unexported Open
func (ie *IfExpression) TokenLiteral() string { return ie.Token.Literal }
- Exclude checks
exported method ExitLiteral.TokenLiteral should have comment or be unexported Open
func (el *ExitLiteral) TokenLiteral() string { return el.Token.Literal }
- Exclude checks
exported method Program.TokenLiteral should have comment or be unexported Open
func (p *Program) TokenLiteral() string {
- Exclude checks
exported method LetStatement.TokenLiteral should have comment or be unexported Open
func (ls *LetStatement) TokenLiteral() string { return ls.Token.Literal }
- Exclude checks
if block ends with a return statement, so drop this else and outdent its block Open
} else {
- Exclude checks
exported method Identifier.TokenLiteral should have comment or be unexported Open
func (i *Identifier) TokenLiteral() string { return i.Token.Literal }
- Exclude checks
exported method InfixExpression.TokenLiteral should have comment or be unexported Open
func (ie *InfixExpression) TokenLiteral() string { return ie.Token.Literal }
- Exclude checks
exported method BlockStatement.TokenLiteral should have comment or be unexported Open
func (bs *BlockStatement) TokenLiteral() string { return bs.Token.Literal }
- Exclude checks
exported method Boolean.TokenLiteral should have comment or be unexported Open
func (b *Boolean) TokenLiteral() string { return b.Token.Literal }
- Exclude checks
exported type Statement should have comment or be unexported Open
type Statement interface {
- Exclude checks
exported method StringLiteral.TokenLiteral should have comment or be unexported Open
func (sl *StringLiteral) TokenLiteral() string { return sl.Token.Literal }
- Exclude checks
exported method PrefixExpression.TokenLiteral should have comment or be unexported Open
func (pe *PrefixExpression) TokenLiteral() string { return pe.Token.Literal }
- Exclude checks
exported method WhileExpression.TokenLiteral should have comment or be unexported Open
func (we *WhileExpression) TokenLiteral() string { return we.Token.Literal }
- Exclude checks
exported method ArrayLiteral.TokenLiteral should have comment or be unexported Open
func (al *ArrayLiteral) TokenLiteral() string { return al.Token.Literal }
- Exclude checks
exported type IntegerLiteral should have comment or be unexported Open
type IntegerLiteral struct {
- Exclude checks
exported type Boolean should have comment or be unexported Open
type Boolean struct {
- Exclude checks
exported type IndexExpression should have comment or be unexported Open
type IndexExpression struct {
- Exclude checks
comment on exported type Program should be of the form "Program ..." (with optional leading article) Open
// === PROGRAM ===
- Exclude checks
exported method CallExpression.TokenLiteral should have comment or be unexported Open
func (ce *CallExpression) TokenLiteral() string { return ce.Token.Literal }
- Exclude checks
exported type Expression should have comment or be unexported Open
type Expression interface {
- Exclude checks
exported type LetStatement should have comment or be unexported Open
type LetStatement struct {
- Exclude checks
exported type ReturnStatement should have comment or be unexported Open
type ReturnStatement struct {
- Exclude checks
exported method IndexExpression.TokenLiteral should have comment or be unexported Open
func (ie *IndexExpression) TokenLiteral() string { return ie.Token.Literal }
- Exclude checks
exported method ExpressionStatement.TokenLiteral should have comment or be unexported Open
func (es *ExpressionStatement) TokenLiteral() string { return es.Token.Literal }
- Exclude checks
exported type ExitLiteral should have comment or be unexported Open
type ExitLiteral struct {
- Exclude checks
exported type StringLiteral should have comment or be unexported Open
type StringLiteral struct {
- Exclude checks
exported type PrefixExpression should have comment or be unexported Open
type PrefixExpression struct {
- Exclude checks
exported type InfixExpression should have comment or be unexported Open
type InfixExpression struct {
- Exclude checks
exported type ArrayLiteral should have comment or be unexported Open
type ArrayLiteral struct {
- Exclude checks
exported type Node should have comment or be unexported Open
type Node interface {
- Exclude checks
exported type WhileExpression should have comment or be unexported Open
type WhileExpression struct {
- Exclude checks
exported type ExpressionStatement should have comment or be unexported Open
type ExpressionStatement struct {
- Exclude checks