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)
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
|
||||
|
@ -205,7 +205,7 @@ func (r *RootCmd) editOrganizationRole() *serpent.Command {
|
||||
} else {
|
||||
updated, err = client.PatchOrganizationRole(ctx, org.ID, customRole)
|
||||
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 {
|
||||
gitAuth := make([]telemetry.GitAuth, 0)
|
||||
// TODO:
|
||||
var gitAuthConfigs []codersdk.ExternalAuthConfig
|
||||
gitAuthConfigs := make([]codersdk.ExternalAuthConfig, 0)
|
||||
for _, cfg := range gitAuthConfigs {
|
||||
gitAuth = append(gitAuth, telemetry.GitAuth{
|
||||
Type: cfg.Type,
|
||||
|
@ -407,10 +407,9 @@ func createValidTemplateVersion(inv *serpent.Invocation, args createValidTemplat
|
||||
if errors.As(err, &jobErr) && !codersdk.JobIsMissingParameterErrorCode(jobErr.Code) {
|
||||
return nil, err
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
version, err = client.TemplateVersion(inv.Context(), version.ID)
|
||||
if err != nil {
|
||||
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)),
|
||||
)
|
||||
|
||||
if ok, _ := inv.ParsedFlags().GetBool("verbose"); err == nil && ok {
|
||||
if ok, _ := inv.ParsedFlags().GetBool("verbose"); ok {
|
||||
data, err := json.Marshal(resp)
|
||||
if err != nil {
|
||||
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
|
||||
// said resource type.
|
||||
var RBACResourceActions = map[RBACResource][]RBACAction{
|
||||
ResourceWildcard: []RBACAction{},
|
||||
ResourceApiKey: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceAssignOrgRole: []RBACAction{ActionAssign, ActionDelete, ActionRead},
|
||||
ResourceAssignRole: []RBACAction{ActionAssign, ActionCreate, ActionDelete, ActionRead},
|
||||
ResourceAuditLog: []RBACAction{ActionCreate, ActionRead},
|
||||
ResourceDebugInfo: []RBACAction{ActionRead},
|
||||
ResourceDeploymentConfig: []RBACAction{ActionRead, ActionUpdate},
|
||||
ResourceDeploymentStats: []RBACAction{ActionRead},
|
||||
ResourceFile: []RBACAction{ActionCreate, ActionRead},
|
||||
ResourceGroup: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceLicense: []RBACAction{ActionCreate, ActionDelete, ActionRead},
|
||||
ResourceOauth2App: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceOauth2AppCodeToken: []RBACAction{ActionCreate, ActionDelete, ActionRead},
|
||||
ResourceOauth2AppSecret: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceOrganization: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceOrganizationMember: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceProvisionerDaemon: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceReplicas: []RBACAction{ActionRead},
|
||||
ResourceSystem: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceTailnetCoordinator: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceTemplate: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate, ActionViewInsights},
|
||||
ResourceUser: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionReadPersonal, ActionUpdate, ActionUpdatePersonal},
|
||||
ResourceWorkspace: []RBACAction{ActionApplicationConnect, ActionCreate, ActionDelete, ActionRead, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate},
|
||||
ResourceWorkspaceDormant: []RBACAction{ActionApplicationConnect, ActionCreate, ActionDelete, ActionRead, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate},
|
||||
ResourceWorkspaceProxy: []RBACAction{ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceWildcard: {},
|
||||
ResourceApiKey: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceAssignOrgRole: {ActionAssign, ActionDelete, ActionRead},
|
||||
ResourceAssignRole: {ActionAssign, ActionCreate, ActionDelete, ActionRead},
|
||||
ResourceAuditLog: {ActionCreate, ActionRead},
|
||||
ResourceDebugInfo: {ActionRead},
|
||||
ResourceDeploymentConfig: {ActionRead, ActionUpdate},
|
||||
ResourceDeploymentStats: {ActionRead},
|
||||
ResourceFile: {ActionCreate, ActionRead},
|
||||
ResourceGroup: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceLicense: {ActionCreate, ActionDelete, ActionRead},
|
||||
ResourceOauth2App: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceOauth2AppCodeToken: {ActionCreate, ActionDelete, ActionRead},
|
||||
ResourceOauth2AppSecret: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceOrganization: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceOrganizationMember: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceProvisionerDaemon: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceReplicas: {ActionRead},
|
||||
ResourceSystem: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceTailnetCoordinator: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceTemplate: {ActionCreate, ActionDelete, ActionRead, ActionUpdate, ActionViewInsights},
|
||||
ResourceUser: {ActionCreate, ActionDelete, ActionRead, ActionReadPersonal, ActionUpdate, ActionUpdatePersonal},
|
||||
ResourceWorkspace: {ActionApplicationConnect, ActionCreate, ActionDelete, ActionRead, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate},
|
||||
ResourceWorkspaceDormant: {ActionApplicationConnect, ActionCreate, ActionDelete, ActionRead, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate},
|
||||
ResourceWorkspaceProxy: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ func (g *Generator) buildStruct(obj types.Object, st *types.Struct) (string, err
|
||||
// inferred.
|
||||
typescriptTag, err := tags.Get("typescript")
|
||||
if err == nil {
|
||||
if err == nil && typescriptTag.Name == "-" {
|
||||
if typescriptTag.Name == "-" {
|
||||
// Completely ignore this field.
|
||||
continue
|
||||
} else if typescriptTag.Name != "" {
|
||||
|
@ -21,7 +21,7 @@ const (
|
||||
// said resource type.
|
||||
var RBACResourceActions = map[RBACResource][]RBACAction{
|
||||
{{- range $element := . }}
|
||||
Resource{{ pascalCaseName $element.FunctionName }}: []RBACAction{
|
||||
Resource{{ pascalCaseName $element.FunctionName }}: {
|
||||
{{- range $actionValue, $_ := $element.Actions }}
|
||||
{{- actionEnum $actionValue -}},
|
||||
{{- end -}}
|
||||
|
Reference in New Issue
Block a user