Skip to content

Commit 3632a93

Browse files
committed
chore: update code comments and description
1 parent 16c94cd commit 3632a93

11 files changed

Lines changed: 16 additions & 13 deletions

docs/resources/user.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ resource "forgejo_user" "non_defaults" {
7777
- `restricted` (Boolean) Is the user restricted?
7878
- `send_notify` (Boolean) Send notification to administrators? Changing this forces a new resource to be created.
7979
- `source_id` (Number) Numeric identifier of the user's authentication source.
80-
- `visibility` (String) Visibility of the user.
80+
- `visibility` (String) Visibility of the user. Possible values are 'public' (default), 'limited', or 'private'.
8181
- `website` (String) Website of the user.
8282

8383
### Read-Only

internal/provider/organization_action_secret_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (m *organizationActionSecretResourceModel) from(s *forgejo.Secret) {
5050
return
5151
}
5252

53-
// name is omitted here, to maintain the user's configuration casing
53+
// Name is omitted here, to maintain the user's configuration casing
5454
m.CreatedAt = types.StringValue(s.Created.Format(time.RFC3339))
5555
}
5656

internal/provider/organization_action_variable_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func (d *organizationActionVariableDataSource) Read(ctx context.Context, req dat
174174
}
175175

176176
// Map response body to model
177-
// name is omitted here, to maintain the user's configuration casing
177+
// Name is omitted here, to maintain the user's configuration casing
178178
data.Data = types.StringValue(variable.Data)
179179

180180
// Save data into Terraform state

internal/provider/organization_action_variable_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (m *organizationActionVariableResourceModel) from(v *forgejo.ActionVariable
4646
return
4747
}
4848

49-
// name is omitted here, to maintain the user's configuration casing
49+
// Name is omitted here, to maintain the user's configuration casing
5050
m.Data = types.StringValue(v.Data)
5151
}
5252

internal/provider/organization_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ func (r *organizationResource) Schema(_ context.Context, _ resource.SchemaReques
131131
Description: "Visibility of the organization. Possible values are 'public' (default), 'limited', or 'private'.",
132132
Optional: true,
133133
Computed: true,
134+
// No static default value, because DEFAULT_ORG_VISIBILITY controls server setting
134135
PlanModifiers: []planmodifier.String{
135136
stringplanmodifier.UseStateForUnknown(),
136137
},

internal/provider/repository_action_secret_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (m *repositoryActionSecretResourceModel) from(s *forgejo.Secret) {
4747
return
4848
}
4949

50-
// name is omitted here, to maintain the user's configuration casing
50+
// Name is omitted here, to maintain the user's configuration casing
5151
m.CreatedAt = types.StringValue(s.Created.Format(time.RFC3339))
5252
}
5353

internal/provider/repository_action_variable_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (d *repositoryActionVariableDataSource) Read(ctx context.Context, req datas
158158
}
159159

160160
// Map response body to model
161-
// name is omitted here, to maintain the user's configuration casing
161+
// Name is omitted here, to maintain the user's configuration casing
162162
data.Data = types.StringValue(variable.Data)
163163

164164
// Save data into Terraform state

internal/provider/repository_action_variable_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (m *repositoryActionVariableResourceModel) from(v *forgejo.ActionVariable)
4242
return
4343
}
4444

45-
// name is omitted here, to maintain the user's configuration casing
45+
// Name is omitted here, to maintain the user's configuration casing
4646
m.Data = types.StringValue(v.Data)
4747
}
4848

internal/provider/repository_resource.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (m *repositoryResourceModel) from(r *forgejo.Repository) {
159159
m.DefaultBranch = types.StringValue(r.DefaultBranch)
160160

161161
if !m.Mirror.ValueBool() {
162-
// cannot archive/un-archive repository mirrors
162+
// Cannot archive/un-archive repository mirrors
163163
m.Archived = types.BoolValue(r.Archived)
164164
}
165165

@@ -178,7 +178,7 @@ func (m *repositoryResourceModel) from(r *forgejo.Repository) {
178178
m.MirrorUpdated = types.StringValue(r.MirrorUpdated.Format(time.RFC3339))
179179

180180
if m.HasPullRequests.ValueBool() {
181-
// only update PR settings if PRs are enabled
181+
// Only update PR settings if PRs are enabled
182182
m.IgnoreWhitespaceConflicts = types.BoolValue(r.IgnoreWhitespaceConflicts)
183183
m.AllowMerge = types.BoolValue(r.AllowMerge)
184184
m.AllowRebase = types.BoolValue(r.AllowRebase)
@@ -214,7 +214,7 @@ func (m *repositoryResourceModel) to(o *forgejo.EditRepoOption) {
214214
o.AllowSquash = m.AllowSquash.ValueBoolPointer()
215215

216216
if !m.Mirror.ValueBool() {
217-
// cannot archive/un-archive repository mirrors
217+
// Cannot archive/un-archive repository mirrors
218218
o.Archived = m.Archived.ValueBoolPointer()
219219
}
220220

@@ -812,6 +812,7 @@ func (r *repositoryResource) Schema(_ context.Context, _ resource.SchemaRequest,
812812
Description: "Mirror interval of the repository. **Note**: This setting is only effective if `mirror` is `true`.",
813813
Optional: true,
814814
Computed: true,
815+
// No static default value, because DEFAULT_INTERVAL controls server setting
815816
Validators: []validator.String{
816817
stringvalidator.All(
817818
stringvalidator.AlsoRequires(path.Expressions{

internal/provider/user_resource.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (m *userResourceModel) to(s *userResourceModel, o *forgejo.EditUserOption)
112112
o.FullName = m.FullName.ValueStringPointer()
113113

114114
if s != nil && !m.Password.Equal(s.Password) {
115-
// only update password if it has changed
115+
// Only update password if it has changed
116116
o.Password = m.Password.ValueString()
117117
}
118118

@@ -253,9 +253,10 @@ func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
253253
Default: stringdefault.StaticString(""),
254254
},
255255
"visibility": schema.StringAttribute{
256-
Description: "Visibility of the user.",
256+
Description: "Visibility of the user. Possible values are 'public' (default), 'limited', or 'private'.",
257257
Optional: true,
258258
Computed: true,
259+
// No static default value, because DEFAULT_USER_VISIBILITY controls server setting
259260
PlanModifiers: []planmodifier.String{
260261
stringplanmodifier.UseStateForUnknown(),
261262
},

0 commit comments

Comments
 (0)