Skip to content

Commit

Permalink
nitpicking -> nit
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioCarrion committed Dec 28, 2018
1 parent d368604 commit 0f03300
Show file tree
Hide file tree
Showing 16 changed files with 180 additions and 180 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ jobs:
test:
docker:
- image: circleci/golang:1.11.2
working_directory: /go/src/github.com/MarioCarrion/nitpicking
working_directory: /go/src/github.com/MarioCarrion/nit
steps:
- checkout
- run: go get -v -t -d ./...
- run: go test -v ./...
lint:
docker:
- image: supinf/gometalinter:latest
working_directory: /go/src/github.com/MarioCarrion/nitpicking
working_directory: /go/src/github.com/MarioCarrion/nit
environment:
CGO_ENABLED: 0
steps:
Expand All @@ -21,7 +21,7 @@ jobs:
release:
docker:
- image: circleci/golang:1.11.2
working_directory: /go/src/github.com/MarioCarrion/nitpicking
working_directory: /go/src/github.com/MarioCarrion/nit
steps:
- checkout
- run: curl -sL https://git.io/goreleaser | bash
Expand Down
6 changes: 3 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
project_name: nitpicking
project_name: nit
before:
hooks:
builds:
-
main: ./cmd/nitpicking/main.go
binary: nitpicking
main: ./cmd/nit/main.go
binary: nit
env:
- CGO_ENABLED=0
archive:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# nitpicking
# nit

