Skip to content

Commit 2332639

Browse files
cmaglieper1234
andcommitted
Apply suggestions from code review
Co-authored-by: per1234 <[email protected]>
1 parent 8e0db4b commit 2332639

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

arduino/errors.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -212,21 +212,21 @@ func (e *UnknownProfileError) ToRPCStatus() *status.Status {
212212
return status.New(codes.NotFound, e.Error())
213213
}
214214

215-
// InvlaidProfileError is returned when the profile has errors
216-
type InvlaidProfileError struct {
215+
// InvalidProfileError is returned when the profile has errors
216+
type InvalidProfileError struct {
217217
Cause error
218218
}
219219

220-
func (e *InvlaidProfileError) Error() string {
220+
func (e *InvalidProfileError) Error() string {
221221
return composeErrorMsg(tr("Invalid profile"), e.Cause)
222222
}
223223

224-
func (e *InvlaidProfileError) Unwrap() error {
224+
func (e *InvalidProfileError) Unwrap() error {
225225
return e.Cause
226226
}
227227

228228
// ToRPCStatus converts the error into a *status.Status
229-
func (e *InvlaidProfileError) ToRPCStatus() *status.Status {
229+
func (e *InvalidProfileError) ToRPCStatus() *status.Status {
230230
return status.New(codes.FailedPrecondition, e.Error())
231231
}
232232

arduino/sketch/profiles.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"gopkg.in/yaml.v2"
3030
)
3131

32-
// Project represents all the
32+
// Project represents all the profiles defined for the sketch
3333
type Project struct {
3434
Profiles map[string]*Profile `yaml:"profiles"`
3535
DefaultProfile string `yaml:"default_profile"`
@@ -141,9 +141,9 @@ func (p *ProfilePlatformReference) UnmarshalYAML(unmarshal func(interface{}) err
141141
return err
142142
}
143143
if platformID, ok := data["platform"]; !ok {
144-
return fmt.Errorf(tr("missing 'platform' directive"))
144+
return fmt.Errorf(tr("missing '%s' directive", "platform"))
145145
} else if platformID, platformVersion, ok := parseNameAndVersion(platformID); !ok {
146-
return fmt.Errorf(tr("invalid 'platform' directive"))
146+
return fmt.Errorf(tr("invalid '%s' directive", "platform"))
147147
} else if c, err := semver.Parse(platformVersion); err != nil {
148148
return fmt.Errorf("%s: %w", tr("error parsing version constraints"), err)
149149
} else if split := strings.SplitN(platformID, ":", 2); len(split) != 2 {
@@ -157,7 +157,7 @@ func (p *ProfilePlatformReference) UnmarshalYAML(unmarshal func(interface{}) err
157157
if rawIndexURL, ok := data["platform_index_url"]; ok {
158158
indexURL, err := url.Parse(rawIndexURL)
159159
if err != nil {
160-
return fmt.Errorf("%s: %w", tr("invlid platform index URL:"), err)
160+
return fmt.Errorf("%s: %w", tr("invalid platform index URL:"), err)
161161
}
162162
p.PlatformIndexURL = indexURL
163163
}

cli/arguments/profiles.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ func (f *Profile) AddToCommand(cmd *cobra.Command) {
3030
// TODO: register autocompletion
3131
}
3232

33-
// Get returns the profile
33+
// Get returns the profile name
3434
func (f *Profile) Get() string {
3535
return f.profile
3636
}
3737

38-
// String returns the profile
38+
// String returns the profile name
3939
func (f *Profile) String() string {
4040
return f.profile
4141
}

cli/instance/instance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func CreateAndInit() *rpc.Instance {
4141
return inst
4242
}
4343

44-
// CreateAndInitWithProfile return a new initialized instance using the given profile in the give sketch.
44+
// CreateAndInitWithProfile returns a new initialized instance using the given profile of the given sketch.
4545
// If Create fails the CLI prints an error and exits since to execute further operations a valid Instance is mandatory.
4646
// If Init returns errors they're printed only.
4747
func CreateAndInitWithProfile(profileName string, sketchPath *paths.Path) (*rpc.Instance, *rpc.Profile) {

rpc/cc/arduino/cli/commands/v1/commands.proto

+2-2
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ message InitRequest {
200200
Instance instance = 1;
201201
// Profile to use
202202
string profile = 2;
203-
// The path where the sketch is stored (contains also the profile.yml path)
203+
// The path where the sketch is stored
204204
string sketch_path = 3;
205205
}
206206

@@ -214,7 +214,7 @@ message InitResponse {
214214
oneof message {
215215
Progress init_progress = 1;
216216
google.rpc.Status error = 2;
217-
// Fqbn selected in profile (optional)
217+
// FQBN selected in profile (optional)
218218
Profile profile = 3;
219219
}
220220
}

0 commit comments

Comments
 (0)