CodePadawans / ataru

MIT License
37 stars 3 forks source link

Start checking gems with ataru. #56

Open emig opened 10 years ago

emig commented 10 years ago

In order to excercice the functionality, let's try it out with some gems. We will surely find many exceptional cases, that will give us more information on how the people write their documentation code. I'll propose a short list of problematic tested gems as output of this issue, with comments on how ataru performed on them.

madziaf commented 10 years ago

PadawansMoon - works brazil - documentation fix done TimeDifference - works when Readme adjusted to ataru requirements anima - complete chaos

moonglum commented 10 years ago

Great :+1: Can I help with the anima chaos? :smile:

madziaf commented 10 years ago

@moonglum anima worked today for me, meaning I could use it with ataru, and now I'm getting again crazy 'You may have encountered a bug in the Ruby interpreter or extension libraries.' I did bundle update, bundle install, didn't help:/

moonglum commented 10 years ago

@madziaf Ok, that's sad :unamused: Let's look at this on Monday, ok?

moonglum commented 9 years ago

More ideas for gems:

moonglum commented 9 years ago

Even more:

madziaf commented 9 years ago

gem "ataru", :git => "git://github.com/CodePadawans/ataru.git", :branch => "master"

madziaf commented 9 years ago

Even more:

➜  procto git:(master) ✗ gem install bundler
Fetching: bundler-1.7.3.gem (100%)
Successfully installed bundler-1.7.3
Parsing documentation for bundler-1.7.3
Installing ri documentation for bundler-1.7.3
Done installing documentation for bundler after 3 seconds
1 gem installed
➜  procto git:(master) ✗ bundle install
Updating git://github.com/CodePadawans/ataru.git
Updating https://github.com/rom-rb/devtools.git
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    bundler (~> 1.6.1) ruby

  Current Bundler version:
    bundler (1.7.3)

??

 1) Error:
#<Class:0x00000002dcc3a8>#test_README_0:
SyntaxError: README.md:101: syntax error, unexpected tCONSTANT, expecting '}'
assert_equal([{ name: "Nathan Herald" ..., User.all.map(&UserRep))
                             ^
README.md:101: unterminated string meets end of file

Finished in 0.002600s, 1922.8987 runs/s, 0.0000 assertions/s.

  1) Error:
#<Class:0x00000002042598>#test_README_3:
SyntaxError: README.md:67: syntax error, unexpected keyword_end, expecting ')'
assert_equal(Just(1764), end.apply(pure(42)).apply(pure(42)))
                            ^
README.md:67: syntax error, unexpected ')', expecting keyword_end
README.md:71: syntax error, unexpected keyword_end, expecting ')'
assert_equal(Nothing, end.apply(Nothing))
                         ^
README.md:71: syntax error, unexpected ')', expecting keyword_end
assert_equal(Nothing, end.apply(Nothing))
                                         ^
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/code_sample.rb:23:in `eval'
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/code_sample.rb:23:in `run'
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/test_class_builder.rb:24:in `block (3 levels) in build_test_class'

  2) Error:
#<Class:0x00000002042598>#test_README_1:
Ataru::AtaruError: In the file: README.md, in line: 45, the code sample number: 1 is raising an error:#<NoMethodError: undefined method `Just' for #<#<Class:0x00000002042598>:0x00000002122580>>
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/test_class_builder.rb:26:in `rescue in block (3 levels) in build_test_class'
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/test_class_builder.rb:23:in `block (3 levels) in build_test_class'

  3) Error:
#<Class:0x00000002042598>#test_README_4:
SyntaxError: README.md:84: syntax error, unexpected keyword_end, expecting ')'
assert_equal(Just(42), end)
                          ^
