Lint and fix missing trailing newlines (#16445)

Apply the Clojure Style Guide recommendation to end files with proper lines
(having a trailing newline character). See
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
This commit is contained in:
Icaro Motta 2023-07-04 19:40:13 +00:00 committed by GitHub
parent 8978e92042
commit 19ca8e28a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 94 additions and 60 deletions

View File

@ -43,4 +43,4 @@ As a <user|developer|...>, I want to <task> so that <goal>.
[comment]: # (if on Android please replicate bug whilst running adb logcat)
```
...
```
```

View File

@ -14,17 +14,17 @@ WHITE := $(shell tput -Txterm setaf 7)
YELLOW := $(shell tput -Txterm setaf 3)
RESET := $(shell tput -Txterm sgr0)
HELP_FUN = \
%help; \
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
print "Usage: make [target]\n\nSee STARTING_GUIDE.md for more info.\n\n"; \
for (sort keys %help) { \
print "${WHITE}$$_:${RESET}\n"; \
for (@{$$help{$$_}}) { \
$$sep = " " x (32 - length $$_->[0]); \
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
}; \
print "\n"; \
}
%help; \
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
print "Usage: make [target]\n\nSee STARTING_GUIDE.md for more info.\n\n"; \
for (sort keys %help) { \
print "${WHITE}$$_:${RESET}\n"; \
for (@{$$help{$$_}}) { \
$$sep = " " x (32 - length $$_->[0]); \
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
}; \
print "\n"; \
}
HOST_OS := $(shell uname | tr '[:upper:]' '[:lower:]')
# This can come from Jenkins
@ -307,6 +307,7 @@ lint: ##@test Run code style checks
clj-kondo --config .clj-kondo/config.edn --cache false --lint src && \
ALL_CLOJURE_FILES=$(call find_all_clojure_files) && \
zprint '{:search-config? true}' -sfc $$ALL_CLOJURE_FILES && \
sh scripts/lint-trailing-newline.sh && \
yarn prettier
# NOTE: We run the linter twice because of https://github.com/kkinnear/zprint/issues/271
@ -315,9 +316,9 @@ lint-fix: ##@test Run code style checks and fix issues
ALL_CLOJURE_FILES=$(call find_all_clojure_files) && \
zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILES && \
zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILES && \
sh scripts/lint-trailing-newline.sh --fix && \
yarn prettier
shadow-server: export TARGET := clojure
shadow-server:##@ Start shadow-cljs in server mode for watching
yarn shadow-cljs server

View File

@ -1,4 +1,4 @@
{
"name": "StatusIm",
"displayName": "StatusIm"
}
}

View File

@ -45,4 +45,4 @@ The `State` field in the Pivotal story is used to track the progress of a Pivota
| 5 points | 2 - 3 days |
| 8 points | ~1 week |
We should avoid 8 point stories by breaking them down into smaller stories as much as possible.
We should avoid 8 point stories by breaking them down into smaller stories as much as possible.

View File

@ -3,4 +3,4 @@
"version" : 1,
"author" : "xcode"
}
}
}

View File

@ -18,4 +18,4 @@
"url": "https://github.com/status-im/react-native-status/issues"
},
"homepage": "https://github.com/status-im/react-native-status#readme"
}
}

View File

@ -194,4 +194,4 @@
}
}
}
}
}

View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -eof pipefail
FILES=$(comm -23 <(sort <(git ls-files --cached --others --exclude-standard)) <(sort <(git ls-files --deleted)) | grep --ignore-case -E '\.(java|cpp|nix|json|sh|md|js|clj|cljs|cljc|edn)$')
N_FILES=$(echo "$FILES" | wc -l)
LINT_SHOULD_FIX=0
if [[ -n $1 && $1 != '--fix' ]]; then
echo "Unknown option '$1'" >&2
exit 1
elif [[ $1 == '--fix' ]]; then
LINT_SHOULD_FIX=1
fi
echo "Checking ${N_FILES} files for missing trailing newlines."
# Do not process the whole file and only check the last character. Ignore empty
# files. Taken from https://stackoverflow.com/a/10082466.
for file in $FILES; do
if [ -s "$file" ] && [ "$(tail -c1 "$file"; echo x)" != $'\nx' ]; then
if [[ $LINT_SHOULD_FIX -eq 1 ]]; then
echo "" >>"$file"
else
LINT_ERROR=1
echo "No trailing newline: $file" >&2
fi
fi
done
if [[ $LINT_ERROR -eq 1 ]]; then
exit 1
fi

View File

@ -11,4 +11,4 @@
(for [i (keys icons/icons)]
[rn/view {:flex-direction :row}
[icons/icon (keyword i)]
[rn/text i]])])
[rn/text i]])])

View File

@ -26,4 +26,4 @@
{:data [{:id 1
:label "Item 1"}
]} types/tab])
(h/is-truthy (h/get-by-text "Item 1"))))
(h/is-truthy (h/get-by-text "Item 1"))))

View File

@ -6,4 +6,4 @@
(-> message
(clojure.set/rename-keys {:chatId :chat-id
:introductionMessage :introduction-message
:messageType :message-type})))
:messageType :message-type})))

View File

@ -1,4 +1,4 @@
(ns status-im.fleet.default-fleet (:require-macros [status-im.utils.slurp :refer [slurp]]))
(def default-fleets
(slurp "resources/config/fleets.json"))
(slurp "resources/config/fleets.json"))

View File

@ -28,4 +28,4 @@
[button "conn sell" :connect-selected-card simulated-keycard/connect-selected-card]
[button "pair" :connect-pairing-card simulated-keycard/connect-pairing-card]
[button "disc" :disconnect-card simulated-keycard/disconnect-card]
[button "res" :keycard-reset-state simulated-keycard/reset-state]])
[button "res" :keycard-reset-state simulated-keycard/reset-state]])

View File

@ -11,4 +11,4 @@
:justify-content :center
:border-radius 2
:width 18
:height 18})
:height 18})

View File

@ -30,4 +30,4 @@
(if @error?
[icons/icon :main-icons/cancel]
(when-not @loaded?
[react/activity-indicator {:animating true}]))])])))
[react/activity-indicator {:animating true}]))])])))

View File

@ -60,4 +60,4 @@
:android {:margin-bottom 3}
:ios {:margin-bottom 10}})
(def section-header-container {})
(def section-header-container {})

View File

@ -42,4 +42,4 @@
[react/activity-indicator
{:color colors/white-persist
:animating true}]
[icons/icon :main-icons/add {:color colors/white-persist}])]]])
[icons/icon :main-icons/add {:color colors/white-persist}])]]])

View File

@ -6,4 +6,4 @@
(def slider (reagent/adapt-react-class Slider))
(def animated-slider
(reagent/adapt-react-class (.createAnimatedComponent Animated Slider)))
(reagent/adapt-react-class (.createAnimatedComponent Animated Slider)))

View File

@ -7,4 +7,4 @@
56
(if platform/iphone-x?
84
50)))
50)))

View File

@ -32,4 +32,4 @@
[react/view {:padding-horizontal 12 :padding-vertical 8}
[react/text
{:style {:font-weight "500" :color (if active? colors/white colors/blue) :line-height 22}}
label]]]])
label]]]])

View File

@ -5,4 +5,4 @@
{:color colors/gray
:padding 24
:line-height 22
:font-size 15})
:font-size 15})

View File

@ -7,4 +7,4 @@
:border-radius 20
:background-color colors/gray-lighter
:align-items :center
:justify-content :center})
:justify-content :center})

View File

@ -1 +1 @@
(ns status-im.ui.screens.help-center.styles)
(ns status-im.ui.screens.help-center.styles)

View File

@ -10,4 +10,4 @@
:justify-content :space-between})
(def enable-all
{:align-self :flex-end})
{:align-self :flex-end})

View File

@ -78,4 +78,4 @@
(def bottom-container
{:flex-direction :row
:margin-horizontal 12
:margin-vertical 15})
:margin-vertical 15})

View File

@ -3,4 +3,4 @@
(def share-link-button
{:margin-top 12
:margin-horizontal 16
:margin-bottom 16})
:margin-bottom 16})

View File

@ -8,4 +8,4 @@
:right 0
:align-items :center
:justify-content :center
:flex 1})
:flex 1})

View File

@ -61,4 +61,4 @@
:padding-left 16
:color (if disabled? colors/black colors/white-persist)
:padding-horizontal 16
:padding-vertical 10})
:padding-vertical 10})

View File

@ -26,4 +26,4 @@
:border-radius 14
:background-color colors/green
:align-items :center
:justify-content :center})
:justify-content :center})

View File

@ -9,4 +9,4 @@
(defn separator-dark
[]
{:height 1
:background-color colors/black-transparent})
:background-color colors/black-transparent})

View File

@ -18,4 +18,4 @@
:style (merge
{:width (or width 40)
:height (or height 40)}
image-style)}]])
image-style)}]])

View File

@ -30,4 +30,4 @@
:margin-bottom 12
:align-items :center
:justify-content :center
:padding-horizontal 12})
:padding-horizontal 12})

View File

@ -151,4 +151,4 @@
(def app-info-container
{:flex-direction :column
:flex 1})
:flex 1})

View File

@ -5,4 +5,4 @@
[photo-path]
(when-not (and (not (string/blank? photo-path))
(string/starts-with? photo-path "contacts://"))
{:uri photo-path}))
{:uri photo-path}))

View File

@ -622,4 +622,4 @@
"yoke"
"yurt"
"zinc"
"zone"])
"zone"])

View File

@ -21,4 +21,4 @@
;; ticker on exchange networks. We handle that with `symbol-exchange` override.
(defn exchange-symbol
[{:keys [symbol-exchange symbol-display symbol]}]
(clojure.core/name (or symbol-exchange symbol-display symbol)))
(clojure.core/name (or symbol-exchange symbol-display symbol)))

View File

@ -10,4 +10,4 @@
:accessibility-label (or accessibility-label :plus-button)
:on-press on-press
:customization-color customization-color}
:i/add])
:i/add])

View File

@ -46,4 +46,4 @@
:border-width 1})
(def no-pinned-messages-text
{:margin-top 20})
{:margin-top 20})

View File

@ -34,4 +34,4 @@
:pinned-by display-name
:child [reply/quoted-message quoted-message false true]
:timestamp-str timestamp-str
:labels {:pinned-a-message (i18n/label :t/pinned-a-message)}}]))
:labels {:pinned-a-message (i18n/label :t/pinned-a-message)}}]))

View File

@ -96,4 +96,4 @@
(defn header-online
[]
{:color (colors/theme-colors colors/neutral-80-opa-50 colors/white-opa-50)})
{:color (colors/theme-colors colors/neutral-80-opa-50 colors/white-opa-50)})

View File

@ -38,4 +38,4 @@
(reanimated/apply-animations-to-style
(when enabled?
{:opacity animation})
(pinned-banner top-offset)))
(pinned-banner top-offset)))

View File

@ -29,4 +29,4 @@
:bookmarks/active
:<- [:bookmarks]
(fn [bookmarks]
(into {} (remove #(:removed (second %)) bookmarks))))
(into {} (remove #(:removed (second %)) bookmarks))))

View File

@ -1813,4 +1813,4 @@
"your-recovery-phrase-description": "Esta es tu frase semilla. La usas para comprobar que esta es tu billetera. ¡Sólo la verás una vez! Escríbela en un papel y guárdala en un lugar seguro. La necesitarás si pierdes o reinstalas tu billetera.",
"your-tip-limit": "Tu límite de propina",
"youre-on-mobile-network": "Estás en una red móvil"
}
}

View File

@ -1228,4 +1228,4 @@
"your-keys": "کلیدهای شما",
"your-recovery-phrase": "عبارت دانه شما",
"your-recovery-phrase-description": "این عبارت بازیابی شماست. شما از آن برای اثبات اینکه این کیف پول شماست استفاده می کنید. شما فقط همین یکبار آنرا مشاهده میکنید! آن را روی کاغذ بنویسید و در مکانی امن نگه دارید. اگر کیف پول خود را از دست بدهید یا مجددا نصب کنید، به آن نیاز خواهید داشت."
}
}

View File

@ -1800,4 +1800,4 @@
"your-recovery-phrase-description": "Ceci est votre phrase de récupération. Vous l'utilisez pour prouver qu'il s'agit de votre portefeuille. Vous ne le voyez qu'une fois! Ecrivez-le sur du papier et conservez-le dans un endroit sûr. Vous en aurez besoin si vous perdez ou réinstallez votre portefeuille.",
"your-tip-limit": "Votre plafond des pourboires",
"youre-on-mobile-network": "Vous êtes sur un réseau mobile"
}
}

View File

@ -1873,4 +1873,4 @@
"your-recovery-phrase-description": "यह आपका बीज वाक्यांश है। आप इसका उपयोग यह साबित करने के लिए करते हैं कि यह आपका बटुआ है। आप इसे केवल एक बार देख सकते हैं! इसे कागज पर लिखकर सुरक्षित स्थान पर रख दें। यदि आप अपना बटुआ खो देते हैं या पुनः स्थापित करते हैं तो आपको इसकी आवश्यकता होगी।",
"your-tip-limit": "आपकी टिप सीमा",
"youre-on-mobile-network": "आप मोबाइल नेटवर्क पर हैं"
}
}

View File

@ -1906,4 +1906,4 @@
"your-recovery-phrase-description": "これはあなたのシードフレーズです。ウォレットがあなたのものであることを証明するために使用します。一度だけしか見ることができません。紙に書くか安全な場所で保管してください。紛失やアプリを再インストールする際に必要になります。",
"your-tip-limit": "チップ設定値",
"youre-on-mobile-network": "モバイルネットワークを利用しています"
}
}

View File

@ -1896,4 +1896,4 @@
"your-recovery-phrase-description": "Esta é sua frase-semente. Você a usa para provar que esta é sua carteira. Você só pode vê-la uma vez! Escreva no papel e mantenha em um lugar seguro. Você vai precisar dela se perder ou reinstalar sua carteira.",
"your-tip-limit": "Seu limite de gorjeta",
"youre-on-mobile-network": "Você está em uma rede móvel"
}
}

View File

@ -1840,4 +1840,4 @@
"your-recovery-phrase-description": "这是您的助记词。您需要用它来证明这个钱包属于您。您只能查看一次!请将其写在纸上并保存在安全的地方。如果丢失或重新安装钱包,您将需要用到这些助记词。",
"your-tip-limit": "您的手续费上限",
"youre-on-mobile-network": "您正在使用移动网络"
}
}

View File

@ -1833,4 +1833,4 @@
"your-recovery-phrase-description": "這是您的種子詞組,能用它來證明這是您的錢包。您只會看到一次!請將其寫在紙上,並存放在安全的地方。如果裝置遺失或想重新安裝錢包,將需要它。",
"your-tip-limit": "您的手續費上限",
"youre-on-mobile-network": "您正在使用行動網路"
}
}