Skip to content

Commit

Permalink
Merge pull request #1 from sinsoku/support-sord
Browse files Browse the repository at this point in the history
feat: support AaronC81/sord
  • Loading branch information
sinsoku authored Jul 7, 2023
2 parents 1719c5f + cb6469c commit ac6b1ef
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ jobs:
run: bundle exec rake
- name: Run yard with yard-sig
run: bundle exec yard
- name: Run sord
run: bundle exec sord --rbs sig/sord.rbs
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ gemspec
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.21"
gem "sord"
gem "yard"
17 changes: 17 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
commander (4.6.0)
highline (~> 2.0.0)
diff-lcs (1.5.0)
highline (2.0.3)
json (2.6.3)
parallel (1.23.0)
parlour (5.0.0)
commander (~> 4.5)
parser
rainbow (~> 3.0)
sorbet-runtime (>= 0.5)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
Expand Down Expand Up @@ -47,17 +55,26 @@ GEM
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
sorbet-runtime (0.5.10902)
sord (6.0.0)
commander (~> 4.5)
parlour (~> 5.0)
rbs (~> 3.0)
sorbet-runtime
yard
unicode-display_width (2.4.2)
yard (0.9.34)

PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-linux

DEPENDENCIES
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.21)
sord
yard
yard-sig!

Expand Down
2 changes: 2 additions & 0 deletions lib/yard-sig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class Error < StandardError; end
class SigDirective < ::YARD::Tags::Directive
# @!sig () -> void
def call
return unless object

validate_arguments_forwarding!

sig = Sig.new(tag.text, object.parameters, object.namespace.path)
Expand Down
15 changes: 15 additions & 0 deletions spec/yard_sig_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,19 @@ def m(...); end

expect(log).to have_received(:warn).with("arguments forwarding is not supported.")
end

it "does not cause errors within sord processing" do
YARD.parse_string(<<~RUBY)
# @!sig (Integer) -> void
def m(a); end
RUBY
obj = YARD::Registry.at("#m")

# refs: https://github.com/AaronC81/sord/blob/6.0.0/lib/sord/generator.rb#L174-L177
parser = YARD::Docstring.parser
parser.parse(obj.docstring.all)
docs_array = parser.text.split("\n")

expect(docs_array).to eq([])
end
end

0 comments on commit ac6b1ef

Please sign in to comment.