Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Aug 27, 2019
1 parent a17ca90 commit fa42216
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 3 deletions.
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: python
cache: bundler
python:
- "3.6"
install:
# Install the latest release of Vale:
- go get github.com/errata-ai/vale

- bundle install --jobs=3

- pip install yamllint
- pip install markdata
- pip install pyyaml
before_script:
- yamllint -c '.yamllint.yml' Joblint
script:
- cucumber
- zip -r Joblint.zip Joblint -x "*.DS_Store"
deploy:
provider: releases
api_key: $GITHUB_TOKEN
file: Joblint.zip
skip_cleanup: true
on:
tags: true
8 changes: 8 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rules:
# We only include a single document (without directives) in our rules, so
# the extra markup is unnecessary.
document-start: disable
# Many rules include a `link` key that can be relatively long.
#
# TODO: Should we change this?
line-length: disable
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'aruba', '~> 0.14.3'
2 changes: 1 addition & 1 deletion Joblint/Hair.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extends: existence
message: "Avoid using '%s'"
description: "The use of '%s' indicates that you\'re only looking for male developers."
description: "The use of '%s' indicates that you're only looking for male developers."
ignorecase: true
level: error
tokens:
Expand Down
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# Joblint
A Vale-compatible implementation of the Joblint linter
# Joblint [![Build Status](https://travis-ci.org/errata-ai/Joblint.svg?branch=master)](https://travis-ci.org/errata-ai/Joblint) ![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)

> [`Joblint`](https://github.com/rowanmanning/joblint): Test tech job posts for issues with sexism, culture, expectations, and recruiter fails.
This repository contains a [Vale-compatible](https://github.com/errata-ai/vale) implementation of the guidelines enforced by the `Joblint` ([LICENSE](https://github.com/rowanmanning/joblint/blob/master/LICENSE)) linter.

## Getting Started

> :exclamation: Joblint requires Vale >= **1.7.0**. :exclamation:
Download the [latest release](https://github.com/errata-ai/Joblint/releases), copy the "Joblint" directory to your `StylesPath`, and include it in your configuration file:

```ini
# This goes in a file named either `.vale.ini` or `_vale.ini`.
StylesPath = path/to/some/directory
MinAlertLevel = warning # suggestion, warning or error

# Only Markdown and .txt files; change to whatever you're using.
[*.{md,txt}]
# List of styles to load.
BasedOnStyles = Joblint
```

See [Usage](https://github.com/errata-ai/vale/#usage) for more information.
32 changes: 32 additions & 0 deletions features/rules.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Feature: Rules

Scenario: Basic test case
When I test "basic"
Then the output should contain exactly:
"""
fail.md:3:21:Joblint.Profanity:Remove 'fucking'
fail.md:3:37:Joblint.TechTerms:Use 'JavaScript' instead of 'java script'
fail.md:3:49:Joblint.Gendered:Avoid using 'dude'
fail.md:3:76:Joblint.DumbTitles:Avoid using 'ninja'
fail.md:4:19:Joblint.TechTerms:Use 'JavaScript' instead of 'javascript'
fail.md:4:59:Joblint.Bro:Avoid using 'crush'
fail.md:6:13:Joblint.Profanity:Remove 'damn'
fail.md:6:18:Joblint.Sexualised:Avoid using 'sexy'
fail.md:6:49:Joblint.LegacyTech:Avoid using 'Frontpage'
fail.md:6:85:Joblint.DevEnv:Don't specify a development environment unless absolutely necessary.
fail.md:6:145:Joblint.Competitive:Avoid using 'top of your game'
fail.md:6:179:Joblint.Visionary:Avoid using 'enlightened'
fail.md:8:69:Joblint.LegacyTech:Avoid using 'VBScript'
fail.md:8:91:Joblint.Gendered:Avoid using 'He'
fail.md:8:112:Joblint.Starter:Avoid using 'hit the ground running'
fail.md:8:145:Joblint.Competitive:Avoid using 'cutting-edge'
fail.md:8:159:Joblint.Meritocracy:Reevaluate the use of 'meritocratic'
fail.md:10:24:Joblint.Benefits:Avoid using 'pool table'
fail.md:10:52:Joblint.Benefits:Avoid using 'beer'
fail.md:10:71:Joblint.Reassure:Avoid using 'drama-free'
fail.md:10:118:Joblint.DumbTitles:Avoid using 'heroic'
fail.md:13:21:Joblint.Hair:Avoid using 'beards'
real.md:3:32:Joblint.TechTerms:Use 'JavaScript' instead of 'java script'
real.md:3:44:Joblint.Gendered:Avoid using 'guy'
real.md:4:19:Joblint.TechTerms:Use 'JavaScript' instead of 'javascript'
"""
6 changes: 6 additions & 0 deletions features/steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmd = 'vale --output=line --sort --normalize --relative'

When(/^I test "(.*)"$/) do |rule|
step %(I cd to "../../fixtures/#{rule}")
step %(I run `#{cmd} .`)
end
1 change: 1 addition & 0 deletions features/support/aruba.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'aruba/cucumber'
6 changes: 6 additions & 0 deletions fixtures/basic/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
StylesPath = ../../

MinAlertLevel = suggestion

[*.md]
BasedOnStyles = Joblint
13 changes: 13 additions & 0 deletions fixtures/basic/fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Sup.

We'd like to hire a fucking awesome java script dude, please. A proper web ninja!
If you're good at javascript then please apply and we can crush code together!

Our site is damn sexy, it was all built with MS Frontpage originally but now we use Dreamweaver mostly. It's important to us that you're at the top of your game, we want to feel enlightened whenever we read your code.

We'd also like candidates to be able to turn their hand to a little VBScript if possible. He should be able to hit the ground running – we're a cutting-edge, meritocratic company so we can't afford to take on dead-weight.

Our benefits include a pool table, a fully-stocked beer fridge, and a drama-free environment – we like to reward our heroic dev team properly!

Call 01234567890 to apply.
Candidates with rad beards get extra credit!
6 changes: 6 additions & 0 deletions fixtures/basic/pass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Hi.

We'd like to hire an excellent JavaScript developer, please.
If you're good at JavaScript then please apply.

Thank you.
6 changes: 6 additions & 0 deletions fixtures/basic/real.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Hi.

We'd like to hire an excellent java script guy, please.
If you're good at javascript then please apply.

Thank you.

0 comments on commit fa42216

Please sign in to comment.