parse_context_comment

Function parse_context_comment 

Source
pub fn parse_context_comment(content: &str) -> Option<Vec<String>>
Expand description

Parse context comment from file content

Looks for # nginx-lint:context http,server in the first few lines of the file. Returns the context as a vector of block names, or None if no context comment found.

ยงExample

use nginx_lint_common::ignore::parse_context_comment;

let content = "# nginx-lint:context http,server\nserver { listen 80; }";
let context = parse_context_comment(content);
assert_eq!(context, Some(vec!["http".to_string(), "server".to_string()]));