allcases

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: MIT Imports: 11 Imported by: 0

README

allcases

allcalses is Go code analyzer which checks for switch statements to have all cases.

Install

$ go get github.com/knightso/allcases/cmd/allcases

How to use

Usage

$ allcases [-flag] [package]

Annotation

This checker checks for switch statements which have an annotation comment // allcases to have all cases for consts of the expression type.

For example if there is a type and consts like:

	type TestKind int

	const (
		TestKindHoge TestKind = iota
		TestKindFuga
		TestKindPiyo
	)

and switch statements like:

	// allcases
	switch v {
	case TestKindHoge:
		// do something
	case TestKindFuga:
		// do something
	}

then the checker reports that the switch statement doesn't have the TestKindPiyo case.

Documentation

Overview

Package allcases defines an Analyzer that checks for switch statements to have all cases.

Index

Constants

View Source
const Doc = `` /* 555-byte string literal not displayed */

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:      "allcases",
	Doc:       Doc,
	Run:       run,
	Requires:  []*analysis.Analyzer{inspect.Analyzer, commentmap.Analyzer},
	FactTypes: []analysis.Fact{new(fact)},
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
allcases
The allcases command runs the allcases analyzer.
The allcases command runs the allcases analyzer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL