fmtatt

package
v0.0.0-...-855de17 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFmtAttConfig = Config{
	RepoProvider: "Github",
	Pacing: Pacing{
		MaxPRs:                 50,
		MininumPRSpreadMinutes: 10,
	},
	Identity: &identity.AuthIdentity{
		Username: "whilei",
		RawToken: "",
		EnvToken: "GITHUB_TOKEN",
	},
	GitConfig: DefaultGitConfig,
	Fmters:    []*fmter.FmtConfig{DefaultFmter},
	ReposSpec: &remote.ListSpec{
		DefaultReposSpec,
		DefaultOwnersSpec,
	},
	ForkConfig:        DefaultForkConfig,
	PullRequestConfig: DefaultPRConfig,
	WalkPattern:       DefaultWalkPattern,
	PersistConfig:     []*persist.PersistenceConfig{DefaultPersistenceConfig},
	Logs:              []*logger.LogConfig{DefaultLogConfig},
}
View Source
var DefaultFmter = &fmter.FmtConfig{
	Commands: []string{"gofmt -w"},
	PerFile:  false,
	Files: &fmter.FileList{
		WhiteList: []string{".go$"},
		BlackList: []string{""},
	},
	Dirs: &fmter.FileList{
		WhiteList: []string{""},
		BlackList: []string{"*vendor*", ".git"},
	},
}
View Source
var DefaultForkConfig = &remote.ForkConfig{

	Org: "",
}
View Source
var DefaultGitConfig = &git.GitConfig{
	Provider: "gogit",
	BasePath: "/Users/ia/gofmt-att/clones",
	GitCommitConfig: &git.GitCommitConfig{
		Title:          "all: gofmt",
		BranchNameBase: "gofmt",
		Body: `Run standard gofmt command on project root.

- go version go1.10.3 darwin/amd64`,
		AuthorName: "ia",
		Email:      "isaac.ardis@gmail.com",
	},
	AddPaths: &remote.MatchTextSpec{
		WhiteList: []string{},
		BlackList: []string{`vendor\/`, `pkg\/`, "testdata", `assets\/`},
	},
	AddContent: &remote.MatchTextSpec{
		WhiteList: []string{},
		BlackList: []string{

			`^\/\/\s?(do(|\s?)n.?t\W?(edit|change|remove|add|tamper)|)(.*(auto(m|-)|)|generat|)`,
		},
	},
	StripeList: git.StripeList{
		`M\s*(|\/)vendor\/github\.com\/(?P<OWNER>\w*)\/(?P<REPO>[\w-]*\b)`,
	},
}
View Source
var DefaultLogConfig = &logger.LogConfig{
	Level:  5,
	Logger: "stderr",
}
View Source
var DefaultOwnersSpec = &remote.OwnerListSpec{
	Owner: remote.Owner{
		Name: "",
	},
	FollowingN: &remote.MatchNSpec{
		Min: 0,
		Max: math.MaxUint32,
	},
	FollowersN: &remote.MatchNSpec{
		Min: 0,
		Max: math.MaxUint32,
	},
	PublicReposN: &remote.MatchNSpec{
		Min: 0,
		Max: math.MaxUint32,
	},
	PublicGistsN: &remote.MatchNSpec{
		Min: 0,
		Max: math.MaxUint32,
	},
	CollaboratorsN: &remote.MatchNSpec{
		Min: 0,
		Max: math.MaxUint32,
	},
}

DefaultOwnersSpec applies for both users and orgs.

View Source
var DefaultPRConfig = &remote.PullRequestConfig{
	Title: "gofmt",
	Head:  "",
	Base:  "master",
	Body: `
Just ran

	gofmt -w .

on the project root. That's all.

> https://blog.golang.org/go-fmt-your-code
`,
	BodyFile: "",
	OrgFork:  DefaultForkConfig.Org,
}
View Source
var DefaultPersistenceConfig = &persist.PersistenceConfig{
	Name:     "badger",
	Endpoint: "/Users/ia/gofmt-att/badger.db",
}
View Source
var DefaultReposSpec = &remote.RepoListSpec{
	Owner: &remote.MatchTextSpec{
		WhiteList: []string{},
		BlackList: []string{},
	},
	Name: &remote.MatchTextSpec{
		WhiteList: []string{},
		BlackList: []string{},
	},
	Description: &remote.MatchTextSpec{
		WhiteList: []string{},
		BlackList: []string{},
	},
	Language: &remote.MatchTextSpec{
		WhiteList: []string{"Go"},
		BlackList: []string{},
	},
	Conduct: &remote.MatchTextSpec{
		WhiteList: []string{},
		BlackList: []string{"NO ROBOTS", "ROBOTS NOT WELCOME"},
	},
	IsFork:    false,
	IsPrivate: false,
	Archived:  false,
	StargazersCount: &remote.MatchNSpec{
		Min: 0,
		Max: math.MaxUint32,
	},
	ForksCount: &remote.MatchNSpec{
		Min: 0,
		Max: math.MaxUint32,
	},
	Size: &remote.MatchNSpec{
		Min: 0,
		Max: 1024 * 50,
	},
	NetworkCount: &remote.MatchNSpec{
		Min: 0,
		Max: math.MaxUint32,
	},
	WatchersCount: &remote.MatchNSpec{
		Min: 0,
		Max: math.MaxUint32,
	},
	Visibility:  "all",
	Affiliation: "owner,collaborator,organization_member",
	SearchOptions: &remote.SearchOptions{
		Sort:  "updated",
		Order: "desc",
	},
	FmtExpiry: 90,
}
View Source
var DefaultWalkPattern = &walk.WalkPattern{
	Name: "drunken",
	Genesis: remote.Leaf{
		Header: remote.OrgRepos, ID: "rotblauer",
	},
	QueryBranchConfig: remote.QueryBranchConfig{

		MaxDistance: 60000,

		Branching: func() map[remote.LeafHeader]float64 {
			nLeaves := len(remote.AvailableLeafHeaders)
			n := float64(1) / float64(nLeaves)
			leaves := make(map[remote.LeafHeader]float64, nLeaves)
			for i := 0; i < nLeaves; i++ {
				leaves[remote.AvailableLeafHeaders[i]] = n
			}
			return leaves
		}(),
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Identity          *identity.AuthIdentity // eg. whilei, ETCDEVTeam, etc.
	Pacing            Pacing
	RepoProvider      string
	ReposSpec         *remote.ListSpec
	Fmters            []*fmter.FmtConfig
	GitConfig         *git.GitConfig
	ForkConfig        *remote.ForkConfig
	PullRequestConfig *remote.PullRequestConfig
	PersistConfig     []*persist.PersistenceConfig
	WalkPattern       *walk.WalkPattern
	Logs              []*logger.LogConfig
}

type DryRunT

type DryRunT bool
var DryRun DryRunT = true
var WetRun DryRunT = false

type FmtAtt

type FmtAtt struct {
	Config *Config

	Repoer remote.Provider
	Walker walk.WalkProvider
	Fmters []*fmter.FmtConfig
	Giter  git.GitProvider

	// For now just keepin it simple.
	Persister persist.PersistenceProvider
	Logger    logger.Verbosably
	// contains filtered or unexported fields
}

func New

func New(c *Config) *FmtAtt

func (*FmtAtt) Go

func (f *FmtAtt) Go(dryRun [3]DryRunT)

type Pacing

type Pacing struct {
	MaxPRs                 int
	MininumPRSpreadMinutes int64 // minutes
}

Jump to

Keyboard shortcuts

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