npmblame

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

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

Go to latest
Published: Sep 7, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

README

npm-blame

GoDoc Go Report Card Build Status Coverage Status

Reports on npm packages common errors and useless files.

Install

Get the latest release for you operating system architecture.

Usage

Run npm-blame from inside your project's node_module folder.

Build

  • Get the latest Golang release
  • Set up your workspace
  • Run go get github.com/talend-glorieux/npm-blame
  • Go to the projects folder. $GOPATH/src/github.com/talend-glorieux/npm-blame
  • Run go install ./cmd/npm-blame

Status

npm-blame is still a work in progress. It will need to handle more errors, add a report mode that alerts maintainers as well as a bit of refactoring.

Documentation

Overview

Package npmblame captures useful informations and common errors from npm node_modules

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultClient

func DefaultClient(authToken string) *github.Client

DefaultClient returns a default GitHub client

Types

type NpmPackage

type NpmPackage struct {
	BugsURL  string
	Homepage string
	Errors   map[int]int
}

NpmPackage represents a npm package

type NpmPackages

type NpmPackages map[string]map[PackageError]int

NpmPackages is a map of all the packages and there given errors

func NewNpmPackages

func NewNpmPackages() NpmPackages

NewNpmPackages returns a new npm package instance

func (NpmPackages) AppendError

func (np NpmPackages) AppendError(pkgName string, err PackageError)

AppendError appends an error to a given package

func (NpmPackages) Blame

func (np NpmPackages) Blame(path string, info os.FileInfo, err error) error

Blame reports on error for a given npm package

func (NpmPackages) ExtractPackageInformations

func (np NpmPackages) ExtractPackageInformations() error

ExtractPackageInformations extracts the package information from its package.json

func (NpmPackages) ExtractPackageName

func (np NpmPackages) ExtractPackageName(path string) string

ExtractPackageName returns the npm package name from a given path TODO improve to handle nested dependencies

func (NpmPackages) String

func (np NpmPackages) String() string

String returns the printalbe representation of the NpmPackages

func (NpmPackages) TotalErrors

func (np NpmPackages) TotalErrors(pkgName string) int

TotalErrors return the total amount of errors

type PackageError

type PackageError int

PackageError represents common npm packages errors

const (
	// ExecError marks a package containing executables
	ExecError PackageError = iota
	// TestError marks a package test files
	TestError
	// BenchError marks a package benchmark files
	BenchError
	// ImageError marks a package images files
	ImageError
	// CIError marks a package containing continuous integration files
	CIError
	// DotfileError marks a package lint files
	DotfileError
)

type Report

type Report struct {
	Title      string
	Body       string
	Owner      string
	Repository string
	Errors     []int
	Solutions  []int
}

Report represents a npm package issue report

func NewReport

func NewReport(owner string, repo string, Errors []int) *Report

NewReport returns a new issue report based on the errors types

func (*Report) Send

func (r *Report) Send(client *github.Client) (issue *github.Issue, err error)

Send sends a report to the appropriate npm package issue tracker

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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