ashfurrow / danger-ruby-swiftlint

A Danger plugin for SwiftLint.
https://rubygems.org/gems/danger-swiftlint
MIT License
203 stars 80 forks source link

Invalid `Dangerfile` file: undefined method `map' for nil:NilClass #35

Open valeriomazzeo opened 7 years ago

valeriomazzeo commented 7 years ago

When parsing a config file that doesn't have any excluded directory, danger-swiftlint crashes.

Adding the following to my config file fixes the issue.

excluded:
  - excluded_dir

Stacktrace:

[!] The exception involves the following plugins:
 -  danger-swiftlint

/Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-swiftlint-0.4.1/lib/danger_plugin.rb:124:in `excluded_files_from_config':  (Danger::DSLError)
[!] Invalid `Dangerfile` file: undefined method `map' for nil:NilClass
Did you mean?  tap
 #  from Dangerfile:22
 #  -------------------------------------------
 #  swiftlint.config_file = ".swiftlint.yml"
 >  swiftlint.lint_files
 #  
 #  -------------------------------------------
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-swiftlint-0.4.1/lib/danger_plugin.rb:42:in `lint_files'
    from Dangerfile:22:in `block in parse'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:199:in `eval'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:199:in `block in parse'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:195:in `instance_eval'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:195:in `parse'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:272:in `run'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/commands/pr.rb:58:in `block in run'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/commands/local_helpers/local_setup.rb:38:in `setup'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/commands/pr.rb:57:in `run'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/bin/danger:5:in `<top (required)>'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/bin/danger:23:in `load'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/bin/danger:23:in `<main>'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
    from /Users/valerio/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
ashfurrow commented 7 years ago

Hmm, good catch/fix. Thanks for opening the issue. I'll try to get to this soon but it might be a while, if anyone else is available I'd appreciate assistance :bow:

valeriomazzeo commented 7 years ago

np 👍

thiagofelix commented 7 years ago

@ashfurrow isn't it same issue fixed by #37?

ashfurrow commented 7 years ago

I believe so, @valeriomazzeo could you take a look?

valeriomazzeo commented 7 years ago

Does #37 fix also the case when the excluded key is completely missing?

ashfurrow commented 7 years ago

It should, can you point to the current master and double-check? No worries, we're all busy 😅

valeriomazzeo commented 7 years ago

I am traveling at the moment so won't be able to, until tomorrow :(

ashfurrow commented 7 years ago

No rush – travelling too or else I'd take a look :)

omirho commented 6 years ago

@valeriomazzeo This was probably fixed by #37 . Can you verify and close the issue?