Skip to content

Commit b95dbaa

Browse files
committed
Fixed ENUM_VALUE_PREFIX and ENUM_VALUE_UPPER_SNAKE_CASE lint warning
1 parent 2447395 commit b95dbaa

File tree

12 files changed

+109
-105
lines changed

12 files changed

+109
-105
lines changed

arduino/libraries/libraries_layout.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ func (d *LibraryLayout) UnmarshalJSON(b []byte) error {
7272
func (d *LibraryLayout) ToRPCLibraryLayout() rpc.LibraryLayout {
7373
switch *d {
7474
case FlatLayout:
75-
return rpc.LibraryLayout_flat_layout
75+
return rpc.LibraryLayout_LIBRARY_LAYOUT_FLAT
7676
case RecursiveLayout:
77-
return rpc.LibraryLayout_recursive_layout
77+
return rpc.LibraryLayout_LIBRARY_LAYOUT_RECURSIVE
7878
}
7979
panic(fmt.Sprintf("invalid LibraryLayout value %d", *d))
8080
}

arduino/libraries/libraries_location.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,27 @@ func (d *LibraryLocation) UnmarshalJSON(b []byte) error {
8989
func (d *LibraryLocation) ToRPCLibraryLocation() rpc.LibraryLocation {
9090
switch *d {
9191
case IDEBuiltIn:
92-
return rpc.LibraryLocation_ide_builtin
92+
return rpc.LibraryLocation_LIBRARY_LOCATION_IDE_BUILTIN
9393
case PlatformBuiltIn:
94-
return rpc.LibraryLocation_platform_builtin
94+
return rpc.LibraryLocation_LIBRARY_LOCATION_PLATFORM_BUILTIN
9595
case ReferencedPlatformBuiltIn:
96-
return rpc.LibraryLocation_referenced_platform_builtin
96+
return rpc.LibraryLocation_LIBRARY_LOCATION_REFERENCED_PLATFORM_BUILTIN
9797
case User:
98-
return rpc.LibraryLocation_user
98+
return rpc.LibraryLocation_LIBRARY_LOCATION_USER
9999
}
100100
panic(fmt.Sprintf("invalid LibraryLocation value %d", *d))
101101
}
102102

103103
// FromRPCLibraryLocation converts a rpc.LibraryLocation to a LibraryLocation
104104
func FromRPCLibraryLocation(l rpc.LibraryLocation) LibraryLocation {
105105
switch l {
106-
case rpc.LibraryLocation_ide_builtin:
106+
case rpc.LibraryLocation_LIBRARY_LOCATION_IDE_BUILTIN:
107107
return IDEBuiltIn
108-
case rpc.LibraryLocation_platform_builtin:
108+
case rpc.LibraryLocation_LIBRARY_LOCATION_PLATFORM_BUILTIN:
109109
return PlatformBuiltIn
110-
case rpc.LibraryLocation_referenced_platform_builtin:
110+
case rpc.LibraryLocation_LIBRARY_LOCATION_REFERENCED_PLATFORM_BUILTIN:
111111
return ReferencedPlatformBuiltIn
112-
case rpc.LibraryLocation_user:
112+
case rpc.LibraryLocation_LIBRARY_LOCATION_USER:
113113
return User
114114
}
115115
panic(fmt.Sprintf("invalid rpc.LibraryLocation value %d", l))

cli/lib/examples.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (ir libraryExamplesResult) String() string {
112112
name := lib.Library.Name
113113
if lib.Library.ContainerPlatform != "" {
114114
name += " (" + lib.Library.GetContainerPlatform() + ")"
115-
} else if lib.Library.Location != rpc.LibraryLocation_user {
115+
} else if lib.Library.Location != rpc.LibraryLocation_LIBRARY_LOCATION_USER {
116116
name += " (" + lib.Library.GetLocation().String() + ")"
117117
}
118118
r := fmt.Sprintf("Examples for library %s\n", color.GreenString("%s", name))

cli/lib/search.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ func (res result) String() string {
124124

125125
var out strings.Builder
126126

127-
if res.results.GetStatus() == rpc.LibrarySearchStatus_failed {
127+
if res.results.GetStatus() == rpc.LibrarySearchStatus_LIBRARY_SEARCH_STATUS_FAILED {
128128
out.WriteString("No libraries matching your search.\nDid you mean...\n")
129129
}
130130

131131
for _, lib := range results {
132-
if res.results.GetStatus() == rpc.LibrarySearchStatus_success {
132+
if res.results.GetStatus() == rpc.LibrarySearchStatus_LIBRARY_SEARCH_STATUS_SUCCESS {
133133
out.WriteString(fmt.Sprintf("Name: \"%s\"\n", lib.Name))
134134
if res.namesOnly {
135135
continue

commands/daemon/monitor.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (s *MonitorService) StreamingOpen(stream rpc.MonitorService_StreamingOpenSe
4646
// select which type of monitor we need
4747
var mon monitors.Monitor
4848
switch config.GetType() {
49-
case rpc.MonitorConfig_SERIAL:
49+
case rpc.MonitorConfig_TARGET_TYPE_SERIAL:
5050
// grab port speed from additional config data
5151
var baudRate float64
5252
addCfg := config.GetAdditionalConfig()
@@ -63,7 +63,7 @@ func (s *MonitorService) StreamingOpen(stream rpc.MonitorService_StreamingOpenSe
6363
return err
6464
}
6565

66-
case rpc.MonitorConfig_NULL:
66+
case rpc.MonitorConfig_TARGET_TYPE_NULL:
6767
if addCfg, ok := config.GetAdditionalConfig().AsMap()["OutputRate"]; !ok {
6868
mon = monitors.OpenNullMonitor(100.0) // 100 bytes per second as default
6969
} else if outputRate, ok := addCfg.(float64); !ok {

commands/lib/search.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func LibrarySearch(ctx context.Context, req *rpc.LibrarySearchRequest) (*rpc.Lib
4141
func searchLibrary(req *rpc.LibrarySearchRequest, lm *librariesmanager.LibrariesManager) (*rpc.LibrarySearchResponse, error) {
4242
query := req.GetQuery()
4343
res := []*rpc.SearchedLibrary{}
44-
status := rpc.LibrarySearchStatus_success
44+
status := rpc.LibrarySearchStatus_LIBRARY_SEARCH_STATUS_SUCCESS
4545

4646
searchArgs := strings.Split(strings.Trim(query, " "), " ")
4747

commands/lib/search_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestSearchLibrary(t *testing.T) {
2727
}
2828

2929
assert := assert.New(t)
30-
assert.Equal(resp.GetStatus(), rpc.LibrarySearchStatus_success)
30+
assert.Equal(resp.GetStatus(), rpc.LibrarySearchStatus_LIBRARY_SEARCH_STATUS_SUCCESS)
3131
assert.Equal(len(resp.GetLibraries()), 2)
3232
assert.True(strings.Contains(resp.GetLibraries()[0].Name, "Test"))
3333
assert.True(strings.Contains(resp.GetLibraries()[1].Name, "Test"))
@@ -48,7 +48,7 @@ func TestSearchLibrarySimilar(t *testing.T) {
4848
}
4949

5050
assert := assert.New(t)
51-
assert.Equal(resp.GetStatus(), rpc.LibrarySearchStatus_success)
51+
assert.Equal(resp.GetStatus(), rpc.LibrarySearchStatus_LIBRARY_SEARCH_STATUS_SUCCESS)
5252
assert.Equal(len(resp.GetLibraries()), 2)
5353
libs := map[string]*rpc.SearchedLibrary{}
5454
for _, l := range resp.GetLibraries() {

rpc/buf.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
version: v1beta1
22
lint:
33
ignore_only:
4-
ENUM_VALUE_PREFIX:
5-
- commands/lib.proto
6-
- monitor/monitor.proto
7-
ENUM_VALUE_UPPER_SNAKE_CASE:
8-
- commands/lib.proto
94
ENUM_ZERO_VALUE_SUFFIX:
105
- commands/lib.proto
116
- monitor/monitor.proto

rpc/commands/lib.pb.go

+52-44
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/commands/lib.proto

+8-8
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ message LibrarySearchRequest {
112112

113113
enum LibrarySearchStatus {
114114
// No search results were found.
115-
failed = 0;
115+
LIBRARY_SEARCH_STATUS_FAILED = 0;
116116
// Search results were found.
117-
success = 1;
117+
LIBRARY_SEARCH_STATUS_SUCCESS = 1;
118118
}
119119

120120
message LibrarySearchResponse {
@@ -279,22 +279,22 @@ message Library {
279279

280280
enum LibraryLayout {
281281
// Library is in the 1.0 Arduino library format.
282-
flat_layout = 0;
282+
LIBRARY_LAYOUT_FLAT = 0;
283283
// Library is in the 1.5 Arduino library format.
284-
recursive_layout = 1;
284+
LIBRARY_LAYOUT_RECURSIVE = 1;
285285
}
286286

287287
enum LibraryLocation {
288288
// In the `libraries` subdirectory of the Arduino IDE installation.
289-
ide_builtin = 0;
289+
LIBRARY_LOCATION_IDE_BUILTIN = 0;
290290
// In the `libraries` subdirectory of the user directory (sketchbook).
291-
user = 1;
291+
LIBRARY_LOCATION_USER = 1;
292292
// In the `libraries` subdirectory of a platform.
293-
platform_builtin = 2;
293+
LIBRARY_LOCATION_PLATFORM_BUILTIN = 2;
294294
// When `LibraryLocation` is used in a context where a board is specified,
295295
// this indicates the library is in the `libraries` subdirectory of a
296296
// platform referenced by the board's platform.
297-
referenced_platform_builtin = 3;
297+
LIBRARY_LOCATION_REFERENCED_PLATFORM_BUILTIN = 3;
298298
}
299299

300300
message ZipLibraryInstallRequest {

0 commit comments

Comments
 (0)