repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
BetterOCR | github_2023 | python | 3 | junhoyeo | junhoyeo | @@ -70,9 +70,14 @@ def detect_text(
print("=====")
print(prompt)
- api_key = os.environ["OPENAI_API_KEY"]
- if "API_KEY" in options["openai"] and options["openai"]["API_KEY"] != "":
- api_key = options["openai"]["API_KEY"]
+ # Prioritize user-specified API_KEY
+ api_key = options["openai"... | wtf i was too javascript these days and forgot about `dictionary.get` lol thx 👍 |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -127,6 +129,30 @@ Exceptions are not thrown unless calling gum itself does, the status code is int
All of the rest of the options and usecases _should work_ ™. Please raise issues/PRs for any improvements. Much appreciated!
+## Simplified AP | Lets call it `Higher Level` API than Simplified. I think that signals intention better? |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -127,6 +129,30 @@ Exceptions are not thrown unless calling gum itself does, the status code is int
All of the rest of the options and usecases _should work_ ™. Please raise issues/PRs for any improvements. Much appreciated!
+## Simplified AP
+You can also use the gum like this:
+
+```clojure-version
+(require '... | can remove the escapes here. |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -1,7 +1,7 @@
(ns bblgum.core
(:require [bblgum.impl :as i]))
-(defn gum
+(defn- gumv1 | lets call it `gum*` and change the docstrings. |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -33,3 +33,67 @@
:result (case as
:bool (zero? exit)
out)}))
+
+(defn- prepare-cmd-map
+ ([cmd]
+ (if (map? cmd)
+ cmd
+ (prepare-cmd-map cmd [] {})))
+ ([cmd args-or-opts]
+ (if (map? args-or-opts)
+ (prepare-cmd-map cmd [] args-or-opts)
+ (prepare-cmd-map ... | lets move the comment at the end. |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -21,15 +21,52 @@ Add this to your `bb.edn` or `deps.edn`:
Sample babashka usage:
```console
$ bb -Sdeps '{:deps {io.github.lispyclouds/bblgum {:git/sha "7ebae0e2231899fe2a6ad44bc9ef5fca64099fcd"}}}' \
- -e "(require '[bblgum.core :as b]) (b/gum {:cmd :input :opts {:placeholder \"User name:\"}})"
+ -e "(re... | now that i think of it, we might as well adapt the usual `gum` fn to support this. this change is still non-breaking and not much reason to expose `gum*` |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -127,6 +166,30 @@ Exceptions are not thrown unless calling gum itself does, the status code is int
All of the rest of the options and usecases _should work_ ™. Please raise issues/PRs for any improvements. Much appreciated!
+## Simplified AP | Lets merge this with the usual examples and not call it differently |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -127,6 +166,30 @@ Exceptions are not thrown unless calling gum itself does, the status code is int
All of the rest of the options and usecases _should work_ ™. Please raise issues/PRs for any improvements. Much appreciated!
+## Simplified AP
+You can also use the gum like this:
+
+```clojure-version
+(require '... | still needs the removal of the escaped `\"` |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -33,3 +33,78 @@
:result (case as
:bool (zero? exit)
out)}))
+
+(defn- prepare-options [m]
+ (let [fmted-keys [:opts :in :as :gum-path]
+ fmted (select-keys m fmted-keys)
+ opts (apply dissoc m fmted-keys)]
+ (update fmted :opts merge opts)))
+
+(defn- prepare-c... | inline the `gum*` here and remove it. |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -33,3 +33,78 @@
:result (case as
:bool (zero? exit)
out)}))
+
+(defn- prepare-options [m] | lets move these 2 fns to the impl ns and add some tests |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -1,8 +1,8 @@
(ns bblgum.core
(:require [bblgum.impl :as i]))
-(defn gum
- "Main driver fn for using gum: https://github.com/charmbracelet/gum
+(defn- gum* | we can merge this and the `gum` right? move this logic to the end of the multi-arity dispatch and remove `gum*`? |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -2,34 +2,52 @@
(:require [bblgum.impl :as i]))
(defn gum
- "Main driver fn for using gum: https://github.com/charmbracelet/gum
+ "High level gum API. Simpler in usage then `gum*`, but uses it under the hood. | can remove the mention of `gum*` from here |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -2,34 +2,52 @@
(:require [bblgum.impl :as i]))
(defn gum
- "Main driver fn for using gum: https://github.com/charmbracelet/gum
+ "High level gum API. Simpler in usage then `gum*`, but uses it under the hood.
- Options map:
- cmd: The interaction command. Can be a keyword. Required
- opts: A map of optio... | can we improve this message? maybe something like `:cmd must be provided in the map or as a first arg?` |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -2,24 +2,43 @@
(:require [bblgum.impl :as i]))
(defn gum
- "Main driver fn for using gum: https://github.com/charmbracelet/gum
+ "Main driver of bblgum.
- Options map:
- cmd: The interaction command. Can be a keyword. Required
- opts: A map of options to be passed as optional params to gum
- args: A ve... | wouldnt this fail with the old direct map invocation then? `(gum {...})` |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -30,3 +30,107 @@
str/trim
str/split-lines
(filter seq))))))
+
+(defn gum* | lets call this exec, simplify the docstring. |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -30,3 +30,107 @@
str/trim
str/split-lines
(filter seq))))))
+
+(defn gum*
+ "Low level API. If you don't know why you are using `gum*` then you're probably looking for `gum`
+ Options map:
+ cmd: The interaction command. Can be a keyword. Req... | this can be in core tbh |
bblgum | github_2023 | others | 3 | lispyclouds | lispyclouds | @@ -21,108 +21,103 @@ Add this to your `bb.edn` or `deps.edn`:
Sample babashka usage:
```console
$ bb -Sdeps '{:deps {io.github.lispyclouds/bblgum {:git/sha "7ebae0e2231899fe2a6ad44bc9ef5fca64099fcd"}}}' \
- -e "(require '[bblgum.core :as b]) (b/gum {:cmd :input :opts {:placeholder \"User name:\"}})"
+ -e "(... | bit sad about this going away, but will make my peace with it 🙏🏽 |
basset | github_2023 | php | 120 | Laravel-Backpack | promatik | @@ -67,7 +70,12 @@ public function write(string $path, array $attributes = []): void
*/
public function assetPath(string $path): string
{
- $asset = Str::of(asset($path.$this->cachebusting));
+ // if path is not a url or it's local url, we will append the cachebusting
+ if (! Str::s... | ```suggestion
if (! Str::startsWith($path, ['http://', 'https://', '://']) || Str::startsWith($path, url(''))) {
``` |
basset | github_2023 | php | 96 | Laravel-Backpack | pxpm | @@ -4,6 +4,9 @@
// development mode, assets will not be internalized
'dev_mode' => env('BASSET_DEV_MODE', env('APP_ENV') === 'local'),
+ // verify ssl certificate while fetching assets
+ 'verify_ssl_certificate' => true, | Wasn't the initial intention of this to provide a way of skip the cert. validation in some envs ?
In that case I think we need a env variable right ?
```suggestion
'verify_ssl_certificate' => env('BASSET_VERIFY_SSL_CERTIFICATE', true),
``` |
basset | github_2023 | php | 96 | Laravel-Backpack | pxpm | @@ -512,4 +512,17 @@ public function bassetDirectory(string $asset, string $output): StatusEnum
return $this->loader->finish(StatusEnum::INTERNALIZED);
}
+
+ /**
+ * Fetch the content body of an url.
+ *
+ * @param string $url
+ * @return string | ```suggestion
``` |
basset | github_2023 | others | 85 | Laravel-Backpack | pxpm | @@ -1 +1 @@
-@basset('resources/sample.js')
\ No newline at end of file
+@bassetInstance('resources/sample.js') | shouldn't the directive be @basset ? |
basset | github_2023 | php | 58 | Laravel-Backpack | tabacitu | @@ -5,11 +5,11 @@
'dev_mode' => env('BASSET_DEV_MODE', env('APP_ENV') === 'local'),
// disk and path where to store bassets
- 'disk' => 'public',
+ 'disk' => env('BASSET_DISK', 'public'), | Let's document these new .ENV variables please. And ideally also create a section in the README called "How to use on Laravel Vapor" |
basset | github_2023 | others | 72 | Laravel-Backpack | pxpm | @@ -220,6 +220,23 @@ But what if your `script.js` file is not only loaded by `card.blade.php`, but al
That's where this package comes to the rescue. It will load the asset just ONCE, even if it's loaded from multiple blade files.
+## FAQ
+
+#### Basset is not working, what may be wrong?
+
+Before making any change... | ```suggestion
By default, Basset uses the Laravel `public` disk.
For new Laravel projects, the configuration is usually correct.
If you're upgrading a project and/or changed the `public` disk configuration, it's advised that you change the basset disk in `config/backpack/basset.php` to `basset`. The `basset` disk ... |
basset | github_2023 | others | 72 | Laravel-Backpack | pxpm | @@ -220,6 +220,23 @@ But what if your `script.js` file is not only loaded by `card.blade.php`, but al
That's where this package comes to the rescue. It will load the asset just ONCE, even if it's loaded from multiple blade files.
+## FAQ
+
+#### Basset is not working, what may be wrong?
+
+Before making any change... | ```suggestion
3) **Missing or broken storage symlink.**
If you use the default `public` disk, Basset requires that the symlink between the storage and the public accessible folder to be created with `php artisan storage:link` command. During installation, Basset attempts to create the symlink. If it fails, you will... |
basset | github_2023 | php | 72 | Laravel-Backpack | pxpm | @@ -0,0 +1,147 @@
+<?php
+
+namespace Backpack\Basset\Console\Commands;
+
+use Backpack\Basset\BassetManager;
+use Backpack\Basset\Enums\StatusEnum;
+use Exception;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Http;
+
+/**
+ * Basset Cache command.
+ *
+ * @prop... | ```suggestion
if (! $this->option('installing')) {
$this->components->info('Checking Backpack Basset installation');
}
try {
// init check
$this->init();
$this->components->twoColumnDetail('Initializing basset check', '<fg=green;options=bo... |
basset | github_2023 | php | 72 | Laravel-Backpack | pxpm | @@ -0,0 +1,147 @@
+<?php
+
+namespace Backpack\Basset\Console\Commands;
+
+use Backpack\Basset\BassetManager;
+use Backpack\Basset\Enums\StatusEnum;
+use Exception;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Http;
+
+/**
+ * Basset Cache command.
+ *
+ * @prop... | ```suggestion
$this->line(' <fg=gray>│ 3) The <fg=white>'.config('backpack.basset.disk').'</> disk is properly configured in <fg=white>config/filesystems.php</>.</>');
``` |
basset | github_2023 | php | 72 | Laravel-Backpack | pxpm | @@ -0,0 +1,147 @@
+<?php
+
+namespace Backpack\Basset\Console\Commands;
+
+use Backpack\Basset\BassetManager;
+use Backpack\Basset\Enums\StatusEnum;
+use Exception;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Http;
+
+/**
+ * Basset Cache command.
+ *
+ * @prop... | ```suggestion
$this->line(' <fg=gray>│ 4) The storage symlink exists and is valid (by default: public/storage).</>');
``` |
basset | github_2023 | php | 72 | Laravel-Backpack | pxpm | @@ -0,0 +1,147 @@
+<?php
+
+namespace Backpack\Basset\Console\Commands;
+
+use Backpack\Basset\BassetManager;
+use Backpack\Basset\Enums\StatusEnum;
+use Exception;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Http;
+
+/**
+ * Basset Cache command.
+ *
+ * @prop... | Something is triggering my spidey sense here ... when would `getUrl()` don't return a url ? |
basset | github_2023 | php | 72 | Laravel-Backpack | pxpm | @@ -0,0 +1,147 @@
+<?php
+
+namespace Backpack\Basset\Console\Commands;
+
+use Backpack\Basset\BassetManager;
+use Backpack\Basset\Enums\StatusEnum;
+use Exception;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Http;
+
+/**
+ * Basset Cache command.
+ *
+ * @prop... | I am thinking if we really should create the file, or use an already existing file in backpack core, like `common.js`.
Why ? I don't want the "check" to fail if it's not able to create a dummy file. That's not what we are testing here, and I really don't care if user is able to create a file in a random directory ... |
basset | github_2023 | php | 72 | Laravel-Backpack | pxpm | @@ -0,0 +1,141 @@
+<?php
+
+namespace Backpack\Basset\Console\Commands;
+
+use Backpack\Basset\BassetManager;
+use Backpack\Basset\Enums\StatusEnum;
+use Exception;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Str;
+
+/**
+ * Basset... | ```suggestion
$this->line(' <fg=gray>│ <fg=white>https://github.com/laravel-backpack/basset#faq</></>');
``` |
basset | github_2023 | php | 72 | Laravel-Backpack | tabacitu | @@ -160,6 +164,29 @@ public function terminate(): void
$basset->cacheMap->save();
}
+ /**
+ * Loads needed basset disks.
+ *
+ * @return void
+ */
+ public function loadDisk(): void | I thought we talked about adding the disk only if `config('backpack.basset.disk') == 'basset'`. Did we forget or decide against that? |
basset | github_2023 | php | 72 | Laravel-Backpack | pxpm | @@ -160,6 +164,29 @@ public function terminate(): void
$basset->cacheMap->save();
}
+ /**
+ * Loads needed basset disks.
+ *
+ * @return void
+ */
+ public function loadDisk(): void
+ {
+ // ignore if the disk exists
+ if (app()->config['filesystems.disks.basset'])... | ```suggestion
if (app()->config['filesystems.disks.basset'] || app()->config['backpack.basset.disk'] !== 'basset') {
``` |
basset | github_2023 | php | 72 | Laravel-Backpack | tabacitu | @@ -160,6 +164,29 @@ public function terminate(): void
$basset->cacheMap->save();
}
+ /**
+ * Loads needed basset disks.
+ *
+ * @return void
+ */
+ public function loadDisk(): void
+ {
+ // ignore if the disk exists
+ if (app()->config['filesystems.disks.basset'] ... | ```suggestion
// if the basset disk already exists, don't override it
if (app()->config['filesystems.disks.basset']) {
return;
}
// if the basset disk isn't being used at all, don't even bother to add it
if (app()->config['backpack.basset.disk'] !== 'b... |
basset | github_2023 | php | 74 | Laravel-Backpack | tabacitu | @@ -161,6 +164,23 @@ public function terminate(): void
$basset->cacheMap->save();
}
+ /**
+ * Loads needed basset disks.
+ *
+ * @return void
+ */
+ public function loadDisks(): void | ```suggestion
public function loadDisk(): void
``` |
basset | github_2023 | php | 74 | Laravel-Backpack | tabacitu | @@ -36,6 +36,9 @@ public function boot(): void
$this->bootForConsole();
}
+ // Load basset disk
+ $this->loadDisks();
+ | Can we only do this if the config is set to use the "basset" disk? |
basset | github_2023 | php | 74 | Laravel-Backpack | tabacitu | @@ -161,6 +164,23 @@ public function terminate(): void
$basset->cacheMap->save();
}
+ /**
+ * Loads needed basset disks.
+ *
+ * @return void
+ */
+ public function loadDisks(): void
+ {
+ // add the basset disk to filesystem configuration
+ app()->config['filesyst... | What happens if someone already has a disk named `basset`? |
basset | github_2023 | others | 74 | Laravel-Backpack | pxpm | @@ -232,7 +232,8 @@ The most common reasons for Basset to fail are:
Ensure that APP_URL in your `.env` matches your server configuration, including the hostname, protocol, and port number. Incorrect settings can lead to asset loading issues.
2) **Improperly configured disk.**
-By default, Basset uses the public d... | I already added a comment in the other PR regarding this, maybe we remove this from this PR and make the full readme change in the `check-command` branch.
|
basset | github_2023 | others | 73 | Laravel-Backpack | pxpm | @@ -16,7 +16,7 @@
"analyse": "./vendor/bin/phpstan analyse --level 5 src"
},
"require": {
- "laravel/framework": "^10.1|^9.0",
+ "laravel/framework": "^10.1", | AFAIK the pipe functionality we use here was added in L10.7 https://github.com/laravel/framework/commit/58269047e7a39d4a5f157b645205666c689e0ce5
|
basset | github_2023 | php | 57 | Laravel-Backpack | promatik | @@ -5,11 +5,11 @@
'dev_mode' => env('BASSET_DEV_MODE', env('APP_ENV') === 'local'),
// disk and path where to store bassets
- 'disk' => 'public',
+ 'disk' => env('BASSET_DISK')??'public', | ```suggestion
'disk' => env('BASSET_DISK', 'public'),
``` |
basset | github_2023 | php | 57 | Laravel-Backpack | promatik | @@ -5,11 +5,11 @@
'dev_mode' => env('BASSET_DEV_MODE', env('APP_ENV') === 'local'),
// disk and path where to store bassets
- 'disk' => 'public',
+ 'disk' => env('BASSET_DISK')??'public',
'path' => 'basset',
// use cache map file (.basset)
- 'cache_map' => true,
+ 'cache_map' => env(... | ```suggestion
'cache_map' => env('BASSET_CACHE_MAP', true),
``` |
basset | github_2023 | others | 53 | Laravel-Backpack | tabacitu | @@ -32,8 +32,11 @@ composer require backpack/basset
php artisan basset:install
```
-> **Note**
-> By default Basset relies on the public disk, you may change it if you want to, but if you stick to the defaults, make sure your disk is properly setup on `config/filsystems.php`, make sure it [looks like the default ... | ```suggestion
#### Storage Symlink
Basset uses the `public` disk to store cached assets in a directory that is publicly-accesible. So it needs you to run `php artisan storage:link` to create the symlink. The installation command will create ask to run that, and to add that command to your `composer.json`. That will m... |
basset | github_2023 | php | 51 | Laravel-Backpack | tabacitu | @@ -0,0 +1,90 @@
+<?php
+
+namespace Backpack\Basset\Console\Commands;
+
+use Illuminate\Console\Command;
+use Illuminate\Support\Str;
+use Symfony\Component\Process\Process;
+
+/**
+ * Basset Cache command.
+ *
+ * @property object $output
+ */
+class BassetInstall extends Command
+{
+ /**
+ * The name and sign... | I think this provides a little more clarity as to WHY the directory wasn't created:
```suggestion
$this->components->twoColumnDetail($message, '<fg=yellow;options=bold>ALREADY EXISTED</>');
``` |
basset | github_2023 | php | 51 | Laravel-Backpack | tabacitu | @@ -0,0 +1,90 @@
+<?php
+
+namespace Backpack\Basset\Console\Commands;
+
+use Illuminate\Console\Command;
+use Illuminate\Support\Str;
+use Symfony\Component\Process\Process;
+
+/**
+ * Basset Cache command.
+ *
+ * @property object $output
+ */
+class BassetInstall extends Command
+{
+ /**
+ * The name and sign... | Ooooh this is so elegant! 👏👏👏 |
basset | github_2023 | php | 51 | Laravel-Backpack | tabacitu | @@ -0,0 +1,90 @@
+<?php
+
+namespace Backpack\Basset\Console\Commands;
+
+use Illuminate\Console\Command;
+use Illuminate\Support\Str;
+use Symfony\Component\Process\Process;
+
+/**
+ * Basset Cache command.
+ *
+ * @property object $output
+ */
+class BassetInstall extends Command
+{
+ /**
+ * The name and sign... | ```suggestion
if ($this->components->confirm('You will need to run `php artisan storage:link` on every server you deploy the app to. Do you wish to add that command to composer.json' post-install-script, to make that automatic?', true)) {
``` |
basset | github_2023 | php | 27 | Laravel-Backpack | tabacitu | @@ -0,0 +1,113 @@
+<?php
+
+namespace Backpack\Basset\Helpers;
+
+use Illuminate\Support\Facades\File;
+use PharData;
+use ZipArchive;
+
+class Unarchiver
+{
+ /**
+ * Unarchive files.
+ *
+ * @param string $file source file
+ * @param string $output output destination
+ * @return bool resu... | Let's move this to the top of the file. It's easier to "read" a class if you start with `public` methods, then `private`. I also find it easier to read if you start with getters, then setters/doers. |
basset | github_2023 | php | 27 | Laravel-Backpack | tabacitu | @@ -0,0 +1,74 @@
+<?php
+
+namespace Backpack\Basset\Helpers;
+
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Storage;
+
+class CacheMap
+{
+ private $map = [];
+ private $path;
+ private $active = false;
+ private $dirty = false; | Maybe we add a verb here to make the call more fluent? I think I like `cachemap->isDirty` more than `cachemap->dirty()`, how about you?
```suggestion
private $isActive = false;
private $isDirty = false;
``` |
basset | github_2023 | php | 27 | Laravel-Backpack | tabacitu | @@ -0,0 +1,74 @@
+<?php
+
+namespace Backpack\Basset\Helpers;
+
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Storage;
+
+class CacheMap
+{
+ private $map = [];
+ private $path;
+ private $active = false;
+ private $dirty = false;
+
+ public function __construct()
+ {
+ ... | Hmm... I don't think `$cacheMap->add()` is very expressive...
In previous PRs I was suggesting we remove the `asset` from the function name, because the `asset` was already present in the class name, but in this case, when you write `$cacheMap->add()`... I don't think it's very clear what you're adding...
This i... |
basset | github_2023 | php | 27 | Laravel-Backpack | tabacitu | @@ -0,0 +1,74 @@
+<?php
+
+namespace Backpack\Basset\Helpers;
+
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Storage;
+
+class CacheMap
+{
+ private $map = [];
+ private $path;
+ private $active = false;
+ private $dirty = false;
+
+ public function __construct()
+ {
+ ... | Similarly:
```suggestion
public function getAsset(string $asset): string|false
``` |
basset | github_2023 | php | 27 | Laravel-Backpack | tabacitu | @@ -42,6 +42,7 @@ public function handle(): void
$disk->deleteDirectory($path);
$disk->makeDirectory($path);
+ $disk->delete('.basset'); | So this is something I wanted to talk to you about... Should we use the _singular_ name everywhere in the file paths... OR the _plural_? 👀 🤷♂️ Would it make more sense to be:
- `storage/app/public/basset` (or)
- `storage/app/public/bassets`
I mean... are we storing
- "_things that Basset uses_" (or)
- "_back... |
basset | github_2023 | php | 27 | Laravel-Backpack | tabacitu | @@ -30,6 +36,10 @@ public function __construct()
$this->cachebusting = $cachebusting ? (string) Str::of($cachebusting)->start('?') : '';
$this->basePath = (string) Str::of(config('backpack.basset.path'))->finish('/');
+ $this->cacheMap = new CacheMap();
+ $this->loading = new LoadingTi... | Hmm I found this a bit weird... "loading" is not a noun so it's weird to do stuff to it, right? 😀
```suggestion
$this->loader = new LoadingTime();
``` |
basset | github_2023 | php | 27 | Laravel-Backpack | tabacitu | @@ -153,29 +163,39 @@ public function getUrl(string $asset): string
*/
public function basset(string $asset, bool|string $output = true, array $attributes = []): StatusEnum
{
+ $this->loading->start(); | Yup, there we go... this is a bit weird, right? Wouldn't it make more sense as:
```suggestion
$this->loader->start();
``` |
basset | github_2023 | php | 27 | Laravel-Backpack | tabacitu | @@ -0,0 +1,77 @@
+<?php
+
+namespace Backpack\Basset\Helpers;
+
+use Illuminate\Filesystem\FilesystemAdapter;
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Storage;
+
+class CacheMap
+{
+ private $map = [];
+ private $path;
+ private $isActive = false;
+ private $isDirty = false;
+
+... | I notice the assets get their ABSOLUTE paths added:
<img width="1512" alt="CleanShot 2023-04-21 at 11 45 54@2x" src="https://user-images.githubusercontent.com/1032474/233590288-d07e40ad-0b54-4d21-88a5-f0479c2f6a1b.png">
Doesn't this mean that... if something changes, like the protocol (HTTP/HTTPS) or app name (un... |
basset | github_2023 | php | 23 | Laravel-Backpack | tabacitu | @@ -1,6 +1,9 @@
<?php
return [
+ // development mode, assets will not be internalized
+ 'dev_mode' => false, | We should probably have an ENV variable for this. That way, most devs wouldn't need to publish the config file at all. Do you have a better name than this?
```suggestion
'dev_mode' => env('BASSET_DEV_MODE', false),
``` |
lume | github_2023 | others | 232 | lumehq | yukibtc | @@ -449,7 +449,8 @@ pub async fn publish(
// Create unsigned event
let unsigned_event = match difficulty {
- Some(num) => EventBuilder::text_note(content, tags).to_unsigned_pow_event(public_key, num),
+ Some(num) => EventBuilder::pow(EventBuilder::text_note(content, tags), num)
+ .t... | You can rewrite this to:
```rust
EventBuilder::text_note(content, tags).pow(num).to_unsigned_event(public_key)
```
(so is more readable) |
lume | github_2023 | others | 232 | lumehq | yukibtc | @@ -382,7 +382,7 @@ pub async fn copy_friend(npub: &str, state: State<'_, Nostr>) -> Result<bool, St
.await
{
for event in contact_list_events.into_iter() {
- for tag in event.into_iter_tags() {
+ for tag in event.tags { | It's not mandatory but if you call `iter` or `into_iter` on a list/collection, it will be faster. |
lume | github_2023 | others | 202 | lumehq | reyamir | @@ -469,11 +469,13 @@ pub async fn zap_event(
#[tauri::command]
#[specta::specta]
pub async fn get_following(
- client: &Client,
- public_key: &PublicKey,
+ state: State<'_, Nostr>,
+ public_key: &str,
timeout: Option<std::time::Duration>,
) -> Result<Vec<String>, String> {
- let filter = Filter::new().kind... | I think we should have a simple validate for pubkey, because whole app will crash if pubkey is not valid here |
lume | github_2023 | others | 166 | lumehq | yukibtc | @@ -0,0 +1,147 @@
+use crate::Nostr;
+use nostr_sdk::prelude::*;
+use std::{str::FromStr, time::Duration};
+use tauri::State;
+
+#[tauri::command(async)]
+pub async fn get_event(id: &str, nostr: State<'_, Nostr>) -> Result<String, ()> {
+ let client = &nostr.client;
+ let event_id;
+
+ if id.starts_with("note1") {
+... | The event ID has "note" as bech32 prefix, the "nevent" is for events and "naddr" for coordinates.
Try to use this:
```rust
let event_id: EventId = match Nip19::from_bech32(..) {
Ok(val) => match val {
Nip19::EventId(id) => id,
Nip19::Event(e) => e.event_id,
_ => // return error
},
E... |
lume | github_2023 | others | 166 | lumehq | yukibtc | @@ -4,35 +4,73 @@
)]
pub mod commands;
+pub mod nostr;
+use age::secrecy::ExposeSecret;
+use keyring::Entry;
+use nostr_sdk::prelude::*;
+use tauri::Manager;
use tauri_plugin_autostart::MacosLauncher;
-use tauri_plugin_sql::{Migration, MigrationKind};
-use tauri_plugin_theme::ThemePlugin;
+use tokio::sync::Mutex... | Is the `Mutex` required for `tauri`? Or another specific feature?
Because the `Client` has no mutable method (to be compatible by default with multi-threaded env, so not require to be wrapped in `Arc` and/or `Mutex`), so if you not need to completely replace it (or something else that I missed), the `Mutex` isn't ne... |
lume | github_2023 | typescript | 167 | lumehq | reyamir | @@ -3,6 +3,7 @@ export const FETCH_LIMIT = 20;
export const LANGUAGES = [
{ label: "English", code: "en" },
{ label: "Japanese", code: "ja" },
+ { label: "French", code: "fr" }, | `Français` seems better for recognize |
org-timeblock | github_2023 | others | 20 | ichernyshovvv | alphapapa | @@ -1413,6 +1415,30 @@ When called from Lisp, DATE should be a date as returned by
(ot-show-context)
(recenter))))
+(defun ot-clock-in ()
+ "Jump to the org heading of selected timeblock." | The docstring needs to be updated to match what the command does. :) |
org-timeblock | github_2023 | others | 20 | ichernyshovvv | alphapapa | @@ -1413,6 +1415,30 @@ When called from Lisp, DATE should be a date as returned by
(ot-show-context)
(recenter))))
+(defun ot-clock-in ()
+ "Jump to the org heading of selected timeblock."
+ (interactive)
+ (unless (eq major-mode 'org-timeblock-mode)
+ (user-error "Not in *org-timeblock* buffer"))... | Probably `save-excursion` should be used around the body of the function. |
org-timeblock | github_2023 | others | 20 | ichernyshovvv | alphapapa | @@ -1413,6 +1415,30 @@ When called from Lisp, DATE should be a date as returned by
(ot-show-context)
(recenter))))
+(defun ot-clock-in ()
+ "Jump to the org heading of selected timeblock."
+ (interactive)
+ (unless (eq major-mode 'org-timeblock-mode)
+ (user-error "Not in *org-timeblock* buffer"))... | Generally, searching for XML with a regexp seems like something to be avoided. If possible, text-properties should be used instead, to mark the boundaries of entries. (Maybe that would be out-of-scope for this PR, but something to consider.) |
org-timeblock | github_2023 | others | 20 | ichernyshovvv | alphapapa | @@ -1413,6 +1415,30 @@ When called from Lisp, DATE should be a date as returned by
(ot-show-context)
(recenter))))
+(defun ot-clock-in ()
+ "Jump to the org heading of selected timeblock."
+ (interactive)
+ (unless (eq major-mode 'org-timeblock-mode)
+ (user-error "Not in *org-timeblock* buffer"))... | It would be good to use `rx-to-string` instead of a raw string and `format` here. |
org-timeblock | github_2023 | others | 20 | ichernyshovvv | alphapapa | @@ -1413,6 +1415,30 @@ When called from Lisp, DATE should be a date as returned by
(ot-show-context)
(recenter))))
+(defun ot-clock-in ()
+ "Jump to the org heading of selected timeblock."
+ (interactive)
+ (unless (eq major-mode 'org-timeblock-mode)
+ (user-error "Not in *org-timeblock* buffer"))... | This indentation is off. |
org-timeblock | github_2023 | others | 20 | ichernyshovvv | alphapapa | @@ -1413,6 +1415,30 @@ When called from Lisp, DATE should be a date as returned by
(ot-show-context)
(recenter))))
+(defun ot-clock-in ()
+ "Jump to the org heading of selected timeblock."
+ (interactive)
+ (unless (eq major-mode 'org-timeblock-mode)
+ (user-error "Not in *org-timeblock* buffer"))... | You'll likely want to use `save-window-excursion`, unless you want the user to actually switch away from the timeblock view. |
org-timeblock | github_2023 | others | 3 | ichernyshovvv | ichernyshovvv | @@ -683,7 +683,7 @@ commands"
(quit-window t))
(defun ot--schedule-time (marker eventp)
- "Change the timestamp of the org entry at MARKER to a specified time(range) interactively.
+ "Interactively change Org entry timestamp at MARKER to a specified time-range. | Please change to "Interactively change time for Org entry timestamp at MARKER." |
org-timeblock | github_2023 | others | 3 | ichernyshovvv | ichernyshovvv | @@ -683,7 +683,7 @@ commands"
(quit-window t))
(defun ot--schedule-time (marker eventp)
- "Change the timestamp of the org entry at MARKER to a specified time(range) interactively.
+ "Interactively change Org entry timestamp at MARKER to a specified time-range.
If EVENTP is non-nil, change timestamp of the eve... | I think, we need to clarify here that the time might be a timerange which depends on user interactive choice. |
org-timeblock | github_2023 | others | 3 | ichernyshovvv | ichernyshovvv | @@ -787,7 +787,8 @@ PROMPT can overwrite the default prompt."
(defun ot-construct-id (&optional marker eventp)
"Construct identifier for the org entry at MARKER.
-If MARKER is nil, use entry at point."
+If MARKER is nil, use entry at point.
+If EVENTP is non-nil use entry's TIMESTAMP property." | Please add a comma after 'non-nil' |
efficiency-nodes-comfyui | github_2023 | python | 55 | LucianoCirino | LucianoCirino | @@ -89,12 +89,20 @@ def efficientloader(self, ckpt_name, vae_name, clip_skip, lora_name, lora_model_
vae_cache, ckpt_cache, lora_cache = get_cache_numbers("Efficient Loader")
if lora_name != "None" or lora_stack is not None:
| This line should actually be:
```
if lora_name != "None" or lora_stack:
```
So we take into account both when lora_stack is not connected (value = None) and when its an empty list [ ]. The current version you posted will give an error if you connect the LoRA Stacker and set all the LoRA names on both Efficient Load... |
efficiency-nodes-comfyui | github_2023 | python | 55 | LucianoCirino | LucianoCirino | @@ -89,12 +89,20 @@ def efficientloader(self, ckpt_name, vae_name, clip_skip, lora_name, lora_model_
vae_cache, ckpt_cache, lora_cache = get_cache_numbers("Efficient Loader")
if lora_name != "None" or lora_stack is not None:
+ # Initialize an empty list to store LoRa parameters.
... | Checking for lora_params being None or an empty list at this point might not be necessary, because we are only entering this part of the logic if 'lora_name' or 'lora_stack' is valid, and if they are valid, so will 'lora_params'.
So it would just turn to this.
```
model, clip = load_lora(lora_params, ckpt_name, my... |
insights-bot | github_2023 | go | 206 | nekomeowww | LemonNekoGH | @@ -218,7 +218,7 @@ func (m *AutoRecapService) summarize(chatID int64, options *ent.TelegramChatReca
logID, summarizations, err := m.chathistories.SummarizeChatHistories(chatID, chatType, histories)
if err != nil {
- m.logger.Error("failed to summarize last six hour chat histories",
+ m.logger.Error(fmt.Sprintf... | Maybe we need `Errorf` function? |
insights-bot | github_2023 | go | 206 | nekomeowww | nekomeowww | @@ -403,14 +403,61 @@ func (m *AutoRecapService) summarize(chatID int64, options *ent.TelegramChatReca
msg.ReplyMarkup = inlineKeyboardMarkup
}
- _, err = m.botService.Send(msg)
+ sent_msg, err := m.botService.Send(msg)
if err != nil {
m.logger.Error("failed to send chat histories recap",
... | You can use the similar technic like what you have written with https://github.com/nekomeowww/insights-bot/pull/206/files#diff-99fbab3f020962dc5770c6e55c402059116a0a019d7c9a243de8db596ed8b6afR256-R260 as well as https://github.com/nekomeowww/insights-bot/blob/0ec307bb387b3cf3f28fc623d36d57fa7376667c/internal/services/a... |
insights-bot | github_2023 | go | 206 | nekomeowww | nekomeowww | @@ -403,14 +403,61 @@ func (m *AutoRecapService) summarize(chatID int64, options *ent.TelegramChatReca
msg.ReplyMarkup = inlineKeyboardMarkup
}
- _, err = m.botService.Send(msg)
+ sent_msg, err := m.botService.Send(msg)
if err != nil {
m.logger.Error("failed to send chat histories recap",
... | ```suggestion
sentMsg, err := m.botService.Send(msg)
if err != nil {
m.logger.Error("failed to send chat histories recap",
zap.Int64("chat_id", chatID),
zap.Int("auto_recap_rates", options.AutoRecapRatesPerDay),
zap.Error(err),
)
}
// Check whether the first message of the ... |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -21,84 +21,141 @@ system:
modules:
telegram:
chatMigration:
- notification: |
- {{.Name}} @{{.Username}} 监测到您的群组已从 <b>群组(group)</b> 升级为了 <b>超级群组(supergroup)</b>,届时,群组的 ID 将会发生变更,<b>现已自动将过去的历史记录和数据留存自动迁移到了新的群组 ID 名下</b>,之前的设置将会保留并继续沿用,不过需要注意的是,由于 Telegram 官方的限制,迁移事件前的消息 ID 将无法与今后发送的消息 ID 相兼容,所以当下... | ```
{{.Name}} @{{.Username}} has upgraded
```
Should not be `has upgraded`, shouldn't it be `has detected that your group has been upgraded to`? |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -21,84 +21,141 @@ system:
modules:
telegram:
chatMigration:
- notification: |
- {{.Name}} @{{.Username}} 监测到您的群组已从 <b>群组(group)</b> 升级为了 <b>超级群组(supergroup)</b>,届时,群组的 ID 将会发生变更,<b>现已自动将过去的历史记录和数据留存自动迁移到了新的群组 ID 名下</b>,之前的设置将会保留并继续沿用,不过需要注意的是,由于 Telegram 官方的限制,迁移事件前的消息 ID 将无法与今后发送的消息 ID 相兼容,所以当下... | Please add one extra empty line at the end of the file. |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -15,90 +15,150 @@ system:
{{ .Commands }}
cancel:
- help: Cancel the current activated operation
- alreadyCancelledAll: There is no activated operation to cancel
+ help: Cancel the current operation
+ alreadyCancelledAll: There is no operation t... | Why choose the word `adjustment`?
```
Due to Telegram's restrictions, message IDs sent before the upgrade will not correspond with those sent afterwards.
```
And why so many commas. |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -15,90 +15,150 @@ system:
{{ .Commands }}
cancel:
- help: Cancel the current activated operation
- alreadyCancelledAll: There is no activated operation to cancel
+ help: Cancel the current operation
+ alreadyCancelledAll: There is no operation t... | ```suggestion
- For chat history summaries, assign me as admin (with or without permissions) using a <b>non-anonymous identity</b> to avoid permission detection errors. Then, initiate /configure_recap@{{.Username}} to set up chat recap.
``` |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -15,90 +15,150 @@ system:
{{ .Commands }}
cancel:
- help: Cancel the current activated operation
- alreadyCancelledAll: There is no activated operation to cancel
+ help: Cancel the current operation
+ alreadyCancelledAll: There is no operation t... | ```suggestion
- Revoking my admin role will trigger myself to clean up erase all recorded messages, as well as historical data and logs (only when the actual implemented haven't modified by the other operators of bot instances).
``` |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -15,90 +15,150 @@ system:
{{ .Commands }}
cancel:
- help: Cancel the current activated operation
- alreadyCancelledAll: There is no activated operation to cancel
+ help: Cancel the current operation
+ alreadyCancelledAll: There is no operation t... | ```suggestion
2. Raise an issue at the <a href="https://github.com/nekomeowww/insights-bot">open sourced repository</a> for more info from the developers.
``` |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -15,90 +15,150 @@ system:
{{ .Commands }}
cancel:
- help: Cancel the current activated operation
- alreadyCancelledAll: There is no activated operation to cancel
+ help: Cancel the current operation
+ alreadyCancelledAll: There is no operation t... | ```suggestion
- For chat history summaries, assign me as admin (with or without permissions) using a <b>non-anonymous identity</b> to avoid permission detection errors. Then, initiate /configure_recap@{{.Username}} to set up chat recap.
``` |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -2,103 +2,100 @@ system:
commands:
groups:
basic:
- name: 基础命令
+ name: Basic Commands
commands:
start:
- help: Start interacting with the bot
+ help: Begin interacting with the bot
help:
- help: Get help
+ help: O... | ```suggestion
help: Cancel any ongoing operations.
``` |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -2,103 +2,100 @@ system:
commands:
groups:
basic:
- name: 基础命令
+ name: Basic Commands
commands:
start:
- help: Start interacting with the bot
+ help: Begin interacting with the bot
help:
- help: Get help
+ help: O... | ```suggestion
alreadyCancelledAll: No ongoing operations to cancel
``` |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -2,103 +2,100 @@ system:
commands:
groups:
basic:
- name: 基础命令
+ name: Basic Commands
commands:
start:
- help: Start interacting with the bot
+ help: Begin interacting with the bot
help:
- help: Get help
+ help: O... | ```suggestion
{{.Name}} @{{.Username}} has observed your group's upgrading to a <b>supergroup</b>, where the group ID will change. Rest assured, we've smoothly transitioned all historical data to the new group ID, while maintaining all your settings unaltered. However, due to Telegram's limitations, message IDs fr... |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -2,103 +2,100 @@ system:
commands:
groups:
basic:
- name: 基础命令
+ name: Basic Commands
commands:
start:
- help: Start interacting with the bot
+ help: Begin interacting with the bot
help:
- help: Get help
+ help: O... | ```suggestion
- For chat history summaries, please assign me as admin (all permissions can be omitted) using a <b>non-anonymous identity</b> (recommended, otherwise permission validation may fail. Then, start /configure_recap@{{.Username}} to configure chat recap.
``` |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -2,103 +2,100 @@ system:
commands:
groups:
basic:
- name: 基础命令
+ name: Basic Commands
commands:
start:
- help: Start interacting with the bot
+ help: Begin interacting with the bot
help:
- help: Get help
+ help: O... | ```suggestion
- For chat history summaries, please assign me as admin (all permissions can be omitted) using a <b>non-anonymous identity</b> (recommended, otherwise permission validation may fail. Then, start /configure_recap@{{.Username}} to configure chat recap.
``` |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -2,103 +2,100 @@ system:
commands:
groups:
basic:
- name: 基础命令
+ name: Basic Commands
commands:
start:
- help: Start interacting with the bot
+ help: Begin interacting with the bot
help:
- help: Get help
+ help: O... | ```suggestion
⚠️ Your group isn't a supergroup yet; message reference linking will not work.
``` |
insights-bot | github_2023 | others | 194 | nekomeowww | nekomeowww | @@ -2,103 +2,100 @@ system:
commands:
groups:
basic:
- name: 基础命令
+ name: Basic Commands
commands:
start:
- help: Start interacting with the bot
+ help: Begin interacting with the bot
help:
- help: Get help
+ help: O... | ```suggestion
To enable message reference linking:
``` |
insights-bot | github_2023 | others | 190 | nekomeowww | nekomeowww | @@ -21,34 +21,35 @@ system:
commands:
groups:
summarization:
- name: 量子速读
+ name: Quantum Speed Reading | ```suggestion
name: Quantum Speed-Reading
```
Should we align the name for it? |
insights-bot | github_2023 | others | 190 | nekomeowww | nekomeowww | @@ -21,34 +21,35 @@ system:
commands:
groups:
summarization:
- name: 量子速读
+ name: Quantum Speed Reading
commands:
smr:
- help: 量子速读网页文章(也支持在频道中使用) 用法:/smr <code><链接></code>
- noLinksFound: 没有找到链接,可以发送一个有效的链接吗?用法:<code>/smr <链接></code>
- invalidLi... | ```suggestion
rateLimitExceeded: Our apologies, but your recent action has reached the rate limit maintain due to maintain service stability. This command may be utilized once every {{ .Seconds }} seconds. We kindly ask you to wait {{ .SecondsToBeWaited }} seconds before your next attempt. Your understandin... |
insights-bot | github_2023 | others | 190 | nekomeowww | nekomeowww | @@ -66,39 +66,34 @@ modules:
commands:
groups:
summarization:
- name: 量子速读
+ name: Quantum Speed-Reading
commands:
smr:
- help: 量子速读网页文章(也支持在频道中使用) 用法:/smr <code><链接></code>
- noLinksFound:
- telegram: 没有找到链接,可以发送一个有效的链接吗?用法:<code>/smr <链接></c... | Should also translate for `telegram` and `slackOrDiscord`. |
insights-bot | github_2023 | others | 161 | nekomeowww | PA733 | @@ -119,9 +119,9 @@ services:
environment:
- REDIS_PASSWORD=123456
command: >
- ${REDIS_PASSWORD:+--requirepass \"$REDIS_PASSWORD}\"}
+ /bin/sh -c "redis-server --requirepass $$REDIS_PASSWORD"
healthcheck:
- test: [ "CMD-SHELL", "redis-cli -e ${REDIS_PASSWORD:+-a \"$REDIS_PASSWORD\"... | 之前的改动考虑到了空密码和密码含空格的情况。
如果指定了`--requirepass ""`,那么redis将会被锁死(任何登录操作,redis都会返回`NOAUTH Authentication required`信息)。
之前的逻辑是,密码为空时不传入`--requirepass`参数。
`-e`让认证失败或ping失败时,redis-cli返回非零状态码,这样docker就能正确捕获异常。
`--no-auth-warning`去掉了在命令行传入密码时,redis-cli的警告信息 |
insights-bot | github_2023 | others | 159 | nekomeowww | nekomeowww | @@ -116,11 +116,12 @@ services:
redis_local:
image: redis:7
restart: unless-stopped
- # comment the following line if you don't want to set password for redis
+ environment:
+ - REDIS_PASSWORD=123456
command: >
- --requirepass 123456
+ ${REDIS_PASSWORD:+--requirepass \"$REDIS_PASS... | 原来还有这种写法,受教了 |
insights-bot | github_2023 | go | 119 | nekomeowww | nekomeowww | @@ -63,17 +63,17 @@ func TestSlackBot_createNewSlackCredential(t *testing.T) {
a := assert.New(t)
r := require.New(t)
- defer cleanSlackCredential(bot, r)
+ defer cleanSlackCredential(s, r)
expectTeamId := "TEAM_ID" | ```suggestion
expectTeamID := "TEAM_ID"
``` |
insights-bot | github_2023 | go | 119 | nekomeowww | nekomeowww | @@ -70,3 +81,81 @@ func (cli *Client) SendMessageWithTokenExpirationCheck(channel string, storeFn S
return cli.SendMessageWithTokenExpirationCheck(channel, storeFn, options...)
}
+
+var _ healthchecker.HealthChecker = (*BotService)(nil)
+
+type BotService struct {
+ logger *logger.Logger
+
+ services *services... | 不论如何都打印。cancelled 说明 graceful 耗时太长了,如果是正常情况,是不是要改 stop timeout 阈值? |
insights-bot | github_2023 | go | 119 | nekomeowww | nekomeowww | @@ -70,3 +81,81 @@ func (cli *Client) SendMessageWithTokenExpirationCheck(channel string, storeFn S
return cli.SendMessageWithTokenExpirationCheck(channel, storeFn, options...)
}
+
+var _ healthchecker.HealthChecker = (*BotService)(nil)
+
+type BotService struct {
+ logger *logger.Logger
+
+ services *services... | 没必要多空一行? |
insights-bot | github_2023 | go | 119 | nekomeowww | nekomeowww | @@ -0,0 +1,92 @@
+package discordbot
+
+import (
+ "context"
+ "crypto/ed25519"
+ "errors"
+ "net"
+
+ "github.com/disgoorg/disgo"
+ "github.com/disgoorg/disgo/bot"
+ "github.com/disgoorg/disgo/httpserver"
+ "github.com/nekomeowww/insights-bot/internal/configs"
+ "github.com/nekomeowww/insights-bot/pkg/logger"
+ "githu... | 给 health check 用的没必要设回 false,要不然会触发告警的 |
insights-bot | github_2023 | go | 119 | nekomeowww | nekomeowww | @@ -0,0 +1,23 @@
+package smr
+
+import (
+ "net/url"
+
+ "github.com/samber/lo"
+)
+
+func CheckUrl(urlString string) error {
+ if urlString == "" {
+ return ErrNoLink
+ }
+
+ parsedURL, err2 := url.Parse(urlString)
+ if err2 != nil {
+ return ErrParse | ```suggestion
return fmt.Errorf("%w: %w", err2, ErrParse)
``` |
insights-bot | github_2023 | go | 119 | nekomeowww | nekomeowww | @@ -0,0 +1,23 @@
+package smr
+
+import (
+ "net/url"
+
+ "github.com/samber/lo"
+)
+
+func CheckUrl(urlString string) error {
+ if urlString == "" {
+ return ErrNoLink
+ }
+
+ parsedURL, err2 := url.Parse(urlString)
+ if err2 != nil {
+ return ErrParse
+ }
+ if parsedURL.Scheme == "" || !lo.Contains([]string{"http",... | ```suggestion
return fmt.Errorf("%w: %w", err2, ErrScheme)
``` |
insights-bot | github_2023 | go | 119 | nekomeowww | nekomeowww | @@ -0,0 +1,117 @@
+package smr
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+
+ "github.com/nekomeowww/insights-bot/internal/services/smr/types"
+ "github.com/redis/rueidis"
+ "github.com/sourcegraph/conc/pool"
+)
+
+func (s *Service) AddTask(taskInfo types.TaskInfo) error {
+ result, err := json.Marshal(&taskI... | 好像没保证 `res` 有 `len() == 2`? |
insights-bot | github_2023 | go | 119 | nekomeowww | nekomeowww | @@ -0,0 +1,117 @@
+package smr
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+
+ "github.com/nekomeowww/insights-bot/internal/services/smr/types"
+ "github.com/redis/rueidis"
+ "github.com/sourcegraph/conc/pool"
+)
+
+func (s *Service) AddTask(taskInfo types.TaskInfo) error {
+ result, err := json.Marshal(&taskI... | 用 pointer pattern 省去调用方解 err |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.