configlet

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package configlet sanity-checks Exercism track configuration.

A track consists of a collection of problems in a single language. Each problem has a test suite, an example solution, and any supporting files that are necessary to solve the problem.

The configuration serves two purposes:

1. It helps implementors ensure that all the problems are valid.

2. It provides the API with a sort order for delivering problems.

Index

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
	Problems   []string
	Ignored    []string
	Deprecated []string
	Foregone   []string
	// contains filtered or unexported fields
}

Config is an Exercism track configuration.

func Load

func Load(file string) (Config, error)

Load loads an Exercism track configuration.

func (Config) IgnoredDirs

func (c Config) IgnoredDirs() []string

IgnoredDirs merges configured and default dirs. Some directories will never, ever represent an Exercism problem.

type Track

type Track struct {
	// contains filtered or unexported fields
}

Track represents a set of Exercism problems. Typically these will all be in the same language, defined in github.com/exercism/x<LANGUAGE>.

func NewTrack

func NewTrack(path string) Track

NewTrack finds a Track at path. It will look for a config.json in the root of that path. This file will list problems that correspond to directories which contain a test suite and supporting files, along with an example solution.

func (Track) Config

func (t Track) Config() (Config, error)

Config loads a track's configuration.

func (Track) Dirs

func (t Track) Dirs() (map[string]struct{}, error)

Dirs is a list of all the directories in the root of a track.

func (Track) DuplicateSlugs

func (t Track) DuplicateSlugs() ([]string, error)

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 directory is ignored, it means that it's not a problem. 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

func (t Track) ForegoneViolations() ([]string, error)

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

func (t Track) HasValidConfig() bool

HasValidConfig lints the JSON file.

func (Track) MissingProblems

func (t Track) MissingProblems() ([]string, error)

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

func (t Track) Problems() (map[string]struct{}, error)

Problems lists all the configured problems.

func (Track) ProblemsLackingExample

func (t Track) ProblemsLackingExample() ([]string, error)

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) Slugs

func (t Track) Slugs() (map[string]struct{}, error)

Slugs is a list of all problems mentioned in the config.

func (Track) UnconfiguredProblems

func (t Track) UnconfiguredProblems() ([]string, error)

UnconfiguredProblems identifies unlisted implementations. This will complain if a directory exists, but is not mentioned anywhere in the config file.

Jump to

Keyboard shortcuts

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