Pull request: all: reformat yaml, add yaml formatting standard

Merge in DNS/adguard-home from 2297-yaml to master

Closes #2297.

Squashed commit of the following:

commit 85df3a38a14adb1965944ddf14b197c12a213057
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 20 17:52:22 2020 +0300

    all: improve HACKING.md

commit 079acdfe41cc12ab6aa13d7c28dcbf7b7b3c8380
Merge: 202ea078e 3045da174
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Nov 20 17:50:34 2020 +0300

    Merge branch 'master' into 2297-yaml

commit 202ea078e29d88871a32ac6e668dfae6db802bab
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Nov 12 20:25:42 2020 +0300

    all: reformat yaml, add yaml formatting standard
This commit is contained in:
Ainar Garipov 2020-11-20 18:06:07 +03:00
parent 3045da1742
commit 046ec13fdc
8 changed files with 2427 additions and 2411 deletions

View File

@ -1,8 +1,8 @@
coverage: 'coverage':
status: 'status':
project: 'project':
default: 'default':
target: 40% 'target': '40%'
threshold: null 'threshold': null
patch: false 'patch': false
changes: false 'changes': false

32
.github/stale.yml vendored
View File

@ -1,19 +1,19 @@
# Number of days of inactivity before an issue becomes stale # Number of days of inactivity before an issue becomes stale.
daysUntilStale: 60 'daysUntilStale': 60
# Number of days of inactivity before a stale issue is closed # Number of days of inactivity before a stale issue is closed.
daysUntilClose: 7 'daysUntilClose': 7
# Issues with these labels will never be considered stale # Issues with these labels will never be considered stale.
exemptLabels: 'exemptLabels':
- 'bug' - 'bug'
- 'enhancement' - 'enhancement'
- 'feature request' - 'feature request'
- 'localization' - 'localization'
# Label to use when marking an issue as stale # Label to use when marking an issue as stale.
staleLabel: 'wontfix' 'staleLabel': 'wontfix'
# Comment to post when marking an issue as stale. Set to `false` to disable # Comment to post when marking an issue as stale. Set to `false` to disable.
markComment: > 'markComment': >
This issue has been automatically marked as stale because it has not had This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you recent activity. It will be closed if no further activity occurs. Thank you
for your contributions. for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable # Comment to post when closing a stale issue. Set to `false` to disable.
closeComment: false 'closeComment': false

View File

@ -1,170 +1,136 @@
name: build 'name': 'build'
env: 'env':
GO_VERSION: 1.14 'GO_VERSION': '1.14'
NODE_VERSION: 13 'NODE_VERSION': '13'
on: 'on':
push: 'push':
branches: 'branches':
- '*' - '*'
tags: 'tags':
- v* - 'v*'
pull_request: 'pull_request':
jobs: 'jobs':
'test':
'runs-on': '${{ matrix.os }}'
'env':
'GO111MODULE': 'on'
'GOPROXY': 'https://goproxy.io'
'strategy':
'fail-fast': false
'matrix':
'os':
- 'ubuntu-latest'
- 'macOS-latest'
- 'windows-latest'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
- 'name': 'Set up Go'
'uses': 'actions/setup-go@v2'
'with':
'go-version': '${{ env.GO_VERSION }}'
- 'name': 'Set up Node'
'uses': 'actions/setup-node@v1'
'with':
'node-version': '${{ env.NODE_VERSION }}'
- 'name': 'Set up Go modules cache'
'uses': 'actions/cache@v2'
'with':
'path': '~/go/pkg/mod'
'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}"
'restore-keys': '${{ runner.os }}-go-'
- 'name': 'Get npm cache directory'
'id': 'npm-cache'
'run': 'echo "::set-output name=dir::$(npm config get cache)"'
- 'name': 'Set up npm cache'
'uses': 'actions/cache@v2'
'with':
'path': '${{ steps.npm-cache.outputs.dir }}'
'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}"
'restore-keys': '${{ runner.os }}-node-'
- 'name': 'Run make ci'
'shell': 'bash'
'run': 'make ci'
- 'name': 'Upload coverage'
'uses': 'codecov/codecov-action@v1'
'if': "success() && matrix.os == 'ubuntu-latest'"
'with':
'token': '${{ secrets.CODECOV_TOKEN }}'
'file': './coverage.txt'
'app':
'runs-on': 'ubuntu-latest'
'needs': 'test'
'steps':
- 'name': 'Checkout'
'uses': 'actions/checkout@v2'
'with':
'fetch-depth': 0
- 'name': 'Set up Go'
'uses': 'actions/setup-go@v2'
'with':
'go-version': '${{ env.GO_VERSION }}'
- 'name': 'Set up Node'
'uses': 'actions/setup-node@v1'
'with':
'node-version': '${{ env.NODE_VERSION }}'
- 'name': 'Set up Go modules cache'
'uses': 'actions/cache@v2'
'with':
'path': '~/go/pkg/mod'
'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}"
'restore-keys': '${{ runner.os }}-go-'
- 'name': 'Get npm cache directory'
'id': 'npm-cache'
'run': 'echo "::set-output name=dir::$(npm config get cache)"'
- 'name': 'Set up node_modules cache'
'uses': 'actions/cache@v2'
'with':
'path': '${{ steps.npm-cache.outputs.dir }}'
'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}"
'restore-keys': '${{ runner.os }}-node-'
- 'name': 'Set up Snapcraft'
'run': 'sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft'
- 'name': 'Set up GoReleaser'
'run': 'curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh'
- 'name': 'Run snapshot build'
'run': 'make release'
test: 'docker':
runs-on: ${{ matrix.os }} 'runs-on': 'ubuntu-latest'
env: 'needs': 'test'
GO111MODULE: on 'steps':
GOPROXY: https://goproxy.io - 'name': 'Checkout'
strategy: 'uses': 'actions/checkout@v2'
fail-fast: false 'with':
matrix: 'fetch-depth': 0
os: - 'name': 'Set up QEMU'
- ubuntu-latest 'uses': 'docker/setup-qemu-action@v1'
- macOS-latest - 'name': 'Set up Docker Buildx'
- windows-latest 'uses': 'docker/setup-buildx-action@v1'
steps: - 'name': 'Docker Buildx (build)'
- 'run': 'make docker-multi-arch'
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- 'notify':
name: Set up Node 'needs':
uses: actions/setup-node@v1 - 'app'
with: - 'docker'
node-version: ${{ env.NODE_VERSION }} # Secrets are not passed to workflows that are triggered by a pull request
- # from a fork.
name: Set up Go modules cache 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}"
uses: actions/cache@v2 'runs-on': 'ubuntu-latest'
with: 'steps':
path: ~/go/pkg/mod - 'name': 'Conclusion'
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} 'uses': 'technote-space/workflow-conclusion-action@v1'
restore-keys: | - 'name': 'Send Slack notif'
${{ runner.os }}-go- 'uses': '8398a7/action-slack@v3'
- 'with':
name: Get npm cache directory 'status': '${{ env.WORKFLOW_CONCLUSION }}'
id: npm-cache 'fields': 'repo, message, commit, author'
run: | 'env':
echo "::set-output name=dir::$(npm config get cache)" 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}'
- 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}'
name: Set up npm cache
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
-
name: Run make ci
shell: bash
run: |
make ci
-
name: Upload coverage
uses: codecov/codecov-action@v1
if: success() && matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
app:
runs-on: ubuntu-latest
needs: test
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
-
name: Set up Node
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
-
name: Set up Go modules cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
-
name: Set up node_modules cache
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
-
name: Set up Snapcraft
run: |
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
-
name: Set up GoReleaser
run: |
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR="$(go env GOPATH)/bin" sh
-
name: Run snapshot build
run: |
make release
docker:
runs-on: ubuntu-latest
needs: test
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Docker Buildx (build)
run: |
make docker-multi-arch
notify:
needs: [app, docker]
# Secrets are not passed to workflows that are triggered by a pull request from a fork
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
-
name: Conclusion
uses: technote-space/workflow-conclusion-action@v1
-
name: Send Slack notif
uses: 8398a7/action-slack@v3
with:
status: ${{ env.WORKFLOW_CONCLUSION }}
fields: repo,message,commit,author
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

View File

@ -1,47 +1,46 @@
name: golangci-lint 'name': 'golangci-lint'
on: 'on':
push: 'push':
tags: 'tags':
- v* - 'v*'
branches: 'branches':
- '*' - '*'
pull_request: 'pull_request':
jobs: 'jobs':
golangci: 'golangci':
runs-on: ubuntu-latest 'runs-on': 'ubuntu-latest'
steps: 'steps':
- uses: actions/checkout@v2 - 'uses': 'actions/checkout@v2'
- name: golangci-lint - 'name': 'golangci-lint'
uses: golangci/golangci-lint-action@v2.3.0 'uses': 'golangci/golangci-lint-action@v2.3.0'
with: 'with':
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. # This field is required. Don't set the patch version to always use
version: v1.32 # the latest patch version.
'version': 'v1.32'
eslint: 'eslint':
runs-on: ubuntu-latest 'runs-on': 'ubuntu-latest'
steps: 'steps':
- uses: actions/checkout@v2 - 'uses': 'actions/checkout@v2'
- name: Install modules - 'name': 'Install modules'
run: npm --prefix client ci 'run': 'npm --prefix client ci'
- name: Run ESLint - 'name': 'Run ESLint'
run: npm --prefix client run lint 'run': 'npm --prefix client run lint'
'notify':
'needs':
notify: - 'golangci'
needs: [golangci,eslint] - 'eslint'
# Secrets are not passed to workflows that are triggered by a pull request from a fork # Secrets are not passed to workflows that are triggered by a pull request
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} # from a fork.
runs-on: ubuntu-latest 'if': "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}"
steps: 'runs-on': 'ubuntu-latest'
- 'steps':
name: Conclusion - 'name': 'Conclusion'
uses: technote-space/workflow-conclusion-action@v1 'uses': 'technote-space/workflow-conclusion-action@v1'
- - 'name': 'Send Slack notif'
name: Send Slack notif 'uses': '8398a7/action-slack@v3'
uses: 8398a7/action-slack@v3 'with':
with: 'status': '${{ env.WORKFLOW_CONCLUSION }}'
status: ${{ env.WORKFLOW_CONCLUSION }} 'fields': 'repo, message, commit, author'
fields: repo,message,commit,author 'env':
env: 'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 'SLACK_WEBHOOK_URL': '${{ secrets.SLACK_WEBHOOK_URL }}'
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

View File

@ -1,78 +1,77 @@
# options for analysis running # options for analysis running
run: 'run':
# default concurrency is a available CPU number # default concurrency is a available CPU number
concurrency: 4 'concurrency': 4
# timeout for analysis, e.g. 30s, 5m, default is 1m # timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 2m 'deadline': '2m'
# which files to skip: they will be analyzed, but issues from them # which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is # won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize # no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know. # autogenerated files. If it's not please let us know.
skip-files: 'skip-files':
- ".*generated.*" - '.*generated.*'
- dnsfilter/rule_to_regexp.go - 'dnsfilter/rule_to_regexp.go'
- util/pprof.go - 'util/pprof.go'
- ".*_test.go" - '.*_test.go'
- client/.* - 'client/.*'
- build/.* - 'build/.*'
- dist/.* - 'dist/.*'
# all available settings of specific linters # all available settings of specific linters
linters-settings: 'linters-settings':
errcheck: 'errcheck':
# [deprecated] comma-separated list of pairs of the form pkg:regex # [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*"). # the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details # see https://github.com/kisielk/errcheck#the-deprecated-method for details
ignore: fmt:.*,net:SetReadDeadline,net/http:^Write 'ignore': 'fmt:.*,net:SetReadDeadline,net/http:^Write'
gocyclo: 'gocyclo':
min-complexity: 20 'min-complexity': 20
lll: 'lll':
line-length: 200 'line-length': 200
linters: 'linters':
enable: 'enable':
- deadcode - 'bodyclose'
- errcheck - 'deadcode'
- govet - 'depguard'
- ineffassign - 'dupl'
- staticcheck - 'errcheck'
- unused - 'gocyclo'
- varcheck - 'goimports'
- bodyclose - 'golint'
- depguard - 'gosec'
- dupl - 'govet'
- gocyclo - 'ineffassign'
- goimports - 'misspell'
- golint - 'staticcheck'
- gosec - 'stylecheck'
- misspell - 'unconvert'
- stylecheck - 'unused'
- unconvert - 'varcheck'
disable-all: true 'disable-all': true
fast: true 'fast': true
issues: 'issues':
# List of regexps of issue texts to exclude, empty list by default. # List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns, # But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all # it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help` # excluded by default patterns execute `golangci-lint run --help`
exclude: 'exclude':
# structcheck cannot detect usages while they're there # structcheck cannot detect usages while they're there
- .parentalServer. is unused - '.parentalServer. is unused'
- .safeBrowsingServer. is unused - '.safeBrowsingServer. is unused'
# errcheck # errcheck
- Error return value of .s.closeConn. is not checked - 'Error return value of .s.closeConn. is not checked'
- Error return value of ..*.Shutdown. - 'Error return value of ..*.Shutdown.'
# goconst # goconst
- string .forcesafesearch.google.com. has 3 occurrences - 'string .forcesafesearch.google.com. has 3 occurrences'
# gosec: Profiling endpoint is automatically exposed on /debug/pprof # gosec: Profiling endpoint is automatically exposed on /debug/pprof
- G108 - 'G108'
# gosec: Subprocess launched with function call as argument or cmd arguments # gosec: Subprocess launched with function call as argument or cmd arguments
- G204 - 'G204'
# gosec: Potential DoS vulnerability via decompression bomb # gosec: Potential DoS vulnerability via decompression bomb
- G110 - 'G110'
# gosec: Expect WriteFile permissions to be 0600 or less # gosec: Expect WriteFile permissions to be 0600 or less
- G306 - 'G306'

View File

@ -1,70 +1,70 @@
project_name: AdGuardHome 'project_name': 'AdGuardHome'
env: 'env':
- GO111MODULE=on - 'GO111MODULE=on'
- GOPROXY=https://goproxy.io - 'GOPROXY=https://goproxy.io'
before: 'before':
hooks: 'hooks':
- go mod download - 'go mod download'
- go generate ./... - 'go generate ./...'
builds: 'builds':
- main: ./main.go - 'main': './main.go'
ldflags: 'ldflags':
- -s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}} - '-s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}}'
env: 'env':
- CGO_ENABLED=0 - 'CGO_ENABLED=0'
goos: 'goos':
- darwin - 'darwin'
- linux - 'linux'
- freebsd - 'freebsd'
- windows - 'windows'
goarch: 'goarch':
- 386 - '386'
- amd64 - 'amd64'
- arm - 'arm'
- arm64 - 'arm64'
- mips - 'mips'
- mipsle - 'mipsle'
- mips64 - 'mips64'
- mips64le - 'mips64le'
goarm: 'goarm':
- 5 - '5'
- 6 - '6'
- 7 - '7'
gomips: 'gomips':
- softfloat - 'softfloat'
ignore: 'ignore':
- goos: freebsd - 'goos': 'freebsd'
goarch: mips 'goarch': 'mips'
- goos: freebsd - 'goos': 'freebsd'
goarch: mipsle 'goarch': 'mipsle'
archives: 'archives':
- # Archive name template. - # Archive name template.
# Defaults: # Defaults:
# - if format is `tar.gz`, `tar.xz`, `gz` or `zip`: # - if format is `tar.gz`, `tar.xz`, `gz` or `zip`:
# - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` # - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}`
# - if format is `binary`: # - if format is `binary`:
# - `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` # - `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}`
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" 'name_template': '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}'
wrap_in_directory: "AdGuardHome" 'wrap_in_directory': 'AdGuardHome'
format_overrides: 'format_overrides':
- goos: windows - 'goos': 'windows'
format: zip 'format': 'zip'
- goos: darwin - 'goos': 'darwin'
format: zip 'format': 'zip'
files: 'files':
- LICENSE.txt - 'LICENSE.txt'
- README.md - 'README.md'
snapcrafts: 'snapcrafts':
- name: adguard-home - 'name': 'adguard-home'
base: core18 'base': 'core18'
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' 'name_template': '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
summary: Network-wide ads & trackers blocking DNS server 'summary': 'Network-wide ads & trackers blocking DNS server'
description: | 'description': |
AdGuard Home is a network-wide software for blocking ads & tracking. After AdGuard Home is a network-wide software for blocking ads & tracking. After
you set it up, it'll cover ALL your home devices, and you don't need any you set it up, it'll cover ALL your home devices, and you don't need any
client-side software for that. client-side software for that.
@ -73,34 +73,35 @@ snapcrafts:
thus preventing your devices from connecting to those servers. It's based thus preventing your devices from connecting to those servers. It's based
on software we use for our public AdGuard DNS servers -- both share a lot on software we use for our public AdGuard DNS servers -- both share a lot
of common code. of common code.
grade: stable 'grade': 'stable'
confinement: strict 'confinement': 'strict'
publish: false 'publish': false
license: GPL-3.0 'license': 'GPL-3.0'
extra_files: 'extra_files':
- source: scripts/snap/local/adguard-home-web.sh - 'source': 'scripts/snap/local/adguard-home-web.sh'
destination: adguard-home-web.sh 'destination': 'adguard-home-web.sh'
mode: 0755 'mode': 0755
- source: scripts/snap/gui/adguard-home-web.desktop - 'source': 'scripts/snap/gui/adguard-home-web.desktop'
destination: meta/gui/adguard-home-web.desktop 'destination': 'meta/gui/adguard-home-web.desktop'
mode: 0644 'mode': 0644
- source: scripts/snap/gui/adguard-home-web.png - 'source': 'scripts/snap/gui/adguard-home-web.png'
destination: meta/gui/adguard-home-web.png 'destination': 'meta/gui/adguard-home-web.png'
mode: 0644 'mode': 0644
apps: 'apps':
adguard-home: 'adguard-home':
command: AdGuardHome -w $SNAP_DATA --no-check-update 'command': 'AdGuardHome -w $SNAP_DATA --no-check-update'
plugs: 'plugs':
# Add the "netrwork-bind" plug to bind to interfaces. # Add the "netrwork-bind" plug to bind to interfaces.
- network-bind - 'network-bind'
# Add the "netrwork-control" plug to be able to bind to ports below # Add the "netrwork-control" plug to be able to bind to ports below
# 1024 (cap_net_bind_service) and also to bind to a particular # 1024 (cap_net_bind_service) and also to bind to a particular
# interface using SO_BINDTODEVICE (cap_net_raw). # interface using SO_BINDTODEVICE (cap_net_raw).
- network-control - 'network-control'
daemon: simple 'daemon': 'simple'
adguard-home-web: 'adguard-home-web':
command: adguard-home-web.sh 'command': 'adguard-home-web.sh'
plugs: [ desktop ] 'plugs':
- 'desktop'
checksum: 'checksum':
name_template: 'checksums.txt' 'name_template': 'checksums.txt'

