summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAditya Prakash <aditya.prakash132@gmail.com>2016-03-07 12:57:29 +0530
committerAditya Prakash <aditya.prakash132@gmail.com>2016-03-08 21:14:07 +0530
commitc4f1238b64714385be143ae121a51f320ca73f4e (patch)
tree976b5009513c09abe601956cb1aec9cd69f1061d
parent397663040c88d7f760c3c21a1d15c72fc41368e7 (diff)
downloadbundler-c4f1238b64714385be143ae121a51f320ca73f4e.tar.gz
Add test for checking quality of documentation
-rw-r--r--spec/quality_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb
index c68bfa1533..8fccdbba99 100644
--- a/spec/quality_spec.rb
+++ b/spec/quality_spec.rb
@@ -40,6 +40,30 @@ describe "The library itself" do
"#{filename} has spaces on the EOL on lines #{failing_lines.join(", ")}"
end
+ def check_for_expendable_words(filename)
+ failing_line_message = []
+ useless_words = /\b(actually|obviously|just|clearly|basically|really)\b/i
+
+ File.readlines(filename).each_with_index do |line, number|
+ next unless word_found = useless_words.match(line)
+ failing_line_message << "#{filename} has '#{word_found}' on line #{number + 1}. Avoid using these kinds of weak modifiers."
+ end
+
+ failing_line_message unless failing_line_message.empty?
+ end
+
+ def check_for_specific_pronouns(filename)
+ failing_line_message = []
+ specific_pronouns = /\b(he|she|his|hers|him|her|himself|herself)\b/i
+
+ File.readlines(filename).each_with_index do |line, number|
+ next unless word_found = specific_pronouns.match(line)
+ failing_line_message << "#{filename} has '#{word_found}' on line #{number + 1}. Use more generic pronouns in documentation."
+ end
+
+ failing_line_message unless failing_line_message.empty?
+ end
+
RSpec::Matchers.define :be_well_formed do
match(&:empty?)
@@ -73,6 +97,19 @@ describe "The library itself" do
expect(error_messages.compact).to be_well_formed
end
+ it "maintains language quality of the documentation" do
+ included = /ronn/
+ error_messages = []
+ Dir.chdir(File.expand_path("../../man", __FILE__)) do
+ `git ls-files -z`.split("\x0").each do |filename|
+ next unless filename =~ included
+ error_messages << check_for_expendable_words(filename)
+ error_messages << check_for_specific_pronouns(filename)
+ end
+ end
+ expect(error_messages.compact).to be_well_formed
+ end
+
it "can still be built" do
Dir.chdir(root) do
`gem build bundler.gemspec`