Skip to content

Commit 28d56d6

Browse files
committed
Add tests
1 parent 90618a9 commit 28d56d6

10 files changed

Lines changed: 167 additions & 2 deletions

File tree

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: python
2+
cache: bundler
3+
python:
4+
- "3.6"
5+
install:
6+
# Install the latest release of Vale:
7+
- go get github.com/errata-ai/vale
8+
9+
- bundle install --jobs=3
10+
11+
- pip install yamllint
12+
- pip install markdata
13+
- pip install pyyaml
14+
before_script:
15+
- yamllint -c '.yamllint.yml' proselint
16+
script:
17+
- cucumber
18+
- zip -r proselint.zip proselint -x "*.DS_Store"
19+
deploy:
20+
provider: releases
21+
api_key: $GITHUB_TOKEN
22+
file: proselint.zip
23+
skip_cleanup: true
24+
on:
25+
tags: true

.yamllint.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
rules:
2+
# We only include a single document (without directives) in our rules, so
3+
# the extra markup is unnecessary.
4+
document-start: disable
5+
# Many rules include a `link` key that can be relatively long.
6+
#
7+
# TODO: Should we change this?
8+
line-length: disable

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'aruba', '~> 0.14.3'

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1-
# proselint
1+
# proselint [![Build Status](https://travis-ci.org/errata-ai/proselint.svg?branch=master)](https://travis-ci.org/errata-ai/proselint) ![Vale version](https://img.shields.io/badge/vale-%3E%3D%20v1.7.0-blue.svg) ![license](https://img.shields.io/github/license/mashape/apistatus.svg)
2+
3+
> [`proselint`](https://github.com/amperser/proselint/) places the world’s greatest writers and editors by your side, where they whisper suggestions on how to improve your prose.
4+
5+
This repository contains a [Vale-compatible](https://github.com/errata-ai/vale) implementation of the guidelines enforced by the `proselint` ([LICENSE](https://github.com/amperser/proselint/blob/master/LICENSE.md)) linter.
6+
7+
## Getting Started
8+
9+
> :exclamation: proselint requires Vale >= **1.7.0**. :exclamation:
10+
11+
Download the [latest release](https://github.com/errata-ai/proselint/releases), copy the "proselint" directory to your `StylesPath`, and include it in your configuration file:
12+
13+
```ini
14+
# This goes in a file named either `.vale.ini` or `_vale.ini`.
15+
StylesPath = path/to/some/directory
16+
MinAlertLevel = warning # suggestion, warning or error
17+
18+
# Only Markdown and .txt files; change to whatever you're using.
19+
[*.{md,txt}]
20+
# List of styles to load.
21+
BasedOnStyles = proselint
22+
```
23+
24+
See [Usage](https://github.com/errata-ai/vale/#usage) for more information.

features/rules.feature

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Feature: Rules
2+
3+
Scenario: Cliches
4+
When I test "basic"
5+
Then the output should contain exactly:
6+
"""
7+
test.md:1:19:proselint.Nonwords:Consider using 'regardless' instead of 'irregardless'.
8+
test.md:3:18:proselint.Archaisms:'perchance' is archaic.
9+
test.md:7:6:proselint.Cliches:'a chip off the old block' is a cliche.
10+
test.md:9:12:proselint.Cliches:'a fate worse than death' is a cliche.
11+
test.md:11:20:proselint.Spelling:Inconsistent spelling of 'color'.
12+
test.md:11:61:proselint.Spelling:Inconsistent spelling of 'center'.
13+
test.md:13:9:proselint.CorporateSpeak:'circle back around' is corporate speak.
14+
test.md:15:5:proselint.Cursing:Consider replacing 'shit'.
15+
test.md:17:16:proselint.DateCase:With lowercase letters, the periods are standard.
16+
test.md:17:37:proselint.DateSpacing:It's standard to put a space before '7a.m.'
17+
test.md:17:58:proselint.DateMidnight:Use 'midnight' or 'noon'.
18+
test.md:17:81:proselint.DateRedundancy:'a.m.' is always morning; 'p.m.' is always night.
19+
test.md:19:18:proselint.Uncomparables:'most correct' is not comparable
20+
test.md:21:1:proselint.Hedging:'I would argue that' is hedging.
21+
test.md:23:4:proselint.Hyperbole:'exaggerated!!!' is hyperbolic.
22+
test.md:25:14:proselint.Jargon:'in the affirmative' is jargon.
23+
test.md:27:10:proselint.Illusions:'the the' - There's a lexical illusion here.
24+
test.md:29:14:proselint.LGBTOffensive:'fag' is offensive. Remove it or consider the context.
25+
test.md:29:44:proselint.LGBTTerms:Consider using 'sexual orientation' instead of 'sexual preference'.
26+
test.md:31:10:proselint.Malapropisms:'the Infinitesimal Universe' is a malapropism.
27+
test.md:33:1:proselint.Apologizing:Excessive apologizing: 'More research is needed'
28+
test.md:35:1:proselint.But:Do not start a paragraph with a 'but'.
29+
test.md:37:9:proselint.Currency:Incorrect use of symbols in '$10 dollars'.
30+
test.md:39:14:proselint.Oxymorons:'exact estimate' is an oxymoron.
31+
test.md:41:38:proselint.GenderBias:Consider using 'lawyer' instead of 'lady lawyer'.
32+
test.md:43:11:proselint.Skunked:'impassionate' is a bit of a skunked term — impossible to use without issue.
33+
test.md:45:21:proselint.DenizenLabels:Did you mean 'Hong Konger'?
34+
test.md:47:13:proselint.AnimalLabels:Consider using 'avine' instead of 'bird-like'.
35+
test.md:49:20:proselint.Typography:Consider using the '©' symbol instead of '(C)'.
36+
test.md:49:40:proselint.Typography:Consider using the '™' symbol instead of '(tm)'.
37+
test.md:49:56:proselint.Typography:Consider using the '®' symbol instead of '(R)'.
38+
test.md:49:79:proselint.Typography:Consider using the '×' symbol instead of '2 x 2'.
39+
test.md:51:27:proselint.Diacritical:Consider using 'Beyoncé' instead of 'Beyonce'.
40+
test.md:51:36:proselint.P-Value:You should use more decimal places, unless 'p = 0.00' is really true.
41+
test.md:51:47:proselint.Needless:Prefer 'abolition' over 'abolishment'
42+
"""

features/steps.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cmd = 'vale --output=line --sort --normalize --relative'
2+
3+
When(/^I test "(.*)"$/) do |rule|
4+
step %(I cd to "../../fixtures/#{rule}")
5+
step %(I run `#{cmd} .`)
6+
end

features/support/aruba.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require 'aruba/cucumber'

fixtures/basic/.vale.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
StylesPath = ../../
2+
3+
MinAlertLevel = suggestion
4+
5+
[*.md]
6+
BasedOnStyles = proselint

fixtures/basic/test.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
The test was good irregardless.
2+
3+
I want to sleep, perchance to dream.
4+
5+
It's a matter of concern.
6+
7+
He's a chip off the old block.
8+
9+
Worse than a fate worse than death.
10+
11+
Painting colour on color. The centre of the arts is the art center.
12+
13+
We will circle back around to it.
14+
15+
Bad shit in this phrase. The QB is named ball licker.
16+
17+
It happened at 7 am. It happened at 7a.m. It happened at 12 a.m. It happened at 7 a.m. in the morning.
18+
19+
This sentence is most correct.
20+
21+
I would argue that this is a good test.
22+
23+
So exaggerated!!!
24+
25+
I agree it's in the affirmative.
26+
27+
Paris in the the springtime.
28+
29+
I once met a fag. I once met a gay man. My sexual preference is for women.
30+
31+
Found in the Infinitesimal Universe.
32+
33+
More research is needed.
34+
35+
But I never start with the word "but".
36+
37+
It cost $10 dollars.
38+
39+
He needed an exact estimate.
40+
41+
The legal team had two lawyers and a lady lawyer.
42+
43+
I gave an impassionate defence of the situation.
44+
45+
He was definitely a Hong Kongite.
46+
47+
It was some bird-like creature.
48+
49+
Show me the money! (C) The Fresh Maker (tm) Just Do It (R) It is obvious that 2 x 2 = 4
50+
51+
He saw the performance by Beyonce (p = 0.00). abolishment is a needless variant.

proselint/AnimalLabels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
extends: substitution
2-
message: Consider using '%s' instead of '%s'.
2+
message: "Consider using '%s' instead of '%s'."
33
level: error
44
swap:
55
(?:bull|ox)-like: taurine

0 commit comments

Comments
 (0)