Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: optimize lint #520

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ Example [https://github.com/goravel/example](https://github.com/goravel/example)

## Main Function

| | | | | |
| ---------- | -------------- | -------------- | -------------- | -------------- |
| [Config](https://www.goravel.dev/getting-started/configuration.html) | [Http](https://www.goravel.dev/the-basics/routing.html) | [Authentication](https://www.goravel.dev/security/authentication.html) | [Authorization](https://www.goravel.dev/security/authorization.html) | [Orm](https://www.goravel.dev/orm/getting-started.html) |
| [Migrate](https://www.goravel.dev/orm/migrations.html) | [Logger](https://www.goravel.dev/the-basics/logging.html) | [Cache](https://www.goravel.dev/digging-deeper/cache.html) | [Grpc](https://www.goravel.dev/the-basics/grpc.html) | [Artisan Console](https://www.goravel.dev/digging-deeper/artisan-console.html) |
| [Task Scheduling](https://www.goravel.dev/digging-deeper/task-scheduling.html) | [Queue](https://www.goravel.dev/digging-deeper/queues.html) | [Event](https://www.goravel.dev/digging-deeper/event.html) | [FileStorage](https://www.goravel.dev/digging-deeper/filesystem.html) | [Mail](https://www.goravel.dev/digging-deeper/mail.html) |
| [Validation](https://www.goravel.dev/the-basics/validation.html) | [Mock](https://www.goravel.dev/testing/mock.html) | [Hash](https://www.goravel.dev/security/hashing.html) | [Crypt](https://www.goravel.dev/security/encryption.html) | [Carbon](https://www.goravel.dev/digging-deeper/helpers.html) |
| [Package Development](https://www.goravel.dev/digging-deeper/package-development.html) | [Testing](https://www.goravel.dev/testing/getting-started.html) | [Localization](https://www.goravel.dev/digging-deeper/localization.html) | [Session](https://www.goravel.dev/the-basics/session.html) | |
| | | | | |
|----------------------------------------------------------------------------------------|-----------------------------------------------------------------|--------------------------------------------------------------------------|-----------------------------------------------------------------------|--------------------------------------------------------------------------------|
| [Config](https://www.goravel.dev/getting-started/configuration.html) | [Http](https://www.goravel.dev/the-basics/routing.html) | [Authentication](https://www.goravel.dev/security/authentication.html) | [Authorization](https://www.goravel.dev/security/authorization.html) | [Orm](https://www.goravel.dev/orm/getting-started.html) |
| [Migrate](https://www.goravel.dev/orm/migrations.html) | [Logger](https://www.goravel.dev/the-basics/logging.html) | [Cache](https://www.goravel.dev/digging-deeper/cache.html) | [Grpc](https://www.goravel.dev/the-basics/grpc.html) | [Artisan Console](https://www.goravel.dev/digging-deeper/artisan-console.html) |
| [Task Scheduling](https://www.goravel.dev/digging-deeper/task-scheduling.html) | [Queue](https://www.goravel.dev/digging-deeper/queues.html) | [Event](https://www.goravel.dev/digging-deeper/event.html) | [FileStorage](https://www.goravel.dev/digging-deeper/filesystem.html) | [Mail](https://www.goravel.dev/digging-deeper/mail.html) |
| [Validation](https://www.goravel.dev/the-basics/validation.html) | [Mock](https://www.goravel.dev/testing/mock.html) | [Hash](https://www.goravel.dev/security/hashing.html) | [Crypt](https://www.goravel.dev/security/encryption.html) | [Carbon](https://www.goravel.dev/digging-deeper/helpers.html) |
| [Package Development](https://www.goravel.dev/digging-deeper/package-development.html) | [Testing](https://www.goravel.dev/testing/getting-started.html) | [Localization](https://www.goravel.dev/digging-deeper/localization.html) | [Session](https://www.goravel.dev/the-basics/session.html) | |

## Roadmap

Expand Down
14 changes: 7 additions & 7 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Laravel!

## 主要功能

| | | | | |
| ---------- | -------------- | -------------- | -------------- | -------------- |
| [自定义配置](https://www.goravel.dev/zh/getting-started/configuration.html) | [HTTP 服务](https://www.goravel.dev/zh/the-basics/routing.html) | [用户认证](https://www.goravel.dev/zh/security/authentication.html) | [用户授权](https://www.goravel.dev/zh/security/authorization.html) | [数据库 ORM](https://www.goravel.dev/zh/orm/getting-started.html) |
| [数据库迁移](https://www.goravel.dev/zh/orm/migrations.html) | [日志](https://www.goravel.dev/zh/the-basics/logging.html) | [缓存](https://www.goravel.dev/zh/digging-deeper/cache.html) | [Grpc](https://www.goravel.dev/zh/the-basics/grpc.html) | [Artisan 命令行](https://www.goravel.dev/zh/digging-deeper/artisan-console.html) |
| [任务调度](https://www.goravel.dev/zh/digging-deeper/task-scheduling.html) | [队列](https://www.goravel.dev/zh/digging-deeper/queues.html) | [事件系统](https://www.goravel.dev/zh/digging-deeper/event.html) | [文件存储](https://www.goravel.dev/zh/digging-deeper/filesystem.html) | [邮件](https://www.goravel.dev/zh/digging-deeper/mail.html) |
| [表单验证](https://www.goravel.dev/zh/the-basics/validation.html) | [Mock](https://www.goravel.dev/zh/digging-deeper/mock.html) | [Hash](https://www.goravel.dev/zh/security/hashing.html) | [Crypt](https://www.goravel.dev/zh/security/encryption.html) | [Carbon](https://www.goravel.dev/zh/digging-deeper/helpers.html) |
| [扩展包开发](https://www.goravel.dev/zh/digging-deeper/package-development.html) | [测试](https://www.goravel.dev/zh/testing/getting-started.html) | [本地化](https://www.goravel.dev/zh/digging-deeper/localization.html) | [Session](https://www.goravel.dev/zh/the-basics/session.html) | |
| | | | | |
|-----------------------------------------------------------------------------|---------------------------------------------------------------|--------------------------------------------------------------------|-------------------------------------------------------------------|-------------------------------------------------------------------------------|
| [自定义配置](https://www.goravel.dev/zh/getting-started/configuration.html) | [HTTP 服务](https://www.goravel.dev/zh/the-basics/routing.html) | [用户认证](https://www.goravel.dev/zh/security/authentication.html) | [用户授权](https://www.goravel.dev/zh/security/authorization.html) | [数据库 ORM](https://www.goravel.dev/zh/orm/getting-started.html) |
| [数据库迁移](https://www.goravel.dev/zh/orm/migrations.html) | [日志](https://www.goravel.dev/zh/the-basics/logging.html) | [缓存](https://www.goravel.dev/zh/digging-deeper/cache.html) | [Grpc](https://www.goravel.dev/zh/the-basics/grpc.html) | [Artisan 命令行](https://www.goravel.dev/zh/digging-deeper/artisan-console.html) |
| [任务调度](https://www.goravel.dev/zh/digging-deeper/task-scheduling.html) | [队列](https://www.goravel.dev/zh/digging-deeper/queues.html) | [事件系统](https://www.goravel.dev/zh/digging-deeper/event.html) | [文件存储](https://www.goravel.dev/zh/digging-deeper/filesystem.html) | [邮件](https://www.goravel.dev/zh/digging-deeper/mail.html) |
| [表单验证](https://www.goravel.dev/zh/the-basics/validation.html) | [Mock](https://www.goravel.dev/zh/digging-deeper/mock.html) | [Hash](https://www.goravel.dev/zh/security/hashing.html) | [Crypt](https://www.goravel.dev/zh/security/encryption.html) | [Carbon](https://www.goravel.dev/zh/digging-deeper/helpers.html) |
| [扩展包开发](https://www.goravel.dev/zh/digging-deeper/package-development.html) | [测试](https://www.goravel.dev/zh/testing/getting-started.html) | [本地化](https://www.goravel.dev/zh/digging-deeper/localization.html) | [Session](https://www.goravel.dev/zh/the-basics/session.html) | |

## 路线图

Expand Down
20 changes: 10 additions & 10 deletions cache/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewMemory(config config.Config) (*Memory, error) {
}, nil
}

//Add Driver an item in the cache if the key does not exist.
// Add Driver an item in the cache if the key does not exist.
func (r *Memory) Add(key string, value any, t time.Duration) bool {
if t == NoExpiration {
t = cache.NoExpiration
Expand All @@ -46,7 +46,7 @@ func (r *Memory) Decrement(key string, value ...int) (int, error) {
return r.instance.DecrementInt(r.key(key), value[0])
}

//Forever Driver an item in the cache indefinitely.
// Forever Driver an item in the cache indefinitely.
func (r *Memory) Forever(key string, value any) bool {
if err := r.Put(key, value, cache.NoExpiration); err != nil {
return false
Expand All @@ -55,21 +55,21 @@ func (r *Memory) Forever(key string, value any) bool {
return true
}

//Forget Remove an item from the cache.
// Forget Remove an item from the cache.
func (r *Memory) Forget(key string) bool {
r.instance.Delete(r.key(key))

return true
}

//Flush Remove all items from the cache.
// Flush Remove all items from the cache.
func (r *Memory) Flush() bool {
r.instance.Flush()

return true
}

//Get Retrieve an item from the cache by key.
// Get Retrieve an item from the cache by key.
func (r *Memory) Get(key string, def ...any) any {
val, exist := r.instance.Get(r.key(key))
if exist {
Expand Down Expand Up @@ -120,7 +120,7 @@ func (r *Memory) GetString(key string, def ...string) string {
return cast.ToString(r.Get(key, def[0]))
}

//Has Check an item exists in the cache.
// Has Check an item exists in the cache.
func (r *Memory) Has(key string) bool {
_, exist := r.instance.Get(r.key(key))

Expand All @@ -140,7 +140,7 @@ func (r *Memory) Lock(key string, t ...time.Duration) contractscache.Lock {
return NewLock(r, key, t...)
}

//Pull Retrieve an item from the cache and delete it.
// Pull Retrieve an item from the cache and delete it.
func (r *Memory) Pull(key string, def ...any) any {
var res any
if len(def) == 0 {
Expand All @@ -153,14 +153,14 @@ func (r *Memory) Pull(key string, def ...any) any {
return res
}

//Put Driver an item in the cache for a given number of seconds.
// Put Driver an item in the cache for a given number of seconds.
func (r *Memory) Put(key string, value any, t time.Duration) error {
r.instance.Set(r.key(key), value, t)

return nil
}

//Remember Get an item from the cache, or execute the given Closure and store the result.
// Remember Get an item from the cache, or execute the given Closure and store the result.
func (r *Memory) Remember(key string, seconds time.Duration, callback func() (any, error)) (any, error) {
val := r.Get(key, nil)
if val != nil {
Expand All @@ -180,7 +180,7 @@ func (r *Memory) Remember(key string, seconds time.Duration, callback func() (an
return val, nil
}

//RememberForever Get an item from the cache, or execute the given Closure and store the result forever.
// RememberForever Get an item from the cache, or execute the given Closure and store the result forever.
func (r *Memory) RememberForever(key string, callback func() (any, error)) (any, error) {
val := r.Get(key, nil)
if val != nil {
Expand Down
8 changes: 4 additions & 4 deletions console/console/list_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ func NewListCommand(artisan console.Artisan) *ListCommand {
}
}

//Signature The name and signature of the console command.
// Signature The name and signature of the console command.
func (receiver *ListCommand) Signature() string {
return "list"
}

//Description The console command description.
// Description The console command description.
func (receiver *ListCommand) Description() string {
return "List commands"
}

//Extend The console command extend.
// Extend The console command extend.
func (receiver *ListCommand) Extend() command.Extend {
return command.Extend{}
}

//Handle Execute the console command.
// Handle Execute the console command.
func (receiver *ListCommand) Handle(ctx console.Context) error {
receiver.artisan.Call("--help")

Expand Down
8 changes: 4 additions & 4 deletions console/console/stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ import (
type DummyCommand struct {
}

//Signature The name and signature of the console command.
// Signature The name and signature of the console command.
func (receiver *DummyCommand) Signature() string {
return "command:name"
}

//Description The console command description.
// Description The console command description.
func (receiver *DummyCommand) Description() string {
return "Command description"
}

//Extend The console command extend.
// Extend The console command extend.
func (receiver *DummyCommand) Extend() command.Extend {
return command.Extend{}
}

//Handle Execute the console command.
// Handle Execute the console command.
func (receiver *DummyCommand) Handle(ctx console.Context) error {

return nil
Expand Down
4 changes: 2 additions & 2 deletions database/console/migrate_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ func (receiver MigrateCreator) Create(name string, table string, create bool) er
// various place-holders, save the file, and run the post create event.
upStub, downStub := receiver.getStub(table, create)

//Create the up.sql file.
// Create the up.sql file.
if err := file.Create(receiver.getPath(name, "up"), receiver.populateStub(upStub, table)); err != nil {
return err
}

//Create the down.sql file.
// Create the down.sql file.
if err := file.Create(receiver.getPath(name, "down"), receiver.populateStub(downStub, table)); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion database/console/migrate_make_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (receiver *MigrateMakeCommand) Handle(ctx console.Context) error {
// of creating migrations that create new tables for the application.
table, create := TableGuesser{}.Guess(name)

//Write the migration file to disk.
// Write the migration file to disk.
migrateCreator := NewMigrateCreator(receiver.config)
if err := migrateCreator.Create(name, table, create); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions http/console/stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ import (
)

type DummyController struct {
//Dependent services
// Dependent services
}

func NewDummyController() *DummyController {
return &DummyController{
//Inject services
// Inject services
}
}

Expand Down
1 change: 0 additions & 1 deletion http/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ func (r *Context) Request() http.ContextRequest {
func (r *Context) Response() http.ContextResponse {
return nil
}

4 changes: 2 additions & 2 deletions mail/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ func NewSendMailJob(config config.Config) *SendMailJob {
}
}

//Signature The name and signature of the job.
// Signature The name and signature of the job.
func (r *SendMailJob) Signature() string {
return "goravel_send_mail_job"
}

//Handle Execute the job.
// Handle Execute the job.
func (r *SendMailJob) Handle(args ...any) error {
return SendMail(r.config, args[0].(string), args[1].(string), args[2].(string), args[3].(string), args[4].([]string), args[5].([]string), args[6].([]string), args[7].([]string))
}
4 changes: 2 additions & 2 deletions queue/console/job_stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ func (receiver JobStubs) Job() string {
type DummyJob struct {
}

//Signature The name and signature of the job.
// Signature The name and signature of the job.
func (receiver *DummyJob) Signature() string {
return "DummyName"
}

//Handle Execute the job.
// Handle Execute the job.
func (receiver *DummyJob) Handle(args ...any) error {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions queue/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import (
type Test struct {
}

//Signature The name and signature of the job.
// Signature The name and signature of the job.
func (receiver *Test) Signature() string {
return "test"
}

//Handle Execute the job.
// Handle Execute the job.
func (receiver *Test) Handle(args ...any) error {
return file.Create("test.txt", args[0].(string))
}
Expand Down
Loading
Loading