View File

@ -1,9 +1,11 @@
# AdGuardHome Developer Guidelines # AdGuardHome Developer Guidelines
As of **2020-11-12**, this document is still a work-in-progress. Some of the As of **2020-11-20**, this document is still a work-in-progress. Some of the
rules aren't enforced, and others might change. Still, this is a good place to rules aren't enforced, and others might change. Still, this is a good place to
find out about how we **want** our code to look like. find out about how we **want** our code to look like.
The rules are mostly sorted in the alphabetical order.
## Git ## Git
* Follow the commit message header format: * Follow the commit message header format:
@ -13,11 +15,14 @@ find out about how we **want** our code to look like.
``` ```
Where `pkg` is the package where most changes took place. If there are Where `pkg` is the package where most changes took place. If there are
several such packages, just write `all`. several such packages, or the change is top-level only, write `all`.
* Keep your commit messages to be no wider than eighty (**80**) columns. * Keep your commit messages, including headers, to eighty (**80**) columns.
* Only use lowercase letters in your commit message headers. * Only use lowercase letters in your commit message headers. The rest of the
message should follow the plain text conventions below.
The only exception are direct mentions of identifiers from the source code.
## Go ## Go
@ -98,8 +103,20 @@ find out about how we **want** our code to look like.
[constant errors]: https://dave.cheney.net/2016/04/07/constant-errors [constant errors]: https://dave.cheney.net/2016/04/07/constant-errors
[Linus said]: https://www.kernel.org/doc/html/v4.17/process/coding-style.html#indentation [Linus said]: https://www.kernel.org/doc/html/v4.17/process/coding-style.html#indentation
## Markdown
* **TODO(a.garipov):** Define our Markdown conventions.
## Text, Including Comments ## Text, Including Comments
* End sentences with appropriate punctuation.
* Headers should be written with all initial letters capitalized, except for
references to variable names that start with a lowercase letter.
* Start sentences with a capital letter, unless the first word is a reference
to a variable name that starts with a lowercase letter.
* Text should wrap at eighty (**80**) columns to be more readable, to use * Text should wrap at eighty (**80**) columns to be more readable, to use
a common standard, and to allow editing or diffing side-by-side without a common standard, and to allow editing or diffing side-by-side without
wrapping. wrapping.
@ -126,17 +143,17 @@ find out about how we **want** our code to look like.
// TODO(usr1, usr2): Fix the frobulation issue. // TODO(usr1, usr2): Fix the frobulation issue.
``` ```
## Markdown
* **TODO(a.garipov):** Define our Markdown conventions.
## YAML ## YAML
* **TODO(a.garipov):** Define naming conventions for schema names in our
OpenAPI YAML file. And just generally OpenAPI conventions.
* **TODO(a.garipov):** Find a YAML formatter or write our own. * **TODO(a.garipov):** Find a YAML formatter or write our own.
* All strings, including keys, must be quoted. Reason: the [NO-rway Law]. * All strings, including keys, must be quoted. Reason: the [NO-rway Law].
* Indent with two (**2**) spaces. * Indent with two (**2**) spaces. YAML documents can get pretty
deeply-nested.
* No extra indentation in multiline arrays: * No extra indentation in multiline arrays:
@ -147,7 +164,10 @@ find out about how we **want** our code to look like.
- 'value-3' - 'value-3'
``` ```
* Prefer single quotes for string to prevent accidental escaping, unless * Prefer single quotes for strings to prevent accidental escaping, unless
escaping is required. escaping is required or there are single quotes inside the string (e.g. for
*GitHub Actions*).
* Use `>` for multiline strings, unless you need to keep the line breaks.
[NO-rway Law]: https://news.ycombinator.com/item?id=17359376 [NO-rway Law]: https://news.ycombinator.com/item?id=17359376

File diff suppressed because it is too large Load Diff