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

Adds 'skip_read' flag for comments only containing :nodoc: #10

Merged
merged 1 commit into from
Dec 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/repo_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def unassigned_read_doc_methods(limit = self.read_limit)
repo.methods_with_docs.
active.
where("doc_methods.id not in (?)", pre_assigned_doc_method_ids).
where(skip_read: false).
order("random()").
limit(limit || DEFAULT_READ_LIMIT)
end
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20141202022842_add_skip_read_to_doc_methods.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddSkipReadToDocMethods < ActiveRecord::Migration
def change
add_column :doc_methods, :skip_read, :boolean, default: false
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20140524105909) do
ActiveRecord::Schema.define(version: 20141202022842) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -65,6 +65,7 @@
t.string "file"
t.boolean "skip_write", default: false
t.boolean "active", default: true
t.boolean "skip_read", default: false
end

add_index "doc_methods", ["repo_id"], name: "index_doc_methods_on_repo_id", using: :btree
Expand Down
3 changes: 2 additions & 1 deletion lib/docs_doctor/parsers/ruby/yard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ def store_entity(obj, repo)
# document original method instead
# don't document initialize
skip_write = obj.is_attribute? || obj.is_alias? || (obj.respond_to?(:is_constructor?) && obj.is_constructor?)
skip_read = obj.docstring.strip.eql? ":nodoc:"

method = repo.doc_methods.where(name: obj.name, path: obj.path).first_or_initialize
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
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
unless method.save
puts "Could not store YARD object, missing one or more properties: #{method.errors.inspect}"
return false
Expand Down