CodePadawans / ataru

MIT License
37 stars 3 forks source link

skip markdown in vendor/**.md by default? #76

Closed mmmries closed 9 years ago

mmmries commented 9 years ago

As a newcomer to the gem I found it surprising that Ataru checks all of the .md files for gems in vendor/ directory.

In my case this is something that TravisCI adds. My repository doesn't normally have a vendor directory, but when Travis builds my gem it does a bundle install into a vendor directory and then ataru fails because it checks all of the markdown files inside those vendored gems.

See: https://travis-ci.org/hqmq/docx_templater/jobs/37250279 for an example

madziaf commented 9 years ago

hi Michael, thanks for your comments! I'm trying to understand what you mean with that vendor/ directory. Reading up on it.

skade commented 9 years ago

@madziaf I think the core of the issue is this line

https://travis-ci.org/hqmq/docx_templater/jobs/37250279#L25

bundle install --jobs=3 --retry=3 --deployment

bundle install --deployment installs all gems into the project folder itself (in a subdirectory called vendor). This is to allow you to package the whole thing up with all libraries necessary to run the project.

This means that all *.md files in those gems can suddenly be found by ataru and be picked up as test-cases.

madziaf commented 9 years ago

https://github.com/CodePadawans/ataru/blob/35d07d9b6d0fa5096f7df7ee464cc9d8597ea8aa/lib/ataru/cli/application.rb#L43-L48

I tried that. Does that make sense? Maybe it's too easy - it works, but maybe I'm overlooking something.

mmmries commented 9 years ago

That works, but if I had a docs/vendor.md markdown file it would skip that too since it contains vendor in the name.

What do you think about doing something like this:

def check(*filenames)
  if filenames.length == 0
    filenames = Dir.glob("**/*.md") - Dir.glob("vendor/**/*.md")
  end
  # The rest of the method is the same as before
end

That just takes the list of all markdown files and removes any of them that were found inside the vendor directory. Thoughts?

madziaf commented 9 years ago

@hqmq thank you:) Makes sense of course, I forgot Dir.glob returns an array, so you can simply use -. Cool, will change that!