Codebase list golang-github-jdkato-prose / 2c92aac
Add fuzzing to the `transform` package Joseph Kato 4 years ago
5 changed file(s) with 82 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
0 dist: bionic
01 language: go
12 go:
2 - 1.7
3 - 1.8
3 - "1.11"
4
5 services:
6 - docker
7
48 before_install:
59 - go get github.com/mattn/goveralls
10
611 install:
712 - make setup
813 - make build
14
915 script:
1016 - make test
11 - bash scripts/cover.sh
17 # Coveralls is down for maintenance currently
18 # - bash scripts/cover.sh
19
20 jobs:
21 include:
22 - stage: Build, Unit-Tests & Fuzz-Tests
23 if: branch = master AND type IN (pull_request)
24 go: 1.12.x
25 script:
26 - bash scripts/fuzzit.sh regression
27
28 - stage: Fuzzit (Fuzzing)
29 if: branch = master AND type IN (push)
30 go: 1.12.x
31 script:
32 - bash scripts/fuzzit.sh fuzzing
0 # prose [![Build Status](https://travis-ci.org/jdkato/prose.svg?branch=master)](https://travis-ci.org/jdkato/prose) [![Build status](https://ci.appveyor.com/api/projects/status/24bepq85nnnk4scr/branch/v2?svg=true)](https://ci.appveyor.com/project/jdkato/prose/branch/v2) [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/gopkg.in/jdkato/prose.v2) [![Coverage Status](https://coveralls.io/repos/github/jdkato/prose/badge.svg?branch=v2)](https://coveralls.io/github/jdkato/prose?branch=v2) [![Go Report Card](https://goreportcard.com/badge/github.com/jdkato/prose)](https://goreportcard.com/report/github.com/jdkato/prose) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/avelino/awesome-go#natural-language-processing)
0 # prose [![Build Status](https://travis-ci.org/jdkato/prose.svg?branch=master)](https://travis-ci.org/jdkato/prose) [![fuzzit](https://app.fuzzit.dev/badge?org_id=prose=master)](https://fuzzit.dev) [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/gopkg.in/jdkato/prose.v2) [![Coverage Status](https://coveralls.io/repos/github/jdkato/prose/badge.svg?branch=v2)](https://coveralls.io/github/jdkato/prose?branch=v2) [![Go Report Card](https://goreportcard.com/badge/github.com/jdkato/prose)](https://goreportcard.com/report/github.com/jdkato/prose) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/avelino/awesome-go#natural-language-processing)
11
22
33 `prose` is a natural language processing library (English only) in *pure Go*. It supports tokenization, segmentation, part-of-speech tagging, and named-entity extraction.
0 #!/bin/bash
1 #
2 # Helper script for working with fuzzit.dev:
3 #
4 # https://github.com/fuzzitdev/example-go
5 #
6 # Based on:
7 #
8 # https://github.com/google/syzkaller/blob/master/fuzzit.sh
9 set -eux
10
11 function target {
12 go-fuzz-build -libfuzzer -func $3 -o fuzzer.a $2
13 clang -fsanitize=fuzzer fuzzer.a -o fuzzer
14
15 ./fuzzit create target $1 || true
16 ./fuzzit create job $LOCAL --type fuzzing --branch $TRAVIS_BRANCH --revision $TRAVIS_COMMIT prose/$1 ./fuzzer
17 }
18
19 go get -u github.com/dvyukov/go-fuzz/go-fuzz-build
20 wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.12/fuzzit_Linux_x86_64
21 chmod a+x fuzzit
22 if [ "$1" = "fuzzing" ]; then
23 ./fuzzit auth $FUZZIT_API_KEY
24 export LOCAL=""
25 else
26 export LOCAL="--local"
27 fi
28
29 target prose-transform ./transform Fuzz
7777 break
7878 }
7979 }
80 return strings.TrimSpace(string(unicode.ToLower(first)) + Pascal(s)[1:])
80 body := Pascal(s)
81 if len(body) > 1 {
82 return strings.TrimSpace(string(unicode.ToLower(first)) + body[1:])
83 }
84 return s
8185 }
0 // +build gofuzz
1
2 package transform
3
4 func Fuzz(data []byte) int {
5 s := string(data)
6
7 // Case transformations
8 Simple(s)
9 Snake(s)
10 Dash(s)
11 Dot(s)
12 Constant(s)
13 Pascal(s)
14 Camel(s)
15
16 // Title converters
17 tc := NewTitleConverter(APStyle)
18 tc.Title(s)
19
20 return 0
21 }