Documentation ¶
Overview ¶
Package qa implements quality assurance helpers.
Index ¶
- Variables
- func TestCanonicalISSN(is finc.IntermediateSchema) error
- func TestCurrencyInTitle(is finc.IntermediateSchema) error
- func TestDate(is finc.IntermediateSchema) error
- func TestExcessivePunctuation(is finc.IntermediateSchema) error
- func TestFeasibleAuthor(is finc.IntermediateSchema) error
- func TestHasURL(is finc.IntermediateSchema) error
- func TestKeyLength(is finc.IntermediateSchema) error
- func TestPageCount(is finc.IntermediateSchema) error
- func TestPublisher(is finc.IntermediateSchema) error
- func TestRepeatedSlashInDOI(is finc.IntermediateSchema) error
- func TestSubtitleRepetition(is finc.IntermediateSchema) error
- func TestTitleTooLong(is finc.IntermediateSchema) error
- func TestURL(is finc.IntermediateSchema) error
- type Issue
- type Tester
- type TesterFunc
Constants ¶
This section is empty.
Variables ¶
var ( // EarliestDate is the earliest publication date we accept. EarliestDate = time.Date(1458, 1, 1, 0, 0, 0, 0, time.UTC) // LatestDate represents the latest publication date we accept. Five years into the future. LatestDate = time.Now().AddDate(5, 0, 0) ErrInvalidEndPage = errors.New("broken end page") ErrInvalidStartPage = errors.New("broken start page") ErrEndPageBeforeStartPage = errors.New("end page before start page") ErrSuspiciousPageCount = errors.New("suspicious page count") ErrInvalidURL = errors.New("invalid URL") ErrKeyTooLong = fmt.Errorf("record id exceeds key limit of %d", span.KeyLengthLimit) ErrPublicationDateTooEarly = errors.New("publication date too early") ErrRepeatedSubtitle = errors.New("repeated subtitle") ErrCurrencyInTitle = errors.New("currency in title") ErrExcessivePunctuation = errors.New("excessive punctuation") ErrNoPublisher = errors.New("no publisher") ErrShortAuthorName = errors.New("very short author name") ErrEtAlAuthorName = errors.New("et al in author name") ErrNAInAuthorName = errors.New("NA in author name") ErrWhitespaceAuthor = errors.New("whitespace author") ErrHTMLEntityInAuthorName = errors.New("html entity in author name") ErrRepeatedSlashInDOI = errors.New("repeated slash in DOI") ErrNoURL = errors.New("record has no URL") ErrNonCanonicalISSN = errors.New("non-canonical ISSN") ErrAtSignInAuthorName = errors.New("@ in author name") ErrHTTPInAuthorName = errors.New("http: in author name") ErrBlacklistedWordInAuthorName = errors.New("blacklisted word in author name") ErrLongAuthorName = errors.New("long author name") ErrPageZero = errors.New("page is zero") ErrTitleTooLong = errors.New("title too long") )
var TestSuite = []Tester{ TesterFunc(TestKeyLength), TesterFunc(TestPageCount), TesterFunc(TestURL), TesterFunc(TestDate), TesterFunc(TestSubtitleRepetition), TesterFunc(TestCurrencyInTitle), TesterFunc(TestExcessivePunctuation), TesterFunc(TestPublisher), TesterFunc(TestFeasibleAuthor), TesterFunc(TestRepeatedSlashInDOI), TesterFunc(TestHasURL), TesterFunc(TestCanonicalISSN), TesterFunc(TestTitleTooLong), }
Functions ¶
func TestCanonicalISSN ¶
func TestCanonicalISSN(is finc.IntermediateSchema) error
TestCanonicalISSN checks for the canonical ISSN format 1234-567X.
func TestCurrencyInTitle ¶
func TestCurrencyInTitle(is finc.IntermediateSchema) error
TestCurrencyInTitle, e.g. http://goo.gl/HACBcW Cartier , Marie . Baby, You Are My Religion: Women, Gay Bars, and Theology Before Stonewall . Gender, Theology and Spirituality. Durham, UK: Acumen, 2013. xii+256 pp. $90.00 (cloth); $29.95 (paper).
func TestDate ¶
func TestDate(is finc.IntermediateSchema) error
TestDate checks for suspicious dates, refs. #5686.
func TestExcessivePunctuation ¶
func TestExcessivePunctuation(is finc.IntermediateSchema) error
TestExcessivePunctuation should detect things like this title: CrossRef????????????? https://goo.gl/AD0V1o
func TestFeasibleAuthor ¶
func TestFeasibleAuthor(is finc.IntermediateSchema) error
TestFeasibleAuthor checks for a few suspicious authors patterns, refs. #4892, #4940, #5895.
func TestHasURL ¶
func TestHasURL(is finc.IntermediateSchema) error
TestHasURL checks for a value in URL. This is no URL validation.
func TestKeyLength ¶
func TestKeyLength(is finc.IntermediateSchema) error
TestKeyLength checks the length of the record id. memcachedb limits is 250 bytes.
func TestPageCount ¶
func TestPageCount(is finc.IntermediateSchema) error
TestPageCount checks, wether the start and end page look plausible.
func TestPublisher ¶
func TestPublisher(is finc.IntermediateSchema) error
TestPublisher tests, whether a publisher is given.
func TestRepeatedSlashInDOI ¶
func TestRepeatedSlashInDOI(is finc.IntermediateSchema) error
TestRepeatedSlashInDOI checks a DOI for repeated slashes, refs. #6312.
func TestSubtitleRepetition ¶
func TestSubtitleRepetition(is finc.IntermediateSchema) error
TestSubtitleRepetition, refs #6553.
func TestTitleTooLong ¶ added in v0.1.129
func TestTitleTooLong(is finc.IntermediateSchema) error
TestTitleTooLong returns an err if the title exceeds a limit, refs. #9230.
Types ¶
type Issue ¶
type Issue struct { Err error `json:"err"` Record finc.IntermediateSchema `json:"record"` }
func (Issue) MarshalJSON ¶
type Tester ¶
type Tester interface {
TestRecord(finc.IntermediateSchema) error
}
Tester is a intermediate record checker.
type TesterFunc ¶
type TesterFunc func(finc.IntermediateSchema) error
TesterFunc makes a function satisfy an interface.
func (TesterFunc) TestRecord ¶
func (f TesterFunc) TestRecord(is finc.IntermediateSchema) error
TestRecord delegates test to the given func.