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

More style related warnings #25

Open
snigel opened this issue Aug 25, 2022 · 0 comments
Open

More style related warnings #25

snigel opened this issue Aug 25, 2022 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@snigel
Copy link

snigel commented Aug 25, 2022

These are just suggestions. Feel free to close or disregard if it's invalid.

Currently the linter warns about incorrect indentation levels and trailing spaces.
I've been looking at example configurations from nginx to see if there is some common style guidelines that could be added.

1. One space before the opening brace.

events {
   worker_connections  4096;  ## Default: 1024
}

Warn when it isn't.

events{

2. One space between if parameters.

if ($true) {
    add_header X-First 1;
}

Warn when there are multiple spaces.

if ($true) {
     add_header   X-First   1;
}

3. Comments uses space.

# A comment.

Warn when it itsn't

#A comment.

4. One newline between blocks

  upstream big_server_com {
    server 127.0.0.3:8000 weight=5;
  }

  server { # simple load balancing
    listen          80;
  }

Warn when there are none or multiple:

  upstream big_server_com {
    server 127.0.0.3:8000 weight=5;
  }
  server { # simple load balancing
    listen          80;
  }
  upstream big_server_com {
    server 127.0.0.3:8000 weight=5;
  }



  server { # simple load balancing
    listen          80;
  }

5. location regexes should use space between modifier and regex.

location ~* ^/if-and-alias/

Warn:

location ~*^/if-and-alias/

The example without space currently produces another warning, see #24

@jhinch jhinch added enhancement New feature or request help wanted Extra attention is needed labels Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants