gomodstarguard

package module
v0.0.0-...-f94dafe Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 11 Imported by: 0

README

gomodstarguard

** under development - do not use in prod **

heavily inspired by gomodguard

A golang linter that checks dependencies from github for their stars and warns if they are below a certain threshold.

# .gomodstarguard.yml
warn: 10
error: 5
exeptions:
  - repository: github.com/harmoniemand/gomodstars
    reason: sadly this repo does not have that many stars yet

install

go install github.com/harmoniemand/gomodstarguard/cmd/gomodstarguard

usage

gomodstarguard

RoadMap

  • add tests
  • add CI
  • use github api to get stars
  • check if url redirects to github and also check this repos

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Warn      int `yaml:"warn"`
	Error     int `yaml:"error"`
	Exeptions []struct {
		Repository string `yaml:"repository"`
		Reason     string `yaml:"reason"`
	} `yaml:"exeptions"`
}

type GithubQueryError

type GithubQueryError struct {
	Err           error
	RepositoryURL string
}

func (GithubQueryError) Error

func (e GithubQueryError) Error() string

type Issue

type Issue struct {
	FileName   string
	LineNumber int
	Position   token.Position
	Reason     string
}

Issue represents the result of one error.

func (*Issue) String

func (r *Issue) String() string

String returns the filename, line number and reason of a Issue.

type Processor

type Processor struct {
	Config    *Configuration
	Stargazer *Stargazer
}

func NewProcessor

func NewProcessor(config *Configuration, stargazer *Stargazer) (*Processor, error)

func (*Processor) ProcessFiles

func (p *Processor) ProcessFiles(filenames []string) (issues []Issue)

type StarParserError

type StarParserError struct {
	Err           error
	RepositoryURL string
}

func (StarParserError) Error

func (e StarParserError) Error() string

type Stargazer

type Stargazer struct {
	Config *Configuration
}

func NewStargazer

func NewStargazer(config *Configuration) (*Stargazer, error)

func (*Stargazer) GetStars

func (s *Stargazer) GetStars(repositoryURL string) (int, error)

Directories

Path Synopsis
cmd
internal
cli

Jump to

Keyboard shortcuts

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