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

Break up the comment parsing to smaller module #251

Open
alpaca-tc opened this issue Feb 18, 2014 · 0 comments
Open

Break up the comment parsing to smaller module #251

alpaca-tc opened this issue Feb 18, 2014 · 0 comments

Comments

@alpaca-tc
Copy link
Contributor

I want to break up the comment parsing in watson-ruby to smaller module. There are three reasons for this.

  • First, extracting comments from a file which contains compound filetype is complex.
  • Second, watson-ruby can not read shebang and detect filetype without extension.
  • Third, Watson's way to extract comments from a file has many incorrect detection.

They are the reasons why I present a suggestion.


Currently I am writing the gem called CommentExtractor. It can easily extract comments from a file as follows.

path = 'path/to/file'
if parser = CommentExtractor::Parser.for(path)
  comments = parser.parse

  comments.each do |c|
    puts "#{c.file}:#{c.line} - #{c.value}" #=> "path/to/file:2 - I am comment"
  end
end

If watson-ruby merged CommentExtractor, it becomes that easier to extract comments.
Let me know if you have any opinion, suggestions or problems on my suggestion.


links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant