Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SourceKitten] No longer count initializers with parameters as undocumented #184

Merged
merged 3 commits into from
Mar 23, 2015
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

##### Bug Fixes

* None.
* No longer count initializers with parameters as undocumented.
[JP Simard](https://github.com/jpsim)
[#183](https://github.com/realm/jazzy/issues/183)

## 0.1.2

Expand Down
11 changes: 11 additions & 0 deletions lib/jazzy/source_declaration/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,21 @@ def mark?
kind == 'source.lang.swift.syntaxtype.comment.mark'
end

def should_document?
declaration? && !param?
end

def declaration?
kind =~ /^source\.lang\.swift\.decl\..*/
end

def param?
# SourceKit strangely categorizes initializer parameters as local
# variables, so both kinds represent a parameter in jazzy.
kind == 'source.lang.swift.decl.var.parameter' ||
kind == 'source.lang.swift.decl.var.local'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment saying why var.local is a param

end

def self.overview
Type.new('Overview')
end
Expand Down
2 changes: 1 addition & 1 deletion lib/jazzy/sourcekitten.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def self.make_source_declarations(docs)
if declaration.type.mark? && doc['key.name'].start_with?('MARK: ')
current_mark = SourceMark.new(doc['key.name'])
end
next unless declaration.type.declaration?
next unless declaration.type.should_document?

unless declaration.type.name
raise 'Please file an issue on ' \
Expand Down
2 changes: 1 addition & 1 deletion spec/integration_specs
Submodule integration_specs updated 120 files