nodecheck

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package nodecheck provides code quality checks for Node.js projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(cfg *config.Config) []checker.CheckRegistration

Register returns all Node.js checks with their metadata.

Types

type AuditResult

type AuditResult struct {
	Metadata struct {
		Vulnerabilities struct {
			Total    int `json:"total"`
			Low      int `json:"low"`
			Moderate int `json:"moderate"`
			High     int `json:"high"`
			Critical int `json:"critical"`
		} `json:"vulnerabilities"`
	} `json:"metadata"`
	// npm 7+ format
	Vulnerabilities map[string]interface{} `json:"vulnerabilities"`
}

AuditResult represents the npm audit JSON output.

type BuildCheck

type BuildCheck struct {
	Config *config.NodeLanguageConfig
}

BuildCheck verifies that Node.js dependencies can be installed.

func (*BuildCheck) ID

func (c *BuildCheck) ID() string

ID returns the unique identifier for this check.

func (*BuildCheck) Name

func (c *BuildCheck) Name() string

Name returns the human-readable name for this check.

func (*BuildCheck) Run

func (c *BuildCheck) Run(path string) (checker.Result, error)

Run executes the build check.

type CoverageCheck

type CoverageCheck struct {
	Config    *config.NodeLanguageConfig
	Threshold float64
}

CoverageCheck measures test coverage for Node.js projects.

func (*CoverageCheck) ID

func (c *CoverageCheck) ID() string

ID returns the unique identifier for this check.

func (*CoverageCheck) Name

func (c *CoverageCheck) Name() string

Name returns the human-readable name for this check.

func (*CoverageCheck) Run

func (c *CoverageCheck) Run(path string) (checker.Result, error)

Run executes the coverage check.

type DepsCheck

type DepsCheck struct {
	Config *config.NodeLanguageConfig
}

DepsCheck scans for security vulnerabilities in Node.js dependencies.

func (*DepsCheck) ID

func (c *DepsCheck) ID() string

ID returns the unique identifier for this check.

func (*DepsCheck) Name

func (c *DepsCheck) Name() string

Name returns the human-readable name for this check.

func (*DepsCheck) Run

func (c *DepsCheck) Run(path string) (checker.Result, error)

Run executes the dependency vulnerability check.

type FormatCheck

type FormatCheck struct {
	Config *config.NodeLanguageConfig
}

FormatCheck verifies code formatting with prettier or biome.

func (*FormatCheck) ID

func (c *FormatCheck) ID() string

ID returns the unique identifier for this check.

func (*FormatCheck) Name

func (c *FormatCheck) Name() string

Name returns the human-readable name for this check.

func (*FormatCheck) Run

func (c *FormatCheck) Run(path string) (checker.Result, error)

Run executes the format check.

type LintCheck

type LintCheck struct {
	Config *config.NodeLanguageConfig
}

LintCheck runs linting on Node.js code.

func (*LintCheck) ID

func (c *LintCheck) ID() string

ID returns the unique identifier for this check.

func (*LintCheck) Name

func (c *LintCheck) Name() string

Name returns the human-readable name for this check.

func (*LintCheck) Run

func (c *LintCheck) Run(path string) (checker.Result, error)

Run executes the lint check.

type LoggingCheck added in v0.1.2

type LoggingCheck struct{}

LoggingCheck verifies proper logging practices in Node.js code.

func (*LoggingCheck) ID added in v0.1.2

func (c *LoggingCheck) ID() string

func (*LoggingCheck) Name added in v0.1.2

func (c *LoggingCheck) Name() string

func (*LoggingCheck) Run added in v0.1.2

func (c *LoggingCheck) Run(path string) (checker.Result, error)

type PackageJSON

type PackageJSON struct {
	Name            string            `json:"name"`
	Version         string            `json:"version"`
	Description     string            `json:"description"`
	Main            string            `json:"main"`
	Scripts         map[string]string `json:"scripts"`
	Dependencies    map[string]string `json:"dependencies"`
	DevDependencies map[string]string `json:"devDependencies"`
}

PackageJSON represents the structure of a package.json file.

func ParsePackageJSON

func ParsePackageJSON(path string) (*PackageJSON, error)

ParsePackageJSON reads and parses package.json from the given path.

type ProjectCheck

type ProjectCheck struct{}

ProjectCheck verifies that package.json exists and is valid.

func (*ProjectCheck) ID

func (c *ProjectCheck) ID() string

ID returns the unique identifier for this check.

func (*ProjectCheck) Name

func (c *ProjectCheck) Name() string

Name returns the human-readable name for this check.

func (*ProjectCheck) Run

func (c *ProjectCheck) Run(path string) (checker.Result, error)

Run executes the project check.

type TestsCheck

type TestsCheck struct {
	Config *config.NodeLanguageConfig
}

TestsCheck runs the project's test suite.

func (*TestsCheck) ID

func (c *TestsCheck) ID() string

ID returns the unique identifier for this check.

func (*TestsCheck) Name

func (c *TestsCheck) Name() string

Name returns the human-readable name for this check.

func (*TestsCheck) Run

func (c *TestsCheck) Run(path string) (checker.Result, error)

Run executes the tests check.

type TypeCheck

type TypeCheck struct {
	Config *config.NodeLanguageConfig
}

TypeCheck runs TypeScript compiler for type checking.

func (*TypeCheck) ID

func (c *TypeCheck) ID() string

ID returns the unique identifier for this check.

func (*TypeCheck) Name

func (c *TypeCheck) Name() string

Name returns the human-readable name for this check.

func (*TypeCheck) Run

func (c *TypeCheck) Run(path string) (checker.Result, error)

Run executes the TypeScript type check.

type YarnAuditLine

type YarnAuditLine struct {
	Type string `json:"type"`
	Data struct {
		Advisory struct {
			ID int `json:"id"`
		} `json:"advisory"`
		Resolution struct {
			ID int `json:"id"`
		} `json:"resolution"`
	} `json:"data"`
}

YarnAuditLine represents a line in yarn audit NDJSON output.

Jump to

Keyboard shortcuts

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