files

package
v2.7.3 Latest Latest
Warning

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

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

Documentation

Overview

Package files contains functions and structs related to files

Index

Constants

View Source
const DefaultMimeType = "application/octet-stream"

Variables

This section is empty.

Functions

func AddToFiles

func AddToFiles(filePaths []string, filePath string, config config.Config) []string

AddToFiles adds a file to a slice if it isn't already in there and meets the requirements and returns the new slice

func GetContentType

func GetContentType(path string, config config.Config) (string, error)

GetContentType returns the content type of a file

func GetContentTypeBytes

func GetContentTypeBytes(rawFileContent []byte, config config.Config) (string, error)

GetContentTypeBytes returns the content type of a byte slice

func GetFiles

func GetFiles(config config.Config) ([]string, error)

GetFiles returns all files which should be checked

func GetRelativePath

func GetRelativePath(filePath string) (string, error)

GetRelativePath returns the relative path of a file from the current working directory

func IsAllowedContentType

func IsAllowedContentType(contentType string, config config.Config) bool

IsAllowedContentType returns whether the contentType is an allowed content type to check or not

func IsExcluded

func IsExcluded(filePath string, config config.Config) (bool, error)

IsExcluded returns whether the file is excluded via arguments or config file

func PathExists

func PathExists(filePath string) bool

PathExists checks whether a path of a file or directory exists or not

func ReadLines

func ReadLines(content string) []string

ReadLines returns the lines from a file as a slice

Types

type FileInformation

type FileInformation struct {
	Line         string
	Content      string
	FilePath     string
	LineNumber   int
	Editorconfig *editorconfig.Definition
}

FileInformation is a Struct which represents some FileInformation

Jump to

Keyboard shortcuts

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