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

Draft cdist coding conventions (for types and explorers) #1

Open
sideeffect42 opened this issue Nov 21, 2021 · 2 comments
Open

Draft cdist coding conventions (for types and explorers) #1

sideeffect42 opened this issue Nov 21, 2021 · 2 comments

Comments

@sideeffect42
Copy link
Member

Different types currently use different coding conventions (sometimes even different conventions in the same file).
In the future it would be a plus to have agreed on coding conventions.

Some points that should be included:

  • Indentation
  • Use of "semicolons" (i.e. where to put then, do, in keywords)
  • Guard expected environment variables (e.g. ${__object:?})
  • Quotation guidelines
@4nd3r 4nd3r changed the title Draft cdist coding conventions Draft cdist coding conventions (for types and explorers) Nov 21, 2021
@4nd3r
Copy link
Member

4nd3r commented Dec 5, 2021

my proposal:

  • one level is 4 spaces
  • use of semicolons should be kept to bare minimum, if \n can be used, then use it
  • double quotes when $ is used, with some exceptions (e.g. for foo in $bar), else '
  • I have no preference over guarding, but maybe use #!/bin/sh -eu instead? 🦀
  • multitest ifs should be split to multiple lines with \\

@4nd3r
Copy link
Member

4nd3r commented Dec 16, 2021

Another thing: file headers?

We have two choices:

  1. Enforce copyright (?), license and other info in (almost) every file.
  2. Only add # This file is part of cdist. See documentation for more information. when possible.

I feel that second choice is more reasonable. For type's man.rst we already have this information included (e.g. all current and historical authors). There's also LICENSE in repo. Or do we really need to duplicate this to every file at all? What does GPL say about it?

See #5. I removed headers, updated man.rst with all the authors (in alphabetical order) etc. Decided to remove mail addresses, because we shouldn't try to be address book.

sideeffect42 pushed a commit to riiengineering/skonfig-base that referenced this issue Feb 28, 2024
sideeffect42 added a commit to riiengineering/skonfig-base that referenced this issue Feb 28, 2024
Reloading fails if the configurations uses privileged port numbers.

e.g.:

> Sat Jul  3 18:43:59 2021 - Gracefully killing worker 1 (pid: 59156)...
> Sat Jul  3 18:44:00 2021 - worker 1 killed successfully (pid: 59156)
> Sat Jul  3 18:44:00 2021 - Respawned uWSGI worker 1 (new pid: 62734)
> Sat Jul  3 18:44:11 2021 - gateway "uWSGI http 1" has been buried (pid: 59157)
> Sat Jul  3 18:44:11 2021 - ...gracefully killing workers...
> Sat Jul  3 18:44:11 2021 - Gracefully killing worker 1 (pid: 62734)...
> Sat Jul  3 18:44:12 2021 - worker 1 buried after 1 seconds
> Sat Jul  3 18:44:12 2021 - binary reloading uWSGI...
> Sat Jul  3 18:44:12 2021 - chdir() to /
> Sat Jul  3 18:44:12 2021 - closing all non-uwsgi socket fds > 2 (max_fd = 1024)...
> Sat Jul  3 18:44:12 2021 - found fd 7 mapped to socket 0 (/run/uwsgi/app/redmine/socket)
> Sat Jul  3 18:44:12 2021 - found fd 8 mapped to socket 1 (:8080)
> Sat Jul  3 18:44:12 2021 - found fd 9 mapped to socket 2 (:3032)
> Sat Jul  3 18:44:12 2021 - running /usr/bin/uwsgi-core
> [uWSGI] getting INI configuration from /usr/share/uwsgi/conf/default.ini
> [uWSGI] getting INI configuration from /etc/uwsgi/apps-enabled/redmine.ini
> Sat Jul  3 18:44:12 2021 - [uwsgi-static] added mapping for / => /usr/local/share/redmine/public
> Sat Jul  3 18:44:12 2021 - *** Starting uWSGI 2.0.18-debian (64bit) on [Sat Jul  3 18:44:12 2021] ***
> Sat Jul  3 18:44:12 2021 - compiled with version: 8.2.0 on 10 February 2019 02:42:46
> Sat Jul  3 18:44:12 2021 - os: Linux-4.19.0-17-amd64 skonfig#1 SMP Debian 4.19.194-2 (2021-06-21)
> Sat Jul  3 18:44:12 2021 - nodename: redmine
> Sat Jul  3 18:44:12 2021 - machine: x86_64
> Sat Jul  3 18:44:12 2021 - clock source: unix
> Sat Jul  3 18:44:12 2021 - pcre jit disabled
> Sat Jul  3 18:44:12 2021 - detected number of CPU cores: 1
> Sat Jul  3 18:44:12 2021 - current working directory: /
> Sat Jul  3 18:44:12 2021 - detected binary path: /usr/bin/uwsgi-core
> Sat Jul  3 18:44:12 2021 - chdir() to /usr/local/share/redmine
> Sat Jul  3 18:44:12 2021 - your processes number limit is 7759
> Sat Jul  3 18:44:12 2021 - your memory page size is 4096 bytes
> Sat Jul  3 18:44:12 2021 - detected max file descriptor number: 1024
> Sat Jul  3 18:44:12 2021 - !!! no /etc/mime.types file found !!!
> Sat Jul  3 18:44:12 2021 - lock engine: pthread robust mutexes
> Sat Jul  3 18:44:12 2021 - thunder lock: disabled (you can enable it with --thunder-lock)
> Sat Jul  3 18:44:12 2021 - bind(): Permission denied [core/socket.c line 769]
> Sat Jul  3 18:44:12 2021 - VACUUM: pidfile removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants