Restructure copilot instructions into targeted instruction files#4176
Open
Restructure copilot instructions into targeted instruction files#4176
Conversation
- Slim copilot-instructions.md to project overview + 17 code review rules - Add .github/instructions/cpp-headers.instructions.md (applyTo: **/*.hpp) - Add .github/instructions/cpp-sources.instructions.md (applyTo: **/*.cpp) - Add .github/instructions/bazel-build.instructions.md (applyTo: **/BUILD) - Add .github/instructions/build-workflow.instructions.md (description-based) copilot-instructions.md remains the source of truth for GitHub PR review bot. The .instructions.md files are VS Code-only, activated contextually.
Contributor
There was a problem hiding this comment.
Pull request overview
This documentation/configuration PR reorganizes the repository’s Copilot guidance for OVMS by moving language- and workflow-specific instructions into .github/instructions while slimming the shared .github/copilot-instructions.md file.
Changes:
- Reduced
.github/copilot-instructions.mdto the project overview plus 17 review rules. - Added contextual instruction files for C++ headers, C++ sources, Bazel BUILD files, and build/test workflow guidance.
- Split previously centralized guidance into VS Code-targeted instruction documents.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
.github/copilot-instructions.md |
Slims the main Copilot guidance down to overview + review rules. |
.github/instructions/cpp-sources.instructions.md |
Adds source-file-specific C++ guidance. |
.github/instructions/cpp-headers.instructions.md |
Adds header-file-specific C++ guidance. |
.github/instructions/build-workflow.instructions.md |
Adds Docker/Bazel/Make/test workflow instructions. |
.github/instructions/bazel-build.instructions.md |
Adds Bazel BUILD-file guidance and conventions. |
Comment on lines
27
to
+31
| ## Code Review Instructions for PRs | ||
|
|
||
| When analyzing a Pull Request, follow this protocol: | ||
|
|
||
| ### C++ Guidelines & Performance |
Comment on lines
+111
to
+126
| Run style checks **sequentially** — fix each step before moving to the next: | ||
|
|
||
| 1. **clang-format** (formatting): | ||
| ```bash | ||
| make style | ||
| ``` | ||
| 2. **cpplint** (lint rules): | ||
| ```bash | ||
| make cpplint | ||
| ``` | ||
| 3. **Spelling**: | ||
| ```bash | ||
| make spell | ||
| ``` | ||
|
|
||
| Each step runs via Make. Fix issues from step N before running step N+1 — later steps produce noise if formatting is off. |
Comment on lines
+14
to
+15
| - Use `ovms_test_cc_library` for test utility libraries (adds gtest dep automatically). | ||
| - Use `ovms_cc_test` for test binaries. |
| ## Build Target Ownership | ||
|
|
||
| - **Every new `.cpp` must belong to its own `ovms_cc_library` target** in a BUILD file. Do not add sources to monolithic targets like `ovms_lib`. | ||
| - If a `.cpp` is only used by tests, use `ovms_test_cc_library` instead. |
Comment on lines
+8
to
+12
| - **Ban umbrella includes**: never use `openvino/openvino.hpp`, `rapidjson/document.h`, or similar in headers. Include only the specific subheader you need. | ||
| - **Forward-declare in headers**: if a header only uses pointers or references to a type, write `class Foo;` instead of `#include "foo.hpp"`. Move the full include to the `.cpp`. | ||
| - **Self-contained but minimal**: every header must compile on its own (`#pragma once`, own includes), but must not pull in transitive dependencies callers don't need. | ||
| - **No header solely for a typedef or enum**: forward-declare the enum (`enum class Foo;`) or use a lightweight `_fwd.hpp` header. | ||
| - **Third-party headers**: wrap in a port layer (`src/port/<dep>_<component>.hpp`) with warning suppression pragmas. Never include third-party headers directly from multiple OVMS headers. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
copilot-instructions.md remains the source of truth for GitHub PR review bot. The .instructions.md files are VS Code-only, activated contextually.
🛠 Summary
JIRA/Issue if applicable.
Describe the changes.
🧪 Checklist
``