Fix clojure.set and clojure.walk inconsistent namespace aliases (#14715)

This commit is contained in:
Icaro Motta 2023-01-05 10:54:32 -03:00 committed by GitHub
parent 951fd43d10
commit bad796db90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 94 additions and 92 deletions

View File

@ -11,6 +11,8 @@
taoensso.tufte/defnp clojure.core/defn} taoensso.tufte/defnp clojure.core/defn}
:linters {:consistent-alias {:level :error :linters {:consistent-alias {:level :error
:aliases {clojure.string string :aliases {clojure.string string
clojure.set set
clojure.walk walk
taoensso.timbre log}} taoensso.timbre log}}
:invalid-arity {:skip-args [status-im.utils.fx/defn utils.re-frame/defn]} :invalid-arity {:skip-args [status-im.utils.fx/defn utils.re-frame/defn]}
;; TODO remove number when this is fixed ;; TODO remove number when this is fixed

View File

@ -1,5 +1,5 @@
(ns status-im.communities.core (ns status-im.communities.core
(:require [clojure.set :as clojure.set] (:require [clojure.set :as set]
[clojure.string :as string] [clojure.string :as string]
[clojure.walk :as walk] [clojure.walk :as walk]
[quo.design-system.colors :as colors] [quo.design-system.colors :as colors]
@ -28,10 +28,10 @@
(defn <-request-to-join-community-rpc (defn <-request-to-join-community-rpc
[r] [r]
(clojure.set/rename-keys r (set/rename-keys r
{:communityId :community-id {:communityId :community-id
:publicKey :public-key :publicKey :public-key
:chatId :chat-id})) :chatId :chat-id}))
(defn <-requests-to-join-community-rpc (defn <-requests-to-join-community-rpc
[requests] [requests]
@ -64,12 +64,12 @@
(defn <-rpc (defn <-rpc
[c] [c]
(-> c (-> c
(clojure.set/rename-keys {:canRequestAccess :can-request-access? (set/rename-keys {:canRequestAccess :can-request-access?
:canManageUsers :can-manage-users? :canManageUsers :can-manage-users?
:canDeleteMessageForEveryone :can-delete-message-for-everyone? :canDeleteMessageForEveryone :can-delete-message-for-everyone?
:canJoin :can-join? :canJoin :can-join?
:requestedToJoinAt :requested-to-join-at :requestedToJoinAt :requested-to-join-at
:isMember :is-member?}) :isMember :is-member?})
(update :members walk/stringify-keys) (update :members walk/stringify-keys)
(update :chats <-chats-rpc) (update :chats <-chats-rpc)
(update :categories <-categories-rpc))) (update :categories <-categories-rpc)))

View File

@ -1,5 +1,5 @@
(ns status-im.contact.db (ns status-im.contact.db
(:require [clojure.set :as clojure.set] (:require [clojure.set :as set]
[clojure.string :as string] [clojure.string :as string]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
@ -68,8 +68,8 @@
(let [current-contact (some-> (let [current-contact (some->
current-account current-account
(select-keys [:name :preferred-name :public-key :identicon :images]) (select-keys [:name :preferred-name :public-key :identicon :images])
(clojure.set/rename-keys {:name :alias (set/rename-keys {:name :alias
:preferred-name :name})) :preferred-name :name}))
all-contacts (cond-> contacts all-contacts (cond-> contacts
current-contact current-contact
(assoc public-key current-contact))] (assoc public-key current-contact))]

View File

@ -1,5 +1,5 @@
(ns status-im.data-store.chats (ns status-im.data-store.chats
(:require [clojure.set :as clojure.set] (:require [clojure.set :as set]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.data-store.messages :as messages] [status-im.data-store.messages :as messages]
[utils.re-frame :as rf] [utils.re-frame :as rf]
@ -58,19 +58,19 @@
(defn <-rpc (defn <-rpc
[chat] [chat]
(-> chat (-> chat
(clojure.set/rename-keys {:id :chat-id (set/rename-keys {:id :chat-id
:communityId :community-id :communityId :community-id
:syncedFrom :synced-from :syncedFrom :synced-from
:syncedTo :synced-to :syncedTo :synced-to
:membershipUpdateEvents :membership-update-events :membershipUpdateEvents :membership-update-events
:deletedAtClockValue :deleted-at-clock-value :deletedAtClockValue :deleted-at-clock-value
:chatType :chat-type :chatType :chat-type
:unviewedMessagesCount :unviewed-messages-count :unviewedMessagesCount :unviewed-messages-count
:unviewedMentionsCount :unviewed-mentions-count :unviewedMentionsCount :unviewed-mentions-count
:lastMessage :last-message :lastMessage :last-message
:lastClockValue :last-clock-value :lastClockValue :last-clock-value
:invitationAdmin :invitation-admin :invitationAdmin :invitation-admin
:profile :profile-public-key}) :profile :profile-public-key})
rpc->type rpc->type
unmarshal-members unmarshal-members
(update :last-message #(when % (messages/<-rpc %))) (update :last-message #(when % (messages/<-rpc %)))

View File

@ -1,12 +1,12 @@
(ns status-im.data-store.contacts (ns status-im.data-store.contacts
(:require [clojure.set :as clojure.set] (:require [clojure.set :as set]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
(defn <-rpc (defn <-rpc
[contact] [contact]
(-> contact (-> contact
(clojure.set/rename-keys (set/rename-keys
{:id :public-key {:id :public-key
:ensVerifiedAt :ens-verified-at :ensVerifiedAt :ens-verified-at
:displayName :display-name :displayName :display-name

View File

@ -1,5 +1,5 @@
(ns status-im.data-store.messages (ns status-im.data-store.messages
(:require [clojure.set :as clojure.set] (:require [clojure.set :as set]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
@ -10,40 +10,40 @@
(assoc :text (:text content) (assoc :text (:text content)
:sticker (:sticker content)) :sticker (:sticker content))
:always :always
(clojure.set/rename-keys {:chat-id :chat_id (set/rename-keys {:chat-id :chat_id
:whisper-timestamp :whisperTimestamp :whisper-timestamp :whisperTimestamp
:community-id :communityId :community-id :communityId
:clock-value :clock}))) :clock-value :clock})))
(defn <-rpc (defn <-rpc
[message] [message]
(-> message (-> message
(clojure.set/rename-keys {:id :message-id (set/rename-keys {:id :message-id
:whisperTimestamp :whisper-timestamp :whisperTimestamp :whisper-timestamp
:editedAt :edited-at :editedAt :edited-at
:contactVerificationState :contact-verification-state :contactVerificationState :contact-verification-state
:contactRequestState :contact-request-state :contactRequestState :contact-request-state
:commandParameters :command-parameters :commandParameters :command-parameters
:gapParameters :gap-parameters :gapParameters :gap-parameters
:messageType :message-type :messageType :message-type
:localChatId :chat-id :localChatId :chat-id
:communityId :community-id :communityId :community-id
:contentType :content-type :contentType :content-type
:clock :clock-value :clock :clock-value
:quotedMessage :quoted-message :quotedMessage :quoted-message
:outgoingStatus :outgoing-status :outgoingStatus :outgoing-status
:audioDurationMs :audio-duration-ms :audioDurationMs :audio-duration-ms
:deleted :deleted? :deleted :deleted?
:deletedForMe :deleted-for-me? :deletedForMe :deleted-for-me?
:albumId :album-id :albumId :album-id
:new :new?}) :new :new?})
(update :quoted-message (update :quoted-message
clojure.set/rename-keys set/rename-keys
{:parsedText :parsed-text :communityId :community-id}) {:parsedText :parsed-text :communityId :community-id})
(update :outgoing-status keyword) (update :outgoing-status keyword)
(update :command-parameters (update :command-parameters
clojure.set/rename-keys set/rename-keys
{:transactionHash :transaction-hash {:transactionHash :transaction-hash
:commandState :command-state}) :commandState :command-state})
(assoc :content {:chat-id (:chatId message) (assoc :content {:chat-id (:chatId message)

View File

@ -1,5 +1,5 @@
(ns status-im.data-store.pin-messages (ns status-im.data-store.pin-messages
(:require [clojure.set :as clojure.set] (:require [clojure.set :as set]
[status-im.data-store.messages :as messages] [status-im.data-store.messages :as messages]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
@ -8,8 +8,8 @@
[message] [message]
(-> message (-> message
(merge (messages/<-rpc (message :message))) (merge (messages/<-rpc (message :message)))
(clojure.set/rename-keys {:pinnedAt :pinned-at (set/rename-keys {:pinnedAt :pinned-at
:pinnedBy :pinned-by}) :pinnedBy :pinned-by})
(dissoc :message))) (dissoc :message)))
(defn pinned-message-by-chat-id-rpc (defn pinned-message-by-chat-id-rpc
@ -21,9 +21,9 @@
{:json-rpc/call [{:method "wakuext_chatPinnedMessages" {:json-rpc/call [{:method "wakuext_chatPinnedMessages"
:params [chat-id cursor limit] :params [chat-id cursor limit]
:on-success (fn [result] :on-success (fn [result]
(let [result (clojure.set/rename-keys result (let [result (set/rename-keys result
{:pinnedMessages {:pinnedMessages
:pinned-messages})] :pinned-messages})]
(on-success (update result :pinned-messages #(map <-rpc %))))) (on-success (update result :pinned-messages #(map <-rpc %)))))
:on-error on-error}]}) :on-error on-error}]})

View File

@ -1,24 +1,24 @@
(ns status-im.data-store.reactions (ns status-im.data-store.reactions
(:require [clojure.set :as clojure.set])) (:require [clojure.set :as set]))
(defn ->rpc (defn ->rpc
[message] [message]
(-> message (-> message
(clojure.set/rename-keys {:message-id :messageId (set/rename-keys {:message-id :messageId
:emoji-id :emojiId :emoji-id :emojiId
:chat-id :localChatId :chat-id :localChatId
:message-type :messageType :message-type :messageType
:emoji-reaction-id :id}))) :emoji-reaction-id :id})))
(defn <-rpc (defn <-rpc
[message] [message]
(-> message (-> message
(dissoc :chat_id) (dissoc :chat_id)
(clojure.set/rename-keys {:messageId :message-id (set/rename-keys {:messageId :message-id
:localChatId :chat-id :localChatId :chat-id
:emojiId :emoji-id :emojiId :emoji-id
:messageType :message-type :messageType :message-type
:id :emoji-reaction-id}))) :id :emoji-reaction-id})))
(defn reactions-by-chat-id-rpc (defn reactions-by-chat-id-rpc
[chat-id [chat-id

View File

@ -1,18 +1,18 @@
(ns status-im.data-store.visibility-status-updates (ns status-im.data-store.visibility-status-updates
(:require [clojure.set :as clojure.set] (:require [clojure.set :as set]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
(defn <-rpc (defn <-rpc
[visibility-status-update] [visibility-status-update]
(clojure.set/rename-keys visibility-status-update (set/rename-keys visibility-status-update
{:publicKey :public-key {:publicKey :public-key
:statusType :status-type})) :statusType :status-type}))
(defn <-rpc-settings (defn <-rpc-settings
[settings] [settings]
(-> settings (-> settings
(clojure.set/rename-keys (set/rename-keys
{:current-user-status :current-user-visibility-status}) {:current-user-status :current-user-visibility-status})
(update :current-user-visibility-status <-rpc))) (update :current-user-visibility-status <-rpc)))

View File

@ -2,7 +2,7 @@
(:require ["react-native" :as rn] (:require ["react-native" :as rn]
["react-native-gesture-handler" :refer (gestureHandlerRootHOC)] ["react-native-gesture-handler" :refer (gestureHandlerRootHOC)]
["react-native-navigation" :refer (Navigation)] ["react-native-navigation" :refer (Navigation)]
[clojure.set :as clojure.set] [clojure.set :as set]
[quo.components.text-input :as quo.text-input] [quo.components.text-input :as quo.text-input]
[quo.design-system.colors :as quo.colors] [quo.design-system.colors :as quo.colors]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
@ -299,7 +299,7 @@
(fn [^js evn] (fn [^js evn]
(let [selected-tab-index (.-selectedTabIndex evn) (let [selected-tab-index (.-selectedTabIndex evn)
comp (get tab-root-ids selected-tab-index) comp (get tab-root-ids selected-tab-index)
tab-key (get (clojure.set/map-invert tab-key-idx) selected-tab-index)] tab-key (get (set/map-invert tab-key-idx) selected-tab-index)]
(re-frame/dispatch [:set :current-tab tab-key]) (re-frame/dispatch [:set :current-tab tab-key])
(when (= @state/root-comp-id comp) (when (= @state/root-comp-id comp)
(when (= :chat tab-key) (when (= :chat tab-key)

View File

@ -1,5 +1,5 @@
(ns status-im.signing.core (ns status-im.signing.core
(:require [clojure.set :as clojure.set] (:require [clojure.set :as set]
[clojure.string :as string] [clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.constants :as constants] [status-im.constants :as constants]
@ -596,4 +596,4 @@
(sign cofx (sign cofx
{:tx-obj (-> tx {:tx-obj (-> tx
(select-keys [:from :to :value :input :gas :nonce :hash]) (select-keys [:from :to :value :input :gas :nonce :hash])
(clojure.set/rename-keys {:input :data}))}))) (set/rename-keys {:input :data}))})))

View File

@ -1,5 +1,5 @@
(ns status-im.ui.screens.communities.reorder-categories (ns status-im.ui.screens.communities.reorder-categories
(:require [clojure.set :as clojure.set] (:require [clojure.set :as set]
[clojure.string :as string] [clojure.string :as string]
[clojure.walk :as walk] [clojure.walk :as walk]
[quo.core :as quo] [quo.core :as quo]
@ -48,7 +48,7 @@
[{:keys [id community-id] :as home-item} is-active? drag] [{:keys [id community-id] :as home-item} is-active? drag]
(let [chat-id (string/replace id community-id "") (let [chat-id (string/replace id community-id "")
background-color (if is-active? colors/gray-lighter colors/white) background-color (if is-active? colors/gray-lighter colors/white)
home-item (clojure.set/rename-keys home-item {:id :chat-id})] home-item (set/rename-keys home-item {:id :chat-id})]
[rn/view [rn/view
{:accessibility-label :chat-item {:accessibility-label :chat-item
:style (merge styles/category-item :style (merge styles/category-item

View File

@ -1,5 +1,5 @@
(ns status-im.utils.views (ns status-im.utils.views
(:require [clojure.walk :as w])) (:require [clojure.walk :as walk]))
(defn atom? (defn atom?
[sub] [sub]
@ -9,9 +9,9 @@
(defn walk-sub (defn walk-sub
[sub form->sym] [sub form->sym]
(if (coll? sub) (if (coll? sub)
(w/postwalk (fn [f] (walk/postwalk (fn [f]
(or (form->sym f) f)) (or (form->sym f) f))
sub) sub)
(or (form->sym sub) sub))) (or (form->sym sub) sub)))
(defn prepare-subs (defn prepare-subs

View File

@ -1,6 +1,6 @@
(ns status-im.wallet.core (ns status-im.wallet.core
(:require (:require
[clojure.set :as clojure.set] [clojure.set :as set]
[clojure.string :as string] [clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.async-storage.core :as async-storage] [status-im.async-storage.core :as async-storage]
@ -360,7 +360,7 @@
(rf/merge cofx (rf/merge cofx
(multiaccounts.update/multiaccount-update (multiaccounts.update/multiaccount-update
:wallet/visible-tokens :wallet/visible-tokens
(update visible-tokens chain clojure.set/union chain-visible-tokens) (update visible-tokens chain set/union chain-visible-tokens)
{}) {})
(update-tokens-balances balances) (update-tokens-balances balances)
(prices/update-prices)))) (prices/update-prices))))

View File

@ -1,6 +1,6 @@
(ns status-im2.subs.multiaccount (ns status-im2.subs.multiaccount
(:require [cljs.spec.alpha :as spec] (:require [cljs.spec.alpha :as spec]
[clojure.set :as clojure.set] [clojure.set :as set]
[clojure.string :as string] [clojure.string :as string]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
@ -23,7 +23,7 @@
(some-> (some->
current-account current-account
(select-keys [:name :preferred-name :public-key :identicon :image :images]) (select-keys [:name :preferred-name :public-key :identicon :image :images])
(clojure.set/rename-keys {:name :alias}) (set/rename-keys {:name :alias})
(multiaccounts/contact-with-names)))) (multiaccounts/contact-with-names))))
(re-frame/reg-sub (re-frame/reg-sub