Skip to content

Return unless 'jekyll-archives' config is a Hash#139

Merged
jekyllbot merged 1 commit intojekyll:masterfrom
ashmaroli:return-when-config-nil
Aug 21, 2019
Merged

Return unless 'jekyll-archives' config is a Hash#139
jekyllbot merged 1 commit intojekyll:masterfrom
ashmaroli:return-when-config-nil

Conversation

@ashmaroli
Copy link
Copy Markdown
Member

If the user or a third-party plugins sets config["jekyll-archives"] to nil or something but a Hash, output a warning and turn-off the archives generator.

Closes #138

@ashmaroli ashmaroli requested a review from a team April 23, 2019 18:00
Copy link
Copy Markdown
Member

@mattr- mattr- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit about wording, but good otherwise.

@config = Utils.deep_merge_hashes(DEFAULTS, archives_config)
else
@config = nil
Jekyll.logger.warn "Archives:", "Expected a hash but got #{archives_config.inspect}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to force our users to care about data structures? What about something like

Suggested change
Jekyll.logger.warn "Archives:", "Expected a hash but got #{archives_config.inspect}"
Jekyll.logger.warn "Archives:", "The configuration appears to be invalid"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattr- I'm not sure about this suggestion..
When a third-party plugin (e.g. jekyll-algolia) erroneously sets config["jekyll-archives"] to nil explicitly, a simple "The configuration appears to be invalid" is going to throw the user into more confusion because:

  • First of all, their config file doesn't have a jekyll-archives key.
  • Secondly, they have no context as to why the configuration is invalid.
  • they have no backtrace to debug on their own.

@DirtyF
Copy link
Copy Markdown
Member

DirtyF commented Aug 21, 2019

@jekyllbot: merge +fix

@jekyllbot jekyllbot merged commit f9e3c61 into jekyll:master Aug 21, 2019
jekyllbot added a commit that referenced this pull request Aug 21, 2019
@ashmaroli ashmaroli deleted the return-when-config-nil branch August 22, 2019 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2.2.1 release causing a jekyll-algolia "TypeError: no implicit conversion of nil into Hash after upgrading Gemfile"

4 participants