Conversation
📝 WalkthroughWalkthroughThis pull request contains a comprehensive cleanup of spelling, grammar, and formatting errors across the codebase. Changes include correcting typos like "succesfully" → "successfully," "accomodate" → "accommodate," and removing duplicate words from comments and documentation strings. No functional or control flow modifications are present. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (7)
lib/sanbase/menu/menus.ex (1)
247-247:⚠️ Potential issue | 🟡 MinorRemaining typo
follwing→followingin adjacent docstring.✏️ Suggested fix
- A menu item can have the follwing fields updated: + A menu item can have the following fields updated:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase/menu/menus.ex` at line 247, Fix the typo in the docstring that reads "A menu item can have the follwing fields updated:" by changing "follwing" to "following" in the docs inside lib/sanbase/menu/menus.ex (look for that exact sentence in the module's docstring or function docs in Menus module) so the sentence reads "A menu item can have the following fields updated:".lib/sanbase/alerts/evaluator/scheduler.ex (1)
405-405:⚠️ Potential issue | 🟡 MinorAtom key
total_sent_succesfullyretains the original misspelling.The comment on Line 381 was fixed, but the map key on Line 405 still reads
:total_sent_succesfully. Sincehandle_send_results_list/2's callers only pattern-match on:last_triggered(Line 318), renaming this key is safe.✏️ Suggested fix
- total_sent_succesfully: total_triggered - total_failed, + total_sent_successfully: total_triggered - total_failed,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase/alerts/evaluator/scheduler.ex` at line 405, The map returned in handle_send_results_list/2 still uses the misspelled atom key :total_sent_succesfully; update that key to the correct :total_sent_successfully wherever it's set (currently in the map with total_sent_succesfully: total_triggered - total_failed) and ensure any internal references in the same module use the corrected atom; callers only pattern-match :last_triggered so this rename is safe.lib/sanbase/external_services/coinmarketcap/ticker_fetcher.ex (1)
174-183:⚠️ Potential issue | 🔴 CriticalPre-existing bug: BTC validation failure incorrectly nullifies
:price_usdinstead of:price_btc.When
Validator.valid_price?/3returns{:error, _}for the"BTC"price, the code sets:price_usdtonil(Line 181). The equivalent USD block on Lines 164–172 correctly sets:price_usd. The BTC block should mirror it by setting:price_btc. The current code silently discards a valid USD price and retains an invalid BTC price, allowing it to pass the filter on Line 186.🐛 Proposed fix
{:error, error} -> Logger.info("[CMC] Price validation failed: #{inspect(error)}") - Map.put(t, :price_usd, nil) + Map.put(t, :price_btc, nil)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase/external_services/coinmarketcap/ticker_fetcher.ex` around lines 174 - 183, The BTC price validation block (the then -> case using Validator.valid_price?/3) incorrectly nullifies :price_usd on failure; change the failure branch to set :price_btc to nil (i.e., replace the Map.put(t, :price_usd, nil) call with one that sets :price_btc), keeping the Logger.info call and the surrounding then/case structure intact so a failed BTC validation removes the BTC value rather than the USD value.lib/sanbase_web/graphql/resolvers/file_resolver.ex (1)
54-54:⚠️ Potential issue | 🟡 MinorRemaining typo
respose→responsein nearby comment.Line 54 still reads
"query respose"and was not caught in this pass.✏️ Suggested fix
- # in the query respose to propagate the error. + # in the query response to propagate the error.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase_web/graphql/resolvers/file_resolver.ex` at line 54, Fix the typo in the comment inside file_resolver.ex: change "query respose" to "query response" so the comment reads correctly; locate the comment near the module/file name FileResolver (or the file_resolver.ex comment block around the query handling code) and update that single word while leaving the rest of the comment unchanged.lib/sanbase/discord_bot/command_handler.ex (2)
432-432:⚠️ Potential issue | 🟡 MinorMissed typo in user-visible embed string: "reactiing" → "reacting".
Since this PR is specifically targeting typos, this user-facing string was overlooked.
✏️ Proposed fix
- "<@#{to_string(msg.author.id)}> I am still learning and improving, please let me know how I did by reactiing below" + "<@#{to_string(msg.author.id)}> I am still learning and improving, please let me know how I did by reacting below"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase/discord_bot/command_handler.ex` at line 432, Fix the user-facing typo in the reply string inside lib/sanbase/discord_bot/command_handler.ex: change "reactiing" to "reacting" in the message that mentions "<@#{to_string(msg.author.id)}> I am still learning and improving, please let me know how I did by reactiing below" so the visible text reads "reacting". Locate the string used where the bot builds the reply (referencing msg.author.id) and update the spelled word only.
623-623:⚠️ Potential issue | 🟡 MinorLikely numeric typo:
weeks: -14should beweeks: -2for "last 2 weeks".14 weeks (~3.5 months) does not match the label. This clause also appears to be unreachable today since the autocomplete offers "2 weeks ago" rather than "last 2 weeks", but the value itself is incorrect regardless.
🐛 Proposed fix
- defp text_to_datetime("last 2 weeks"), do: Timex.shift(DateTime.utc_now(), weeks: -14) + defp text_to_datetime("last 2 weeks"), do: Timex.shift(DateTime.utc_now(), weeks: -2)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase/discord_bot/command_handler.ex` at line 623, In the text_to_datetime function, fix the numeric typo in the clause matching "last 2 weeks": replace the incorrect Timex.shift(DateTime.utc_now(), weeks: -14) with Timex.shift(DateTime.utc_now(), weeks: -2) so the returned datetime range matches the "last 2 weeks" label (this is the clause in text_to_datetime/1 that currently uses weeks: -14).lib/sanbase_web/graphql/absinthe_before_send.ex (1)
443-444:⚠️ Potential issue | 🟡 MinorDead code: line 443 map literal is never used.
%{success: success, error: error}on line 443 evaluates to a map but the result is immediately discarded. The function returns line 444's value. This looks like a refactoring artifact where line 443 was supposed to be replaced, not kept alongside line 444.🧹 Proposed fix
- %{success: success, error: error} %{success: rename_mapper.(success), error: rename_mapper.(error)}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase_web/graphql/absinthe_before_send.ex` around lines 443 - 444, Remove the dead map literal `%{success: success, error: error}` that is immediately discarded and return only the transformed map `%{success: rename_mapper.(success), error: rename_mapper.(error)}`; locate the surrounding code that builds the success/error maps (references: rename_mapper, success, error) and delete the unused `%{success: success, error: error}` expression so the function returns the renamed values without the redundant artifact.
🧹 Nitpick comments (5)
lib/sanbase/signal/signal.ex (1)
138-141: LGTM! Both occurrences of "occurred" correctly spelled. One additional nit nearby: line 163 has"an selector"which should be"a selector".✏️ Suggested cleanup
- Get the aggregated value for a signal, an selector and time range. + Get the aggregated value for a signal, a selector and time range.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase/signal/signal.ex` around lines 138 - 141, The docs contain the grammatical typo "an selector" which should be "a selector"; locate the phrase in lib/sanbase/signal/signal.ex (near the docblock surrounding the signal-related functions) and replace "an selector" with "a selector" to fix the article usage in the documentation string.lib/sanbase_web/plug/basic_auth.ex (1)
3-5: LGTM! "coming" correctly spelled. Separately, the moduledoc text describing a Telegram path check appears to belong toTelegramMatchPlugrather thanBasicAuth— likely a copy/paste artefact predating this PR, but worth correcting in a follow-up.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase_web/plug/basic_auth.ex` around lines 3 - 5, The moduledoc in BasicAuth currently describes a Telegram path check that belongs to TelegramMatchPlug; update the documentation for the BasicAuth module (module name BasicAuth in lib/sanbase_web/plug/basic_auth.ex) to describe basic HTTP auth behavior or move the Telegram-specific paragraph to the TelegramMatchPlug module (module name TelegramMatchPlug) so each module's moduledoc matches its responsibility and remove the misplaced Telegram wording from BasicAuth.lib/sanbase/event_bus/event_emitter.ex (1)
61-62: LGTM! "environment" correctly spelled. One more nit remains on line 69:"subcribers"→"subscribers".✏️ Suggested cleanup
- # sleep after the event is emitted so there's time for the subcribers + # sleep after the event is emitted so there's time for the subscribers🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase/event_bus/event_emitter.ex` around lines 61 - 62, Fix the typo in the module comment inside lib/sanbase/event_bus/event_emitter.ex: replace "subcribers" with "subscribers" in the comment near the EventEmitter module so the documentation reads correctly (look for the comment block referencing test environment and subscribers handling the event).lib/sanbase_web/graphql/cache/cache.ex (1)
4-6: A few more typos remain in this file worth cleaning up while you're here.
- Line 4:
"precalculating itt"→"precalculating it"- Line 41:
"Absinthe.Middlewar.Async"→"Absinthe.Middleware.Async"(missinge)- Line 221:
"from withing"→"from within"✏️ Suggested cleanup
- caches the result of the resolver for a some time instead of precalculating itt + caches the result of the resolver for a some time instead of precalculating it- 3. Handle the `Absinthe.Middlewar.Async` and `Absinthe.Middleware.Dataloader` + 3. Handle the `Absinthe.Middleware.Async` and `Absinthe.Middleware.Dataloader`- # `cache_modify_middleware` is called only from withing `get_or_store` that + # `cache_modify_middleware` is called only from within `get_or_store` that🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase_web/graphql/cache/cache.ex` around lines 4 - 6, Fix the remaining typos in the cache module: update the module doc string that currently reads "precalculating itt" to "precalculating it", correct the misspelled middleware reference "Absinthe.Middlewar.Async" to "Absinthe.Middleware.Async" (so any alias/require/use or string references match the real module), and change the phrase "from withing" to "from within" wherever it appears (e.g., in docs or error messages inside the Cache module). Locate these in the Cache module (module name Cache or file cache.ex) and update the three strings to their corrected spellings.lib/sanbase_web/graphql/schema/types/project_types.ex (1)
434-434: LGTM! Duplicate "the" correctly removed. Two additional doc nits remain nearby:
- Line 420:
"Provides liqudity"→"Provides liquidity"- Line 754:
"for a ERC20 project"→"for an ERC20 project"✏️ Suggested cleanup
- - Provides liqudity and DeFi integrations + - Provides liquidity and DeFi integrations- `@desc` "Average daily active addresses for a ERC20 project or Ethereum and given time period" + `@desc` "Average daily active addresses for an ERC20 project or Ethereum and given time period"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/sanbase_web/graphql/schema/types/project_types.ex` at line 434, In lib/sanbase_web/graphql/schema/types/project_types.ex (module ProjectTypes), fix two docstring typos: replace the string "Provides liqudity" with "Provides liquidity" and replace "for a ERC20 project" with "for an ERC20 project" wherever those descriptions appear (likely in the Project GraphQL type field descriptions); update the text in-place so the schema docs/readme reflect the corrected wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@lib/sanbase_web/graphql/absinthe_before_send.ex`:
- Around line 443-444: Remove the dead map literal `%{success: success, error:
error}` that is immediately discarded and return only the transformed map
`%{success: rename_mapper.(success), error: rename_mapper.(error)}`; locate the
surrounding code that builds the success/error maps (references: rename_mapper,
success, error) and delete the unused `%{success: success, error: error}`
expression so the function returns the renamed values without the redundant
artifact.
In `@lib/sanbase_web/graphql/resolvers/file_resolver.ex`:
- Line 54: Fix the typo in the comment inside file_resolver.ex: change "query
respose" to "query response" so the comment reads correctly; locate the comment
near the module/file name FileResolver (or the file_resolver.ex comment block
around the query handling code) and update that single word while leaving the
rest of the comment unchanged.
In `@lib/sanbase/alerts/evaluator/scheduler.ex`:
- Line 405: The map returned in handle_send_results_list/2 still uses the
misspelled atom key :total_sent_succesfully; update that key to the correct
:total_sent_successfully wherever it's set (currently in the map with
total_sent_succesfully: total_triggered - total_failed) and ensure any internal
references in the same module use the corrected atom; callers only pattern-match
:last_triggered so this rename is safe.
In `@lib/sanbase/discord_bot/command_handler.ex`:
- Line 432: Fix the user-facing typo in the reply string inside
lib/sanbase/discord_bot/command_handler.ex: change "reactiing" to "reacting" in
the message that mentions "<@#{to_string(msg.author.id)}> I am still learning
and improving, please let me know how I did by reactiing below" so the visible
text reads "reacting". Locate the string used where the bot builds the reply
(referencing msg.author.id) and update the spelled word only.
- Line 623: In the text_to_datetime function, fix the numeric typo in the clause
matching "last 2 weeks": replace the incorrect Timex.shift(DateTime.utc_now(),
weeks: -14) with Timex.shift(DateTime.utc_now(), weeks: -2) so the returned
datetime range matches the "last 2 weeks" label (this is the clause in
text_to_datetime/1 that currently uses weeks: -14).
In `@lib/sanbase/external_services/coinmarketcap/ticker_fetcher.ex`:
- Around line 174-183: The BTC price validation block (the then -> case using
Validator.valid_price?/3) incorrectly nullifies :price_usd on failure; change
the failure branch to set :price_btc to nil (i.e., replace the Map.put(t,
:price_usd, nil) call with one that sets :price_btc), keeping the Logger.info
call and the surrounding then/case structure intact so a failed BTC validation
removes the BTC value rather than the USD value.
In `@lib/sanbase/menu/menus.ex`:
- Line 247: Fix the typo in the docstring that reads "A menu item can have the
follwing fields updated:" by changing "follwing" to "following" in the docs
inside lib/sanbase/menu/menus.ex (look for that exact sentence in the module's
docstring or function docs in Menus module) so the sentence reads "A menu item
can have the following fields updated:".
---
Nitpick comments:
In `@lib/sanbase_web/graphql/cache/cache.ex`:
- Around line 4-6: Fix the remaining typos in the cache module: update the
module doc string that currently reads "precalculating itt" to "precalculating
it", correct the misspelled middleware reference "Absinthe.Middlewar.Async" to
"Absinthe.Middleware.Async" (so any alias/require/use or string references match
the real module), and change the phrase "from withing" to "from within" wherever
it appears (e.g., in docs or error messages inside the Cache module). Locate
these in the Cache module (module name Cache or file cache.ex) and update the
three strings to their corrected spellings.
In `@lib/sanbase_web/graphql/schema/types/project_types.ex`:
- Line 434: In lib/sanbase_web/graphql/schema/types/project_types.ex (module
ProjectTypes), fix two docstring typos: replace the string "Provides liqudity"
with "Provides liquidity" and replace "for a ERC20 project" with "for an ERC20
project" wherever those descriptions appear (likely in the Project GraphQL type
field descriptions); update the text in-place so the schema docs/readme reflect
the corrected wording.
In `@lib/sanbase_web/plug/basic_auth.ex`:
- Around line 3-5: The moduledoc in BasicAuth currently describes a Telegram
path check that belongs to TelegramMatchPlug; update the documentation for the
BasicAuth module (module name BasicAuth in lib/sanbase_web/plug/basic_auth.ex)
to describe basic HTTP auth behavior or move the Telegram-specific paragraph to
the TelegramMatchPlug module (module name TelegramMatchPlug) so each module's
moduledoc matches its responsibility and remove the misplaced Telegram wording
from BasicAuth.
In `@lib/sanbase/event_bus/event_emitter.ex`:
- Around line 61-62: Fix the typo in the module comment inside
lib/sanbase/event_bus/event_emitter.ex: replace "subcribers" with "subscribers"
in the comment near the EventEmitter module so the documentation reads correctly
(look for the comment block referencing test environment and subscribers
handling the event).
In `@lib/sanbase/signal/signal.ex`:
- Around line 138-141: The docs contain the grammatical typo "an selector" which
should be "a selector"; locate the phrase in lib/sanbase/signal/signal.ex (near
the docblock surrounding the signal-related functions) and replace "an selector"
with "a selector" to fix the article usage in the documentation string.
|
Close in favor of #5007 |
Changes
Ticket
Checklist:
Summary by CodeRabbit