Esempio n. 1
0
// a comment
func main() {
	c := &commentTenet{}
	c.SetInfo(tenet.Info{
		Name:     "fif_node",
		Usage:    "take issue with the first comment in every file",
		Language: "Go",
		Description: `
This tenet is part of lingo's internal testing suite. It should raise an issue for the
first comment encountered in every file, using SmellNode.
`,
	})

	issue := c.RegisterIssue("comment", tenet.AddComment("first comment - node", tenet.FirstComment, tenet.InEveryFile))
	c.SmellNode(func(r tenet.Review, comment *ast.Comment) error {
		r.RaiseNodeIssue(issue, comment)
		return nil
	})

	server.Serve(c)
}
Esempio n. 2
0
// a comment
func main() {
	c := &commentTenet{}
	c.SetInfo(tenet.Info{
		Name:     "fif_line",
		Usage:    "take issue with the first comment in every file",
		Language: "Go",
		Description: `
This tenet is part of lingo's internal testing suite. It should raise an issue for the
first comment encountered in every file, using SmellLine.
`,
	})

	issue := c.RegisterIssue("comment", tenet.AddComment("first comment - line", tenet.FirstComment, tenet.InEveryFile))
	c.SmellLine(func(r tenet.Review, n int, line []byte) error {
		if regexp.MustCompile(`\/\/.*`).Match(line) {
			r.RaiseLineIssue(issue, n, n)
		}
		return nil
	})

	server.Serve(c)
}
Esempio n. 3
0
// a comment
func main() {
	c := &commentTenet{}
	c.SetInfo(tenet.Info{
		Name:     "simpleseed",
		Usage:    "every comment should be awesome",
		Language: "Go",
		Description: `
simpleseed is a demonstration tenet showing the structure required
to write a tenet in Go. When reviewing code with simpleseed it will be suggested
that all comments could be more awesome.
`,
	})

	issue := c.RegisterIssue("sucky_comment", tenet.AddComment("this comment could be more awesome"))
	c.SmellNode(func(r tenet.Review, comment *ast.Comment) error {
		if comment.Text != "// most awesome comment ever" {
			r.RaiseNodeIssue(issue, comment)
		}
		return nil
	})

	server.Serve(c)
}
Esempio n. 4
0
func main() {

	// Serve up the tenet.
	server.Serve(tenet.New())
}
Esempio n. 5
0
func main() {
	server.Serve(tenet.New())
}