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

Commit

Permalink
Merge pull request #10 from KyFaSt/master
Browse files Browse the repository at this point in the history
Adds 'skip_read' flag for comments only containing :nodoc:
  • Loading branch information
schneems committed Dec 3, 2014
2 parents c7f626b + ff99a96 commit 9781523
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
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

0 comments on commit 9781523

Please sign in to comment.