Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty configuration as no configuration #492

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

miry
Copy link
Contributor

@miry miry commented Nov 13, 2024

Crystal YAML expects a Hash and Array to perform basic operations. When no rules are defined, ameba currently returns the following error:

Error: Unable to load config file: Expected Array or Hash, not Nil`

This commit treats an empty configuration as if no configuration exists, preventing the error and allowing for default behavior when no rules are specified.

References

Crystal YAML expects a `Hash` and `Array` to perform basic operations.
When no rules are defined, `ameba` currently returns the following error:

```
Error: Unable to load config file: Expected Array or Hash, not Nil`
```

This commit treats an empty configuration as if no configuration exists,
preventing the error and allowing for default behavior when no rules are specified.
@miry miry force-pushed the empty-config-load branch from a20e0cf to 6f6c101 Compare November 13, 2024 08:13
Copy link
Member

@veelenga veelenga left a comment

Choose a reason for hiding this comment

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

lgtm

@veelenga veelenga merged commit 0e8ead1 into crystal-ameba:master Nov 17, 2024
4 checks passed
@Sija Sija added this to the 1.6.4 milestone Nov 17, 2024
@Sija Sija added the bug label Nov 17, 2024
@miry miry deleted the empty-config-load branch November 17, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants