Skip to content

New feature : linting #2557

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ericproulx
Copy link
Contributor

@ericproulx ericproulx commented Apr 12, 2025

This PR adds a linting feature that can activated through Grape.config.lint = true or lint! in a Grape::Api.
Suggested in this comment.

By design, Grape's CI has Grape.config.lint = true, so all specs calling an endpoint are linted.

@grape-bot
Copy link

1 Warning
⚠️ Unless you're refactoring existing code or improving documentation, please update CHANGELOG.md.

Here's an example of a CHANGELOG.md entry:

* [#2557](https://github.com/ruby-grape/grape/pull/2557): New feature : linting - [@ericproulx](https://github.com/ericproulx).

Generated by 🚫 Danger

@dblock
Copy link
Member

dblock commented Apr 12, 2025

Should we call it lint! since it's Rack::Lint?

But thinking about it, maybe we need something more generic that allows one to inject middleware here, including potentially the ability to remove Rack::Head?

@ericproulx
Copy link
Contributor Author

Should we call it lint! since it's Rack::Lint?

But thinking about it, maybe we need something more generic that allows one to inject middleware here, including potentially the ability to remove Rack::Head?

The middleware stack lacks a delete function. I think we should do something like ActionDispatch::MiddlewareStack

@ericproulx ericproulx marked this pull request as ready for review April 13, 2025 16:32
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Please document this in the README if you want it merged.

That said, also consider not merging this and doing a configurable middleware implementation instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants