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

Make http types directives analysable #102

Closed
wants to merge 2 commits into from

Conversation

chrisnovakovic
Copy link

Proposed changes

The syntax of http types blocks is distinct, in that their child directives are arbitrary MIME types - they therefore can't be analysed when strict or check_ctx are enabled, and no meaningful analysis can be performed when check_args is enabled because the arity of child directives is unknown. Skip the checks performed when strict and check_ctx are enabled, and hint to the analyser that all directives inside a types block accept one or more arguments so that a meaningful check can be performed when check_args is enabled.

Fixes #101.

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto master
  • I will ensure my PR is targeting the master branch and pulling from my branch from my own fork

The syntax of `http` `types` blocks is distinct, in that their child
directives are arbitrary MIME types - they therefore can't be analysed
when `strict` or `check_ctx` are enabled, and no meaningful analysis can
be performed when `check_args` is enabled because the arity of child
directives is unknown. Skip the checks performed when `strict` and
`check_ctx` are enabled, and hint to the analyser that all directives
inside a `types` block accept one or more arguments so that a meaningful
check can be performed when `check_args` is enabled.

Fixes nginxinc#101.
@chrisnovakovic
Copy link
Author

chrisnovakovic commented Jul 19, 2022

I've just realised that map works broadly similarly to types, so map also isn't analysed correctly at the moment (see #103). It's possible to fix the analyser so both issues are solved at the same time, but the fix is substantially different to the one here (which TBH is a bit of a kludge anyway) so I'll close this PR and open a new one.

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.

http types blocks trigger various analyser failures
1 participant