Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Start checking gems with ataru. #56

Open
emig opened this issue Sep 15, 2014 · 17 comments
Open

Start checking gems with ataru. #56

emig opened this issue Sep 15, 2014 · 17 comments

Comments

@emig
Copy link

emig commented Sep 15, 2014

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
Copy link
Contributor

madziaf commented Sep 16, 2014

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

@moonglum
Copy link

Great 👍 Can I help with the anima chaos? 😄

@madziaf
Copy link
Contributor

madziaf commented Sep 19, 2014

@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
Copy link

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

@moonglum
Copy link

More ideas for gems:

@moonglum
Copy link

Even more:

@madziaf
Copy link
Contributor

madziaf commented Sep 24, 2014

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

@madziaf
Copy link
Contributor

madziaf commented Sep 24, 2014

Even more:

  • charlatan - all fine

  • coercible
    Bundler could not find compatible versions for gem "kramdown":
    In Gemfile:
    ataru (>= 0) ruby depends on
    kramdown (~> 1) ruby

    kramdown (0.14.2)

  • micromachine - no Gemfile

  • procto

➜  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
Copy link
Contributor

madziaf commented Sep 24, 2014

More ideas for gems:

@emig
Copy link
Author

emig commented Sep 24, 2014

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
Copy link
Contributor

madziaf commented Sep 24, 2014

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
Copy link
Author

emig commented Sep 24, 2014

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:

  • Install ataru via gem install ataru
  • Setup ataru to require the project's files. At this point the user is the
    one who knows the order of the requires and which files to require. In the
    case there is a .gemspec file, we can "help" the user by autofilling the
    requires by getting the values in the s.files from the .gemspec file and
    extract the .rb files.

@emig
Copy link
Author

emig commented Sep 24, 2014

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

  • mote - no Gemfile
  • contract (interesting, because the author puts assertions into his code himself) - no Gemfile
  • scrivener - no Gemfile

@madziaf
Copy link
Contributor

madziaf commented Sep 24, 2014

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
Copy link
Author

emig commented Sep 24, 2014

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
Copy link

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 😄

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? 😉

@mcfilib
Copy link

mcfilib commented Oct 5, 2014

👍

Neat project.

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

No branches or pull requests

4 participants