tide

package
v0.0.0-...-e9fe98c Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2019 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditDetails

type AuditDetails struct {
	Type     string `json:"type,omitempty"`
	FileName string `json:"filename,omitempty"`
	Path     string `json:"path,omitempty"`
	*PhpcsResults
	*LighthouseResults
}

AuditDetails contains report information about performed audits.

type AuditResult

type AuditResult struct {
	Raw                  AuditDetails           `json:"raw,omitempty"`
	Parsed               AuditDetails           `json:"parsed,omitempty"`
	Summary              AuditSummary           `json:"summary,omitempty"`
	CompatibleVersions   []string               `json:"compatible_versions,omitempty"`
	IncompatibleVersions []string               `json:"incompatible_versions,omitempty"`
	PhpcsVersions        map[string]string      `json:"phpcs_versions,omitempty"`
	Error                string                 `json:"error,omitempty"`
	Extra                map[string]interface{} `json:"extra,omitempty"`
}

AuditResult contain results about an audit.

type AuditSummary

type AuditSummary struct {
	*PhpcsSummary
	*LighthouseSummary
}

AuditSummary is a proxy struct for `phpcs` and `lighthouse`.

type Auth

type Auth struct {
	AccessToken string     `json:"access_token"`
	Client      AuthClient `json:"client"`
}

Auth represents an authenticated user.

type AuthClient

type AuthClient struct {
	Data ClientData `json:"data"`
}

AuthClient represents a Data object with information about the user that is connected to Tide.

type ClientData

type ClientData struct {
	ID          string `json:"ID"`
	UserLogin   string `json:"user_login"`
	UserEmail   string `json:"user_email"`
	DisplayName string `json:"display_name"`
}

ClientData represents information about the user that is connected to Tide.

type ClientInterface

type ClientInterface interface {
	Authenticate(clientID, clientSecret, authEndpoint string) error
	SendPayload(method, endpoint, data string) (string, error)
}

ClientInterface describes a client that can authenticate with and send payloads to Tide API.

type ClocResult

type ClocResult struct {
	Blank   int `json:"blank"`
	Comment int `json:"comment"`
	Code    int `json:"code"`
	NFiles  int `json:"n_files"`
}

ClocResult runs the code through the `clock` package to get information about the source.

type CodeInfo

type CodeInfo struct {
	Type    string                `json:"type"`
	Details []InfoDetails         `json:"details"`
	Cloc    map[string]ClocResult `json:"cloc"`
}

CodeInfo contains the details about the files being processed.

type InfoDetails

type InfoDetails struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

InfoDetails is a KV pair describing entries in CodeInfo.

func ComplexifyCodeDetails

func ComplexifyCodeDetails(simple *InfoDetailsSimple) []InfoDetails

ComplexifyCodeDetails converts InfoDetailsSimple into []InfoDetails.

type InfoDetailsSimple

type InfoDetailsSimple struct {
	Name        string
	PluginURI   string
	ThemeURI    string
	Version     string
	Description string
	Author      string
	AuthorURI   string
	TextDomain  string
}

InfoDetailsSimple is the CodeInfo details converted into a simpler struct.

func SimplifyCodeDetails

func SimplifyCodeDetails(details []InfoDetails) *InfoDetailsSimple

SimplifyCodeDetails converts []InfoDetails into InfoDetailsSimple.

type Item

type Item struct {
	Title         string                 `json:"title"`
	Description   string                 `json:"content"`
	Version       string                 `json:"version"`
	Checksum      string                 `json:"checksum"`
	Visibility    string                 `json:"visibility"`
	ProjectType   string                 `json:"project_type"`
	SourceURL     string                 `json:"source_url"`
	SourceType    string                 `json:"source_type"`
	CodeInfo      CodeInfo               `json:"code_info,omitempty"`
	Reports       map[string]AuditResult `json:"reports,omitempty"`
	Standards     []string               `json:"standards,omitempty"`      // Will potentially be overriden in API and should not be relied upon.
	RequestClient string                 `json:"request_client,omitempty"` // Will be converted to a user.
	Project       []string               `json:"project,omitempty"`        // Has to be an array of string because of how taxonomies work in WordPress.
}

Item describes an item in a result.

type LighthouseCategory

type LighthouseCategory struct {
	Title       string  `json:"title"`
	Description string  `json:"description"`
	ID          string  `json:"id"`
	Score       float32 `json:"score"`
}

LighthouseCategory contains the results for a given category.

type LighthouseResults

type LighthouseResults struct{}

LighthouseResults is a simplified version of `lighthouse` results. TODO: Define this later.

type LighthouseSummary

type LighthouseSummary struct {
	Categories map[string]LighthouseCategory `json:"categories,omitempty"`
}

LighthouseSummary uses only the catagories information from an extensice Lighthouse report.

type PhpcsFilesMessage

type PhpcsFilesMessage struct {
	Message  string `json:"message"`
	Source   string `json:"source"`
	Severity int    `json:"severity,omitempty"`
	Type     string `json:"type"`
	Line     int    `json:"line"`
	Column   int    `json:"column"`
	Fixable  bool   `json:"fixable"`
}

PhpcsFilesMessage contains individual violation information about a file.

type PhpcsResults

type PhpcsResults struct {
	Totals struct {
		Errors   int `json:"errors,omitempty"`
		Warnings int `json:"warnings,omitempty"`
	} `json:"totals,omitempty"`
	Files map[string]struct {
		Errors   int                 `json:"errors, omitempty"`
		Warnings int                 `json:"warnings,omitempty"`
		Messages []PhpcsFilesMessage `json:"messages,omitempty"`
	} `json:"files,omitempty"`
}

PhpcsResults contains the results from a phpcs audit.

type PhpcsSummary

type PhpcsSummary struct {
	Files map[string]struct {
		Errors   int `json:"errors"`
		Warnings int `json:"warnings"`
	} `json:"files,omitempty"`
	FilesCount    int `json:"files_count"`
	ErrorsCount   int `json:"errors_count"`
	WarningsCount int `json:"warnings_count"`
}

PhpcsSummary is a simplified version of `phpcs` results.

type ResultSet

type ResultSet struct {
	Results []Item
}

ResultSet contains results as a slice of Items.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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