Skip to content

Buf files #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions bad.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

package exampletest;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Package-directory mismatch breaks buf lint & buf build.

buf expects every file declaring package exampletest; to live under exampletest/.
Because bad.proto sits at repository root (.), CI will fail with PACKAGE_DIRECTORY_MATCH.
Move the file or change the package declaration so they match.

-// current location: bad.proto
+// preferred: exampletest/bad.proto  (move the file)

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Buf (1.55.1)

3-3: Files with package "exampletest" must be within a directory "exampletest" relative to root but were in directory ".".

(PACKAGE_DIRECTORY_MATCH)

🤖 Prompt for AI Agents
In bad.proto at line 3, the package declaration 'package exampletest;' does not
match the file location, causing buf lint and build errors. To fix this, either
move bad.proto into an 'exampletest/' directory to align with the package name
or change the package declaration to match the current directory (e.g., 'package
exampletest;' to 'package root;' if staying at root). Ensure the package
declaration and file path correspond to satisfy buf's PACKAGE_DIRECTORY_MATCH
rule.


message user_info {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

PascalCase message names are required – rename user_infoUserInfo.

Lower-snake message identifiers violate Google & Buf style guides and will be flagged (MESSAGE_NAMES_UPPER_CAMEL_CASE).
Refactor now to avoid cascading code-gen churn later.

-message user_info {
+message UserInfo {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
message user_info {
message UserInfo {
🤖 Prompt for AI Agents
In bad.proto at line 5, the message name `user_info` uses lower-snake case which
violates style guides requiring PascalCase. Rename the message from `user_info`
to `UserInfo` to comply with the MESSAGE_NAMES_UPPER_CAMEL_CASE rule and prevent
future code generation issues.

string full_name = 1;
int32 age_years = 2;
}

enum status {
UNKNOWN = 0;
ACTIVE = 1;
INACTIVE = 2;
}
Comment on lines +10 to +14
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enum & value naming do not comply with proto3 conventions.

  1. Enum identifiers must be PascalCase → Status.
  2. Enum values must be UPPER_SNAKE and prefixed with the enum name → STATUS_UNKNOWN, STATUS_ACTIVE, STATUS_INACTIVE.
    Fixing this keeps generated code idiomatic and passes ENUM_ZERO_VALUE_SUFFIX / ENUM_VALUE_PREFIX.
-enum status {
-  UNKNOWN  = 0;
-  ACTIVE   = 1;
-  INACTIVE = 2;
+enum Status {
+  STATUS_UNKNOWN  = 0;
+  STATUS_ACTIVE   = 1;
+  STATUS_INACTIVE = 2;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
enum status {
UNKNOWN = 0;
ACTIVE = 1;
INACTIVE = 2;
}
enum Status {
STATUS_UNKNOWN = 0;
STATUS_ACTIVE = 1;
STATUS_INACTIVE = 2;
}
🤖 Prompt for AI Agents
In bad.proto around lines 10 to 14, rename the enum identifier from lowercase
'status' to PascalCase 'Status' and update all enum values to be uppercase with
the enum name as a prefix, changing 'UNKNOWN' to 'STATUS_UNKNOWN', 'ACTIVE' to
'STATUS_ACTIVE', and 'INACTIVE' to 'STATUS_INACTIVE' to comply with proto3
naming conventions and pass linting rules.