Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Crash: undefined method `[]' for false:FalseClass - can't detect scheme from CLI

Aperta
#496 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
ios, ruby
Ambito
cli

Direzione di ricerca

Start with lib/slather/project.rb around configure_scheme at line 398, identified by the stack trace, and trace how the CLI --scheme value reaches that method. Compare that path with scheme loading from .slather.yml, which the reporter says works. Reproduce with the supplied slather coverage command and confirm the CLI invocation handles the scheme without crashing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I found the following error:

Slathering...
undefined method `[]' for false:FalseClass

	Are you sure your project is generating coverage? Make sure you enable code coverage in the Test section of your Xcode scheme.
	Did you specify your Xcode scheme? (--scheme or 'scheme' in .slather.yml)
	If you're using a workspace, did you specify it? (--workspace or 'workspace' in .slather.yml)
	If you use a different Xcode configuration, did you specify it? (--configuration or 'configuration' in .slather.yml)
Click to see stacktrace

Traceback (most recent call last):
	24: from /Users/rogerluan/.rbenv/versions/2.6.5/bin/bundle:23:in `<main>'
	23: from /Users/rogerluan/.rbenv/versions/2.6.5/bin/bundle:23:in `load'
	22: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.17/exe/bundle:37:in `<top (required)>'
	21: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/friendly_errors.rb:130:in `with_friendly_errors'
	20: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.17/exe/bundle:49:in `block in <top (required)>'
	19: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/cli.rb:24:in `start'
	18: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	17: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/cli.rb:30:in `dispatch'
	16: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	15: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	14: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	13: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/cli.rb:494:in `exec'
	12: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/cli/exec.rb:28:in `run'
	11: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/cli/exec.rb:63:in `kernel_load'
	10: from /Users/rogerluan/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0/bundler/cli/exec.rb:63:in `load'
	 9: from /Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/bin/slather:23:in `<top (required)>'
	 8: from /Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/bin/slather:23:in `load'
	 7: from /Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/gems/slather-2.7.1/bin/slather:17:in `<top (required)>'
	 6: from /Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/gems/clamp-1.3.2/lib/clamp/command.rb:140:in `run'
	 5: from /Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
	 4: from /Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/gems/clamp-1.3.2/lib/clamp/subcommand/execution.rb:18:in `execute'
	 3: from /Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
	 2: from /Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/gems/slather-2.7.1/lib/slather/command/coverage_command.rb:59:in `execute'
	 1: from /Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/gems/slather-2.7.1/lib/slather/project.rb:324:in `configure'
/Users/rogerluan/Documents/Projects/iOS/.vendor/ruby/2.6.0/gems/slather-2.7.1/lib/slather/project.rb:398:in `configure_scheme': undefined method `[]' for false:FalseClass (NoMethodError)

When executing:

bundle exec slather coverage \
      --cobertura-xml \
      --scheme MyProject-Package \ 
      --source-directory Sources \
      --binary-basename MyProject \     
      --output-directory Generated \
      --ignore 'Tests/*' \
      MyProject.xcodeproj

As you can see in the stacktrace, the crash is here: https://github.com/SlatherOrg/slather/blob/13d50220de561e5f89d3d3685ce94601cdbb196d/lib/slather/project.rb#L398

Apparently it's not picking up the --scheme argument correctly. I tried adding single and double quotes around the scheme value, with no luck.

But if I use a .slather.yml with a scheme, then everything works.

I did a quick code review but I couldn't spot the bug in the slather codebase

Lingua principale
Ruby
Stelle
1.6k
Fork
239
Merge medio
10h 19m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SlatherOrg/slather

Tutte le issue di SlatherOrg/slather

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.