Skip to content
This repository was archived by the owner on Jun 4, 2019. It is now read-only.

Commit e2e1423

Browse files
committed
Adds 'skip_read' flag for comments only containing :nodoc:
* skip_read flag set by comments that eql ':nodoc:' * prevents emails from being sent that encourage subscriber to read docs which are essentiall blank * side effect that these docs won't be sent out for write either
1 parent c7f626b commit e2e1423

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

app/models/repo_subscription.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def unassigned_read_doc_methods(limit = self.read_limit)
3030
repo.methods_with_docs.
3131
active.
3232
where("doc_methods.id not in (?)", pre_assigned_doc_method_ids).
33+
where(skip_read: false)
3334
order("random()").
3435
limit(limit || DEFAULT_READ_LIMIT)
3536
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddSkipReadToDocMethods < ActiveRecord::Migration
2+
def change
3+
add_column :doc_methods, :skip_read, :boolean, default: false
4+
end
5+
end

db/schema.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended that you check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(version: 20140524105909) do
14+
ActiveRecord::Schema.define(version: 20141202022842) do
1515

1616
# These are extensions that must be enabled in order to support this database
1717
enable_extension "plpgsql"
@@ -65,6 +65,7 @@
6565
t.string "file"
6666
t.boolean "skip_write", default: false
6767
t.boolean "active", default: true
68+
t.boolean "skip_read", default: false
6869
end
6970

7071
add_index "doc_methods", ["repo_id"], name: "index_doc_methods_on_repo_id", using: :btree

lib/docs_doctor/parsers/ruby/yard.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ def store_entity(obj, repo)
4040
# document original method instead
4141
# don't document initialize
4242
skip_write = obj.is_attribute? || obj.is_alias? || (obj.respond_to?(:is_constructor?) && obj.is_constructor?)
43+
skip_read = obj.docstring.strip.eql? ":nodoc:"
4344

4445
method = repo.doc_methods.where(name: obj.name, path: obj.path).first_or_initialize
45-
method.assign_attributes(line: obj.line, file: obj.file, skip_write: skip_write) # line and file will change, do not want to accidentally create duplicate methods
46+
method.assign_attributes(line: obj.line, file: obj.file, skip_write: skip_write, skip_read: skip_read) # line and file will change, do not want to accidentally create duplicate methods
4647
unless method.save
4748
puts "Could not store YARD object, missing one or more properties: #{method.errors.inspect}"
4849
return false

0 commit comments

Comments
 (0)