linter

package
Version: v0.0.0-...-433e763 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2016 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Copyright (c) 2015-2016 The GoAnalysis Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

View Source
const CC_LIMIT = 10 // Upper limit of cyclomatic complexity measures.
View Source
const ERROR_OUTPUT_FILE = "GoAnalyzerError.log"

Variables

This section is empty.

Functions

This section is empty.

Types

type GoFile

type GoFile struct {
	FilePath        string
	LinesOfCode     int
	LinesOfComments int
	Violations      []*Violation
	// contains filtered or unexported fields
}

func (*GoFile) AddViolation

func (f *GoFile) AddViolation(tokPosition token.Pos, violationType Rule, description string) *Violation

AddViolation adds a new violation as specified trough its argument to the GoFile list of violations.

func (*GoFile) Analyse

func (goFile *GoFile) Analyse()

Analyse fires off all detection algorithms on the goFile.

type GoPackage

type GoPackage struct {
	Violations []*GoFile

	Path string
	Pack *ast.Package
	// contains filtered or unexported fields
}

func DetectViolations

func DetectViolations(goSourceDir string) (goPackageViolations []*GoPackage, err error)

func (*GoPackage) Analyze

func (goPackage *GoPackage) Analyze()

func (*GoPackage) GetFileNodes

func (goPackage *GoPackage) GetFileNodes() (goFiles []*ast.File)

type Rule

type Rule int
const (
	RACE_CONDITION Rule = iota
	FMT_PRINTING
	STRING_CALLS_ITSELF
	MAP_ALLOCATED_WITH_NEW
	ERROR_IGNORED
	EMPTY_IF_BODY
	EMPTY_ELSE_BODY
	EMPTY_FOR_BODY
	GOTO_USED
	CONDITION_EVALUATED_STATICALLY
	BUFFER_NOT_FLUSHED
	RETURN_KILLS_CODE
	CYCLOMATIC_COMPLEXITY
)

Rules.

func (Rule) MarshalText

func (rule Rule) MarshalText() ([]byte, error)

Marshal Rule string value instead of int value.

func (Rule) String

func (rule Rule) String() string

type Violation

type Violation struct {
	Type        Rule
	Description string
	SrcLine     int
}

func (*Violation) String

func (violation *Violation) String() string

Source Files

Directories

Path Synopsis
graph/stack
Package graph.stack provides an implementation of the Stack abstract-datastructure, basically providing the standard graph.stack operating primitives.
Package graph.stack provides an implementation of the Stack abstract-datastructure, basically providing the standard graph.stack operating primitives.
testcode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL