SlatherOrg / slather

Generate test coverage reports for Xcode projects & hook it into CI.
MIT License
1.55k stars 236 forks source link

HTML report fails to generate on 2.7.0 with xcode 12.4 #481

Closed sushant-here closed 3 years ago

sushant-here commented 3 years ago

I get the following error:...

bundle exec slather coverage --html --show --build-directory fastlane/build --output-directory fastlane/code_coverage/html --scheme App+UnitTests --workspace Work.xcworkspace App/App.xcodeproj

Slathering... bundler: failed to load command: slather (/Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/bin/slather) TypeError: nil can't be coerced into Integer /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:199:in -' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:199:inblock (8 levels) in create_html_from_file' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:194:in map' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:194:inblock (7 levels) in create_html_from_file' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:395:in insert' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:378:inmethod_missing' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:190:in block (6 levels) in create_html_from_file' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:395:ininsert' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:378:in method_missing' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:189:inblock (5 levels) in create_html_from_file' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:185:in each' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:185:ineach_with_index' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:185:in block (4 levels) in create_html_from_file' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:395:ininsert' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:378:in method_missing' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:184:inblock (3 levels) in create_html_from_file' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:174:in each' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:174:inblock (2 levels) in create_html_from_file' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:395:in insert' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:378:inmethod_missing' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:173:in block in create_html_from_file' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:296:ininitialize' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:255:in new' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.11.1-x86_64-darwin/lib/nokogiri/xml/builder.rb:255:inwith' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:154:in create_html_from_file' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:140:inblock in create_htmls_from_files' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:140:in map' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:140:increate_htmls_from_files' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:49:in create_html_reports' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/coverage_service/html_output.rb:26:inpost' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/command/coverage_command.rb:101:in post' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/lib/slather/command/coverage_command.rb:61:inexecute' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in run' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/clamp-1.3.2/lib/clamp/subcommand/execution.rb:18:inexecute' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in run' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/clamp-1.3.2/lib/clamp/command.rb:140:inrun' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/gems/slather-2.7.0/bin/slather:17:in <top (required)>' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/bin/slather:23:inload' /Users/me/xcodeProjects/App/vendor/bundle/ruby/2.6.0/bin/slather:23:in `<top (required)>'

sushant-here commented 3 years ago

Can confirm that downgrading to 2.6.1 fixes the issue.

ksuther commented 3 years ago

Thanks for the report. Sounds like #477 from @hborawski may have introduced this. Any chance you have a reducible test case?

hborawski commented 3 years ago

The stack trace does lead to code i added, but I don't know how to reproduce this, I did the development for the feature on Xcode 12.3 and 12.4, and did not run into this at all.

Happy to provide a fix once I can get it reproduced