[![Go Report Card](https://goreportcard.com/badge/github.com/MarioCarrion/nitpicking)](https://goreportcard.com/report/github.com/MarioCarrion/nitpicking)
[![Circle CI](https://circleci.com/gh/MarioCarrion/nitpicking.svg?style=svg)](https://circleci.com/gh/MarioCarrion/nitpicking)
[![coverage](https://gocover.io/_badge/github.com/MarioCarrion/nitpicking?0 "coverage")](http://gocover.io/github.com/MarioCarrion/nitpicking)
[![Go Report Card](https://goreportcard.com/badge/github.com/MarioCarrion/nit)](https://goreportcard.com/report/github.com/MarioCarrion/nit)
[![Circle CI](https://circleci.com/gh/MarioCarrion/nit.svg?style=svg)](https://circleci.com/gh/MarioCarrion/nit)
[![coverage](https://gocover.io/_badge/github.com/MarioCarrion/nit?0 "coverage")](http://gocover.io/github.com/MarioCarrion/nit)

I'm nitpicking your code.

## What is this?

A really, really nitpicking linter that complains when the code is not organized according to the following very opinionated rules:
A really, really nit linter that complains when the code is not organized according to the following very opinionated rules:

1. `imports` is the first section
* Requires section declaration,
Expand Down
4 changes: 2 additions & 2 deletions cmd/nitpicking/main.go → cmd/nit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"path/filepath"

"github.com/MarioCarrion/nitpicking"
"github.com/MarioCarrion/nit"
)

//nolint: gochecknoglobals
Expand Down Expand Up @@ -51,7 +51,7 @@ func main() {

for _, f := range p.GoFiles {
fullpath := filepath.Join(p.Dir, f)
v := nitpicking.Nitpicker{LocalPath: *localPkg}
v := nit.Nitpicker{LocalPath: *localPkg}
if err := v.Validate(fullpath); err != nil {
failed = true
fmt.Println(err)
Expand Down
4 changes: 2 additions & 2 deletions example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"fmt" // blabla
ll "log"

"github.com/MarioCarrion/nitpicking"
"github.com/MarioCarrion/nit"

"github.com/pkg/errors"
)
Expand All @@ -36,6 +36,6 @@ func Something() {
fmt.Println("vim-go")
ll.Println("hi")

fmt.Println(nitpicking.Section(0))
fmt.Println(nit.Section(0))
fmt.Println(errors.New("bla"))
}
2 changes: 1 addition & 1 deletion nitpicking.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package nitpicking
package nit

import (
"fmt"
Expand Down
6 changes: 3 additions & 3 deletions nitpicking_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package nitpicking_test
package nit_test

import (
"path/filepath"
"testing"

"github.com/MarioCarrion/nitpicking"
"github.com/MarioCarrion/nit"
)

func TestNitpicker_Validate(t *testing.T) {
Expand All @@ -22,7 +22,7 @@ func TestNitpicker_Validate(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(ts *testing.T) {
n := nitpicking.Nitpicker{}
n := nit.Nitpicker{}

if err := n.Validate(filepath.Join("testdata", tt.filename)); tt.expectedError != (err != nil) {

Expand Down
2 changes: 1 addition & 1 deletion section.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package nitpicking
package nit

import (
"fmt"
Expand Down
44 changes: 22 additions & 22 deletions section_test.go
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
package nitpicking_test
package nit_test

import (
"go/ast"
"go/token"
"testing"

"github.com/MarioCarrion/nitpicking"
"github.com/MarioCarrion/nit"
)

func TestNewGenDeclSection(t *testing.T) {
tests := [...]struct {
name string
input *ast.GenDecl
expected nitpicking.Section
expected nit.Section
expectedError bool
}{
{
"Imports",
&ast.GenDecl{Tok: token.IMPORT},
nitpicking.SectionImports,
nit.SectionImports,
false,
},
{
"Consts",
&ast.GenDecl{Tok: token.CONST},
nitpicking.SectionConsts,
nit.SectionConsts,
false,
},
{
"Type",
&ast.GenDecl{Tok: token.TYPE},
nitpicking.SectionTypes,
nit.SectionTypes,
false,
},
{
"Vars",
&ast.GenDecl{Tok: token.VAR},
nitpicking.SectionVars,
nit.SectionVars,
false,
},
{
"Error",
&ast.GenDecl{Tok: token.COMMENT},
nitpicking.SectionStart,
nit.SectionStart,
true,
},
}

for _, tt := range tests {
t.Run(tt.name, func(ts *testing.T) {
actual, err := nitpicking.NewGenDeclSection(tt.input)
actual, err := nit.NewGenDeclSection(tt.input)
if (err != nil) != tt.expectedError {
ts.Fatalf("expected no error, got %s", err)
}
Expand All @@ -64,23 +64,23 @@ func TestNewFuncDeclSection(t *testing.T) {
tests := [...]struct {
name string
input *ast.FuncDecl
expected nitpicking.Section
expected nit.Section
}{
{
"Funcs",
&ast.FuncDecl{},
nitpicking.SectionFuncs,
nit.SectionFuncs,
},
{
"Methods",
&ast.FuncDecl{Recv: &ast.FieldList{}},
nitpicking.SectionMethods,
nit.SectionMethods,
},
}

for _, tt := range tests {
t.Run(tt.name, func(ts *testing.T) {
actual, err := nitpicking.NewFuncDeclSection(tt.input)
actual, err := nit.NewFuncDeclSection(tt.input)
if err != nil {
ts.Fatalf("expected no error, got %s", err)
}
Expand All @@ -96,31 +96,31 @@ func TestNewImportsSection(t *testing.T) {
name string
inputPath string
inputLocaBasePrefix string
expected nitpicking.ImportsSection
expected nit.ImportsSection
}{
{
"ImportsSectionStd",
"fmt",
"github.com/MarioCarrion/nitpicking",
nitpicking.ImportsSectionStd,
"github.com/MarioCarrion/nit",
nit.ImportsSectionStd,
},
{
"ImportsSectionExternal",
"github.com/golang/go",
"github.com/MarioCarrion/nitpicking",
nitpicking.ImportsSectionExternal,
"github.com/MarioCarrion/nit",
nit.ImportsSectionExternal,
},
{
"ImportsSectionLocal",
"github.com/MarioCarrion/nitpicking/something",
"github.com/MarioCarrion/nitpicking",
nitpicking.ImportsSectionLocal,
"github.com/MarioCarrion/nit/something",
"github.com/MarioCarrion/nit",
nit.ImportsSectionLocal,
},
}

for _, tt := range tests {
t.Run(tt.name, func(ts *testing.T) {
if actual := nitpicking.NewImportsSection(tt.inputPath, tt.inputLocaBasePrefix); actual != tt.expected {
if actual := nit.NewImportsSection(tt.inputPath, tt.inputLocaBasePrefix); actual != tt.expected {
t.Fatalf("expected %+v, actual %+v", tt.expected, actual)
}
})
Expand Down
2 changes: 1 addition & 1 deletion state_machine.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package nitpicking
package nit

import (
"fmt"
Expand Down
Loading

0 comments on commit 0f03300

Please sign in to comment.