[Bug 1803276] Review Request: rubygem-cane - Provides complexity and style checkers allowing integration with custom metrics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=1803276



--- Comment #7 from Vít Ondruch <vondruch@xxxxxxxxxx> ---
This is a way to execute the test suite:

~~~
--- a/rubygem-cane.spec
+++ b/rubygem-cane.spec
@@ -14,10 +14,7 @@
 BuildRequires: ruby >= 1.9.0
 # for the tests
 BuildRequires: rubygem(parallel)
-# BuildRequires: rubygem(rspec) >= 2.0
-# BuildRequires: rubygem(rspec) < 3
-# BuildRequires: rubygem(simplecov)
-# BuildRequires: rubygem(rspec-fire)
+BuildRequires: rubygem(rspec)
 BuildArch: noarch

 %description
@@ -59,6 +56,16 @@
 pushd .%{gem_instdir}
 RUBYOPT="-Ilib/" bin/cane --gte "10,20" | grep "10 is 10.0, should be >= 20.0"
 RUBYOPT="-Ilib/" bin/cane --gte "10,10"
+
+# rspec-fire functionality is now provided by rspec-mocks and is no longer
+# required.
+sed -r -i "/[sS]pec.{1,2}[fF]ire/ s/^/#/" spec/spec_helper.rb
+
+# We don't care about code coverage.
+sed -i "/simplecov/ s/^/#/" spec/spec_helper.rb
+sed -i "/SimpleCov/,/^end/ s/^/#/" spec/spec_helper.rb
+
+rspec spec
 popd

 %files
~~~

However, there are two caveats you should solve with upstream:

1. There are two test failures:

~~~
Failures:

  1) Cane::AbcCheck#file_names abc_glob is an array returns an array of
relative file paths
     Failure/Error:
       expect(check.send(:file_names)).to eq([
         'spec/fixtures/a/1.rb',
         'spec/fixtures/a/3.prawn',
         'spec/fixtures/b/1.rb'
       ])

       expected: ["spec/fixtures/a/1.rb", "spec/fixtures/a/3.prawn",
"spec/fixtures/b/1.rb"]
            got: ["spec/fixtures/a/1.rb", "spec/fixtures/b/1.rb"]

       (compared using ==)
     # ./spec/abc_check_spec.rb:175:in `block (4 levels) in <top (required)>'

  2) Cane::StyleCheck#file_list style_glob is an array returns an array of
relative file paths
     Failure/Error:
       expect(check.send(:file_list)).to eq([
         'spec/fixtures/a/1.rb',
         'spec/fixtures/a/3.prawn',
         'spec/fixtures/b/3/i.haml'
       ])

       expected: ["spec/fixtures/a/1.rb", "spec/fixtures/a/3.prawn",
"spec/fixtures/b/3/i.haml"]
            got: ["spec/fixtures/a/1.rb"]

       (compared using ==)
     # ./spec/style_check_spec.rb:66:in `block (4 levels) in <top (required)>'

Finished in 0.21902 seconds (files took 0.18891 seconds to load)
89 examples, 2 failures
~~~

Checking the content of the gem, I think the problem is that the test suite is
not completely included in the .gem. This line [1] should probably be modified
to `gem.test_files = Dir.glob("spec/**/*")` to include every file the test
suite needs.

2. The test suite needlessly specified dependency on RSpec 2.x, while it
apparently works just fine with the RSpec 3.x. Upstream should relax the
dependency. This would also allow to drop the rspec-fire dependency as it is
done in the snippet (and it should be done upstream also in the .gemspec file).



And if you will be in contact with upstream, it would be also nice to swap the
content of `gemspec.summary` with `gemspec.description`, because typically
description is more verbose then summary.

Also, last but not least, it seems Cane upstream suggest to use Rubocop instead
of Cane, therefore I wonder why are you trying to include Cane into Fedora?



[1]: https://github.com/square/cane/blob/master/cane.gemspec#L24

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are always notified about changes to this product and component
_______________________________________________
package-review mailing list -- package-review@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to package-review-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/package-review@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite Conditions]     [KDE Users]

  Powered by Linux