mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
chore: linting fixes (#13450)
This commit is contained in:
4
Makefile
4
Makefile
@ -615,10 +615,10 @@ site/src/theme/icons.json: $(wildcard scripts/gensite/*) $(wildcard site/static/
|
|||||||
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
|
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
|
||||||
go run ./scripts/examplegen/main.go > examples/examples.gen.json
|
go run ./scripts/examplegen/main.go > examples/examples.gen.json
|
||||||
|
|
||||||
coderd/rbac/object_gen.go: scripts/rbacgen/main.go coderd/rbac/object.go
|
coderd/rbac/object_gen.go: scripts/rbacgen/rbacobject.gotmpl scripts/rbacgen/main.go coderd/rbac/object.go
|
||||||
go run scripts/rbacgen/main.go rbac > coderd/rbac/object_gen.go
|
go run scripts/rbacgen/main.go rbac > coderd/rbac/object_gen.go
|
||||||
|
|
||||||
codersdk/rbacresources_gen.go: scripts/rbacgen/main.go coderd/rbac/object.go
|
codersdk/rbacresources_gen.go: scripts/rbacgen/codersdk.gotmpl scripts/rbacgen/main.go coderd/rbac/object.go
|
||||||
go run scripts/rbacgen/main.go codersdk > codersdk/rbacresources_gen.go
|
go run scripts/rbacgen/main.go codersdk > codersdk/rbacresources_gen.go
|
||||||
|
|
||||||
docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
|
docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
|
||||||
|
@ -205,7 +205,7 @@ func (r *RootCmd) editOrganizationRole() *serpent.Command {
|
|||||||
} else {
|
} else {
|
||||||
updated, err = client.PatchOrganizationRole(ctx, org.ID, customRole)
|
updated, err = client.PatchOrganizationRole(ctx, org.ID, customRole)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("patch role: %w", err)
|
return xerrors.Errorf("patch role: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,7 +798,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
|
|||||||
if vals.Telemetry.Enable {
|
if vals.Telemetry.Enable {
|
||||||
gitAuth := make([]telemetry.GitAuth, 0)
|
gitAuth := make([]telemetry.GitAuth, 0)
|
||||||
// TODO:
|
// TODO:
|
||||||
var gitAuthConfigs []codersdk.ExternalAuthConfig
|
gitAuthConfigs := make([]codersdk.ExternalAuthConfig, 0)
|
||||||
for _, cfg := range gitAuthConfigs {
|
for _, cfg := range gitAuthConfigs {
|
||||||
gitAuth = append(gitAuth, telemetry.GitAuth{
|
gitAuth = append(gitAuth, telemetry.GitAuth{
|
||||||
Type: cfg.Type,
|
Type: cfg.Type,
|
||||||
|
@ -407,10 +407,9 @@ func createValidTemplateVersion(inv *serpent.Invocation, args createValidTemplat
|
|||||||
if errors.As(err, &jobErr) && !codersdk.JobIsMissingParameterErrorCode(jobErr.Code) {
|
if errors.As(err, &jobErr) && !codersdk.JobIsMissingParameterErrorCode(jobErr.Code) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
version, err = client.TemplateVersion(inv.Context(), version.ID)
|
version, err = client.TemplateVersion(inv.Context(), version.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -166,7 +166,7 @@ func (r *RootCmd) archiveTemplateVersions() *serpent.Command {
|
|||||||
inv.Stdout, fmt.Sprintf("Archived %d versions from "+pretty.Sprint(cliui.DefaultStyles.Keyword, template.Name)+" at "+cliui.Timestamp(time.Now()), len(resp.ArchivedIDs)),
|
inv.Stdout, fmt.Sprintf("Archived %d versions from "+pretty.Sprint(cliui.DefaultStyles.Keyword, template.Name)+" at "+cliui.Timestamp(time.Now()), len(resp.ArchivedIDs)),
|
||||||
)
|
)
|
||||||
|
|
||||||
if ok, _ := inv.ParsedFlags().GetBool("verbose"); err == nil && ok {
|
if ok, _ := inv.ParsedFlags().GetBool("verbose"); ok {
|
||||||
data, err := json.Marshal(resp)
|
data, err := json.Marshal(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("marshal verbose response: %w", err)
|
return xerrors.Errorf("marshal verbose response: %w", err)
|
||||||
|
@ -52,29 +52,29 @@ const (
|
|||||||
// RBACResourceActions is the mapping of resources to which actions are valid for
|
// RBACResourceActions is the mapping of resources to which actions are valid for
|
||||||
// said resource type.
|
// said resource type.
|
||||||
var RBACResourceActions = map[RBACResource][]RBACAction{
|
var RBACResourceActions = map[RBACResource][]RBACAction{
|
||||||
ResourceWildcard: []RBACAction{},
|
ResourceWildcard: {},
|
||||||
ResourceApiKey: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceApiKey: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
ResourceAssignOrgRole: []RBACAction{ActionAssign, ActionDelete, ActionRead},
|
ResourceAssignOrgRole: {ActionAssign, ActionDelete, ActionRead},
|
||||||
ResourceAssignRole: []RBACAction{ActionAssign, ActionCreate, ActionDelete, ActionRead},
|
ResourceAssignRole: {ActionAssign, ActionCreate, ActionDelete, ActionRead},
|
||||||
ResourceAuditLog: []RBACAction{ActionCreate, ActionRead},
|
ResourceAuditLog: {ActionCreate, ActionRead},
|
||||||
ResourceDebugInfo: []RBACAction{ActionRead},
|
ResourceDebugInfo: {ActionRead},
|
||||||
ResourceDeploymentConfig: []RBACAction{ActionRead, ActionUpdate},
|
ResourceDeploymentConfig: {ActionRead, ActionUpdate},
|
||||||
ResourceDeploymentStats: []RBACAction{ActionRead},
|
ResourceDeploymentStats: {ActionRead},
|
||||||
ResourceFile: []RBACAction{ActionCreate, ActionRead},
|
ResourceFile: {ActionCreate, ActionRead},
|
||||||
ResourceGroup: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceGroup: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
ResourceLicense: []RBACAction{ActionCreate, ActionDelete, ActionRead},
|
ResourceLicense: {ActionCreate, ActionDelete, ActionRead},
|
||||||
ResourceOauth2App: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceOauth2App: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
ResourceOauth2AppCodeToken: []RBACAction{ActionCreate, ActionDelete, ActionRead},
|
ResourceOauth2AppCodeToken: {ActionCreate, ActionDelete, ActionRead},
|
||||||
ResourceOauth2AppSecret: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceOauth2AppSecret: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
ResourceOrganization: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceOrganization: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
ResourceOrganizationMember: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceOrganizationMember: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
ResourceProvisionerDaemon: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceProvisionerDaemon: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
ResourceReplicas: []RBACAction{ActionRead},
|
ResourceReplicas: {ActionRead},
|
||||||
ResourceSystem: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceSystem: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
ResourceTailnetCoordinator: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceTailnetCoordinator: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
ResourceTemplate: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate, ActionViewInsights},
|
ResourceTemplate: {ActionCreate, ActionDelete, ActionRead, ActionUpdate, ActionViewInsights},
|
||||||
ResourceUser: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionReadPersonal, ActionUpdate, ActionUpdatePersonal},
|
ResourceUser: {ActionCreate, ActionDelete, ActionRead, ActionReadPersonal, ActionUpdate, ActionUpdatePersonal},
|
||||||
ResourceWorkspace: []RBACAction{ActionApplicationConnect, ActionCreate, ActionDelete, ActionRead, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate},
|
ResourceWorkspace: {ActionApplicationConnect, ActionCreate, ActionDelete, ActionRead, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate},
|
||||||
ResourceWorkspaceDormant: []RBACAction{ActionApplicationConnect, ActionCreate, ActionDelete, ActionRead, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate},
|
ResourceWorkspaceDormant: {ActionApplicationConnect, ActionCreate, ActionDelete, ActionRead, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate},
|
||||||
ResourceWorkspaceProxy: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
ResourceWorkspaceProxy: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ func (g *Generator) buildStruct(obj types.Object, st *types.Struct) (string, err
|
|||||||
// inferred.
|
// inferred.
|
||||||
typescriptTag, err := tags.Get("typescript")
|
typescriptTag, err := tags.Get("typescript")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if err == nil && typescriptTag.Name == "-" {
|
if typescriptTag.Name == "-" {
|
||||||
// Completely ignore this field.
|
// Completely ignore this field.
|
||||||
continue
|
continue
|
||||||
} else if typescriptTag.Name != "" {
|
} else if typescriptTag.Name != "" {
|
||||||
|
@ -21,7 +21,7 @@ const (
|
|||||||
// said resource type.
|
// said resource type.
|
||||||
var RBACResourceActions = map[RBACResource][]RBACAction{
|
var RBACResourceActions = map[RBACResource][]RBACAction{
|
||||||
{{- range $element := . }}
|
{{- range $element := . }}
|
||||||
Resource{{ pascalCaseName $element.FunctionName }}: []RBACAction{
|
Resource{{ pascalCaseName $element.FunctionName }}: {
|
||||||
{{- range $actionValue, $_ := $element.Actions }}
|
{{- range $actionValue, $_ := $element.Actions }}
|
||||||
{{- actionEnum $actionValue -}},
|
{{- actionEnum $actionValue -}},
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
Reference in New Issue
Block a user