From f553eee842080aba34d9c2a5e0ddcffeef07e0ae Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Thu, 6 Apr 2023 14:21:46 +0300 Subject: [PATCH] Pull request 1804: newline-lint Merge in DNS/adguard-home from newline-lint to master Squashed commit of the following: commit 2fc0b662b9ac9d954275c5ebe8c140be4cd365be Author: Ainar Garipov Date: Thu Apr 6 14:16:14 2023 +0300 client: rm line commit 10246727179a84094edd17fad5cd6f0a5c38b821 Author: Ainar Garipov Date: Thu Apr 6 13:51:06 2023 +0300 all: add newline lint --- client/dev.eslintrc | 2 +- client/src/helpers/trackers/trackers.json | 4 +-- docker/dns-bind.awk | 2 +- docker/web-bind.awk | 2 +- internal/aghnet/testdata/etc_hosts | 2 +- internal/aghnet/testdata/ifaces | 2 +- internal/aghnet/testdata/include-subsources | 2 +- internal/aghnet/testdata/proc_net_arp | 2 +- openapi/.gitignore | 2 -- openapi/index.html | 2 +- scripts/hooks/pre-commit | 2 +- scripts/make/txt-lint.sh | 27 ++++++++++++++++++++- scripts/querylog/.gitignore | 2 -- scripts/querylog/anonymize.js | 1 - 14 files changed, 37 insertions(+), 17 deletions(-) delete mode 100644 openapi/.gitignore delete mode 100644 scripts/querylog/.gitignore diff --git a/client/dev.eslintrc b/client/dev.eslintrc index 84ca4b39..27341caf 100644 --- a/client/dev.eslintrc +++ b/client/dev.eslintrc @@ -3,4 +3,4 @@ "rules": { "no-debugger":"warn", } -} \ No newline at end of file +} diff --git a/client/src/helpers/trackers/trackers.json b/client/src/helpers/trackers/trackers.json index 7f51485a..a503492e 100644 --- a/client/src/helpers/trackers/trackers.json +++ b/client/src/helpers/trackers/trackers.json @@ -1,5 +1,5 @@ { - "timeUpdated": "2023-03-29T00:10:35.167Z", + "timeUpdated": "2023-04-06T10:46:09.881Z", "categories": { "0": "audio_video_player", "1": "comments", @@ -24192,4 +24192,4 @@ "3gppnetwork.org": "3gpp", "3gpp.org": "3gpp" } -} \ No newline at end of file +} diff --git a/docker/dns-bind.awk b/docker/dns-bind.awk index 28c9094a..4580638e 100644 --- a/docker/dns-bind.awk +++ b/docker/dns-bind.awk @@ -19,4 +19,4 @@ END { print addrs[i] ":" port } } -} \ No newline at end of file +} diff --git a/docker/web-bind.awk b/docker/web-bind.awk index d2c3b323..d3c94abf 100644 --- a/docker/web-bind.awk +++ b/docker/web-bind.awk @@ -10,4 +10,4 @@ END { } else { print "http://" host ":" port } -} \ No newline at end of file +} diff --git a/internal/aghnet/testdata/etc_hosts b/internal/aghnet/testdata/etc_hosts index 81041031..7cd0c770 100644 --- a/internal/aghnet/testdata/etc_hosts +++ b/internal/aghnet/testdata/etc_hosts @@ -35,4 +35,4 @@ 1.3.5.7 domain4 domain4.alias 7.5.3.1 domain4.alias domain4 ::13 domain6 domain6.alias -::31 domain6.alias domain6 \ No newline at end of file +::31 domain6.alias domain6 diff --git a/internal/aghnet/testdata/ifaces b/internal/aghnet/testdata/ifaces index 2bd48802..b98b0409 100644 --- a/internal/aghnet/testdata/ifaces +++ b/internal/aghnet/testdata/ifaces @@ -1 +1 @@ -iface sample_name inet static \ No newline at end of file +iface sample_name inet static diff --git a/internal/aghnet/testdata/include-subsources b/internal/aghnet/testdata/include-subsources index 1663e423..5391a5b3 100644 --- a/internal/aghnet/testdata/include-subsources +++ b/internal/aghnet/testdata/include-subsources @@ -2,4 +2,4 @@ # parent directory. Real interface files usually contain only absolute paths. source ./testdata/ifaces -source ./testdata/* \ No newline at end of file +source ./testdata/* diff --git a/internal/aghnet/testdata/proc_net_arp b/internal/aghnet/testdata/proc_net_arp index 8460c8bb..155974e3 100644 --- a/internal/aghnet/testdata/proc_net_arp +++ b/internal/aghnet/testdata/proc_net_arp @@ -3,4 +3,4 @@ IP address HW type Flags HW address Mask Device ::ffff:ffff 0x1 0x0 ef:cd:ab:ef:cd:ab * br-lan 0.0.0.0 0x0 0x0 00:00:00:00:00:00 * unspec 1.2.3.4.5 0x1 0x2 aa:bb:cc:dd:ee:ff * wan -1.2.3.4 0x1 0x2 12:34:56:78:910 * wan \ No newline at end of file +1.2.3.4 0x1 0x2 12:34:56:78:910 * wan diff --git a/openapi/.gitignore b/openapi/.gitignore deleted file mode 100644 index 91dfed8d..00000000 --- a/openapi/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -node_modules \ No newline at end of file diff --git a/openapi/index.html b/openapi/index.html index c78aa81c..bcf348e1 100644 --- a/openapi/index.html +++ b/openapi/index.html @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/scripts/hooks/pre-commit b/scripts/hooks/pre-commit index cfb72448..42d1e413 100755 --- a/scripts/hooks/pre-commit +++ b/scripts/hooks/pre-commit @@ -90,7 +90,7 @@ then make VERBOSE="$verbose" go-os-check go-lint go-test fi -if [ "$( git diff --cached --name-only -- '*.md' '*.yaml' '*.yml' )" ] +if [ "$( git diff --cached --name-only -- '*.md' '*.txt' '*.yaml' '*.yml' )" ] then make VERBOSE="$verbose" txt-lint fi diff --git a/scripts/make/txt-lint.sh b/scripts/make/txt-lint.sh index 23434e4e..5b7c1dd4 100644 --- a/scripts/make/txt-lint.sh +++ b/scripts/make/txt-lint.sh @@ -27,6 +27,31 @@ set -f -u # Source the common helpers, including not_found. . ./scripts/make/helper.sh -git ls-files -- '*.md' '*.yaml' '*.yml' 'client/src/__locales/en.json'\ +# Simple analyzers + +# trailing_newlines is a simple check that makes sure that all plain-text files +# have a trailing newlines to make sure that all tools work correctly with them. +# +# TODO(a.garipov): Add to the standard skeleton project. +trailing_newlines() { + nl="$( printf "\n" )" + readonly nl + + git ls-files\ + ':!*.png'\ + ':!*.tar.gz'\ + ':!*.zip'\ + | while read -r f + do + if [ "$( tail -c -1 "$f" )" != "$nl" ] + then + printf '%s: must have a trailing newline\n' "$f" + fi + done +} + +run_linter -e trailing_newlines + +git ls-files -- '*.md' '*.txt' '*.yaml' '*.yml' 'client/src/__locales/en.json'\ | xargs misspell --error\ | sed -e 's/^/misspell: /' diff --git a/scripts/querylog/.gitignore b/scripts/querylog/.gitignore deleted file mode 100644 index fadd09d3..00000000 --- a/scripts/querylog/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -test/anonquerylog.json \ No newline at end of file diff --git a/scripts/querylog/anonymize.js b/scripts/querylog/anonymize.js index ea2a3d39..daa05afe 100644 --- a/scripts/querylog/anonymize.js +++ b/scripts/querylog/anonymize.js @@ -116,4 +116,3 @@ const main = async () => { } main(); -