README.md:89: syntax error, unexpected keyword_end, expecting ')'
assert_equal(Nothing, end)
                         ^
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/code_sample.rb:23:in `eval'
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/code_sample.rb:23:in `run'
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/test_class_builder.rb:24:in `block (3 levels) in build_test_class'

  4) Error:
#<Class:0x00000002042598>#test_README_2:
Ataru::AtaruError: In the file: README.md, in line: 52, the code sample number: 2 is raising an error:#<NoMethodError: undefined method `include' for #<#<Class:0x00000002042598>:0x0000000212a5f0>>
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/test_class_builder.rb:26:in `rescue in block (3 levels) in build_test_class'
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/test_class_builder.rb:23:in `block (3 levels) in build_test_class'

  5) Error:
#<Class:0x00000002042598>#test_README_0:
Ataru::AtaruError: In the file: README.md, in line: 34, the code sample number: 0 is raising an error:#<NoMethodError: undefined method `include' for #<#<Class:0x00000002042598>:0x000000021284d0>>
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/test_class_builder.rb:26:in `rescue in block (3 levels) in build_test_class'
    /home/magda/.rvm/gems/ruby-2.1.3/bundler/gems/ataru-03277bd22d27/lib/ataru/test_class_builder.rb:23:in `block (3 levels) in build_test_class'

5 runs, 0 assertions, 0 failures, 5 errors, 0 skips
madziaf commented 9 years ago

More ideas for gems:

emig commented 9 years ago

Talking about "scrivener"

I know soveran likes building minimal libraries with no dependencies. Very interesting approach; and This brings us to the case when there is no Gemfile!

What can be done?. Remembering telling to him in Montevideo that his projects remained me of these "fixies" bikes that try to get rid off the extra pieces of the bike. Well, before they became hipsters toy...then they put more extra pieces back.

We do have a *.gemspec file.

Maybe we can cover the case when the project doesn't have a gemfile but has a gemspec in an automated way.

Can the setup command extract the files defined in the s.files value of the gemspec, filtering out all files that are not ruby files, and require them?

madziaf commented 9 years ago

and then? i don't get it. when you have Gemfile, then you add ataru there, so the project knows about ataru. do you want to require .rb files of the project, add ataru additionally and give all that to bundle, or how?

emig commented 9 years ago

Sorry, my text was confusing. I am was not giving any solution, just pointing out we have a problematic use case, and possible ideas around it.

The user can do the following to check the project with ataru:

emig commented 9 years ago

Question: At this point the following gems can be checked, if the user manually installs ataru and sets it up with the correct requires?

madziaf commented 9 years ago

hej I can install ataru, but have problems with requiring files. Have tried different ways of writing the path, but wasn't sucessful. And there is 2 Ruby versions

/home/magda/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- ~/code_padawans/mote/lib/*.rb (LoadError)
emig commented 9 years ago

Well seen!

On the ruby version inside other ruby version:

I've checked on my installation and the same happens: ls -a $HOME/.rvm/rubies/ruby-*/*/ruby/* | grep Users you will get that installations contain a lib/ruby/ folder with a version that is the previous one on the minor change number.

Can't explain exactly now, will ask Florian about it tomorrow. It seems to be how ruby is packaged.

For the path problem, can you paste the failing setup requires?

moonglum commented 9 years ago

The cases without a Gemfile: Yep, forgot about Michel's philosophy regarding that... He also has an alternative tooling to bundler and everything. Sorry! The community standard is to always have a Gemfile – ataru should treat that as a priority. We can ignore the case of 'no Gemfile' for now IMHO.

coercible: Ok, can't do anything about it other than asking Piotr to upgrade his dependencies. This case (wrong kramdown version) is also described in ataru's README, so everything is fine :smile:

procto: Try gem install bundler -v "=1.6.1", and then again bundle. Does that help?

rep: Ok, the problematic snippet is the following:

UserRep.shared(user: User.first).to_hash # => { name: "Nathan Herald:, ...

I think that could even be a case that is quite common. It could be handled, but it is a biiiig task. We could add it to the #52.

ribimaybe: OK, the problematic snippet is the following:

Just do |x|
  x * x
end.apply(Nothing) # => Nothing

This is one of the cases where we run into limitations with using RegExps instead of a Parser. This has to be handled in the future – we can't do anything about it now.

equalizer: Kacper? :wink:

mcfilib commented 9 years ago

:thumbsup:

Neat project.