Documentation ¶
Overview ¶
Package configlet sanity-checks Exercism track configuration.
A track consists of a collection of exercises in a single programming language. Each problem has a test suite, a sample solution, and any supporting files that are necessary to solve the exercise.
The configuration serves two purposes:
1. It helps implementors ensure that all the exercises are valid.
2. It provides the API with a sort order for delivering exercises.
Index ¶
- type Config
- type Exercise
- type Track
- func (t Track) Config() (Config, error)
- func (t Track) Dirs() (map[string]struct{}, error)
- func (t Track) DuplicateSlugs() ([]string, error)
- func (t Track) ForegoneViolations() ([]string, error)
- func (t Track) HasValidConfig() bool
- func (t Track) MissingProblems() ([]string, error)
- func (t Track) Problems() (map[string]struct{}, error)
- func (t Track) ProblemsLackingExample() ([]string, error)
- func (t Track) Slugs() (map[string]struct{}, error)
- func (t Track) UnconfiguredProblems() ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Slug string Language string Active bool Repository string Exercises []Exercise Deprecated []string Foregone []string SolutionPattern string `json:"solution_pattern"` // contains filtered or unexported fields }
Config is an Exercism track configuration.
type Exercise ¶ added in v1.0.6
Exercise configures metadata about an implemented exercise. It's listed in the config in the order that the exercise will be delivered by the API.
type Track ¶
type Track struct {
// contains filtered or unexported fields
}
Track is a collection of Exercism exercises in a given programming language.
func NewTrack ¶
NewTrack is an exercism language track that lives at path. It uses the config.json in the root of the track to figure out which exercises a track contains.
func (Track) DuplicateSlugs ¶
DuplicateSlugs detects slugs in multiple config categories. If a problem is deprecated, it means that we have the files for it, we're just not serving it in the default response. If a slug is foregone, it means that we've chosen not to implement it, and it should not have a directory.
func (Track) ForegoneViolations ¶
ForegoneViolations indentifies implementations that should not be included. This could be because the problem is too trivial, ridiculously non-trivial, or simply uninteresting.
func (Track) HasValidConfig ¶
HasValidConfig lints the JSON file.
func (Track) MissingProblems ¶
MissingProblems identify problems lacking an implementation. This will complain if the problem slug is listed in the configuration, but there is no corresponding directory for it.
func (Track) Problems ¶
Problems lists all the problem specifications that a track has implemented exercises for.
func (Track) ProblemsLackingExample ¶
ProblemsLackingExample identifies implementations without a solution. This will often be triggered because the implementation's sample solution is not named something with example. This is particularly critical since any file that is in a path not named /[Ee]xample/ will be served by the API, showing the user a possible solution before they have solved the problem themselves.
func (Track) UnconfiguredProblems ¶
UnconfiguredProblems identifies unlisted implementations. This will complain if a directory exists, but is not mentioned anywhere in the config file.