Skip to content

chore: format all config by soulteary/nginx-formatter #22

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

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

soulteary
Copy link
Contributor

@soulteary soulteary commented Apr 19, 2023

@xeioex Hello maintainer 👋

In my recent work, there are some places where Nginx needs to be used.

Referring to our open source project, I found that contains many configuration files.

These configs don't seem to be well formatted, and the crunching and string handling may be borrowed from historical configs from the 1990s to 2020.

So I spent some time, with the help of GPT, finished a small tool for formatting Nginx configuration files.

https://github.com/soulteary/nginx-formatter

I hope it will be helpful to the Nginx open source community.

When I am free next week, I will write an article to talk about how to deal with configuration files, and to further improve this tool, providing a complete command line and Web WYSIWYG interface, and so on.

@soulteary soulteary mentioned this pull request Apr 19, 2023
@maximkonovalov
Copy link

Good job @soulteary. Feel free to share a link to your article here.

@xeioex
Copy link
Contributor

xeioex commented Apr 19, 2023

Hi @soulteary,

Does it have configuration options? For example for indentation level.

Looking at changes I see that it mostly fixed indentation, right?
What else was fixed?

@soulteary
Copy link
Contributor Author

soulteary commented Apr 19, 2023

Hi @xeioex ,

Yes, as a formatting tool, it is primarily responsible for unifying indentation and bracket suspension.

In the next version, I will add formatting options, such as indent character type, indent character amount, and a WYSIWYG web interface.

If possible, I hope that in a later version, the implementation plan of the open source community will be completely rewritten based on token (AST) & GPT, so that Lint and configuration suggestions can be implemented.

See the content of the PR modification, we can see that the current configuration is mixed with \s and \t, redundant and inconsistent newlines, etc., maybe it can be more beautiful

@xeioex xeioex merged commit ce67de0 into nginx:master Apr 20, 2023
@soulteary
Copy link
Contributor Author

UPDATE 1: https://github.com/soulteary/nginx-formatter v0.5.0

support use cli to set the indent size, indent char, src dir, output dir. @xeioex

@soulteary
Copy link
Contributor Author

UPDATE 2: https://github.com/soulteary/nginx-formatter/releases/tag/v1.0.0

Keeping with the planning promise above, support formatting Nginx configuration in the web interface. @xeioex

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