-
Notifications
You must be signed in to change notification settings - Fork 52
initial custom coding guidelines #460
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
sajilal711
wants to merge
2
commits into
develop
Choose a base branch
from
topic/copilot-ccg
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Dobby Copilot Instructions | ||
|
|
||
| Use the custom instructions in `.github/instructions/*.instructions.md` as the primary coding guidance for this repository. | ||
|
|
||
| ## Review Comment Linking | ||
|
|
||
| When leaving review comments based on a rule from `.github/instructions/General.instructions.md`, include a direct link to the section in the same format: | ||
|
|
||
| Refer: https://github.com/rdkcentral/Dobby/blob/develop/.github/instructions/General.instructions.md#critical-logging | ||
|
|
||
| ## Scope | ||
|
|
||
| These rules are intended to keep generated code and review comments aligned with Dobby's existing codebase conventions, plugin lifecycle model, build setup, and openspec documents. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| --- | ||
| applyTo: "**/*.{cpp,h,cc,cxx,hpp},**/CMakeLists.txt,**/*.cmake,**/*.sh" | ||
| --- | ||
|
|
||
| # Instruction Summary | ||
| 1. Critical Logging | ||
| 2. Recoverable Error Reporting | ||
| 3. Null Safety and Pointer Style | ||
| 4. Plugin Lifecycle Discipline | ||
| 5. RDK Plugin Hook Contract | ||
| 6. CMake and Plugin Onboarding Compliance | ||
| 7. Spec and Schema Synchronization | ||
|
|
||
| ### Critical Logging | ||
|
|
||
| ### Requirement | ||
|
|
||
| Use Dobby logging macros from `AppInfrastructure/Logging/include/Logging.h` for failures: | ||
|
|
||
| ```cpp | ||
| AI_LOG_ERROR("failed to parse config for plugin '%s'", pluginName.c_str()); | ||
| ``` | ||
|
|
||
| If the function returns failure, log once with enough context and return the appropriate failure value. | ||
|
|
||
| ### Incorrect Example | ||
|
|
||
| ```cpp | ||
| printf("failed to parse config\n"); | ||
| return false; | ||
| ``` | ||
|
|
||
| ### Recoverable Error Reporting | ||
|
|
||
| ### Requirement | ||
|
|
||
| Use `AI_LOG_WARN` for recoverable or fallback behavior. | ||
|
|
||
| ```cpp | ||
| if (missingOptionalField) | ||
| { | ||
| AI_LOG_WARN("optional field missing, using default"); | ||
| } | ||
| ``` | ||
|
|
||
| Do not log expected fallback behavior as hard errors. | ||
|
|
||
| ### Null Safety and Pointer Style | ||
|
|
||
| ### Requirement | ||
|
|
||
| - Use `nullptr` instead of `NULL` in all new code. | ||
| - Preserve nearby comparison style (`nullptr == ptr` or `ptr == nullptr`) to avoid style churn inside existing files. | ||
| - Validate pointers before dereference and fail with contextual log messages. | ||
|
|
||
| ### Plugin Lifecycle Discipline | ||
|
|
||
| ### Requirement | ||
|
|
||
| For Dobby RDK plugins and daemon lifecycle-managed components: | ||
|
|
||
| - Keep constructors lightweight. | ||
| - Do heavy setup in lifecycle hook methods. | ||
| - Release resources in reverse order of allocation. | ||
| - Reset internal state after cleanup. | ||
|
|
||
| Where hook/teardown fails, log with enough context to diagnose container and plugin state. | ||
|
|
||
| ### RDK Plugin Hook Contract | ||
|
|
||
| ### Requirement | ||
|
|
||
| - Implement `IDobbyRdkPlugin` contract correctly. | ||
| - Keep `name()` stable. | ||
| - Set `hookHints()` to match only implemented hooks. | ||
| - Prefer inheriting from `RdkPluginBase` and override only needed hooks. | ||
| - Declare inter-plugin ordering requirements through `getDependencies()` when required. | ||
|
|
||
| ### CMake and Plugin Onboarding Compliance | ||
|
|
||
| ### Requirement | ||
|
|
||
| When introducing a new plugin in top-level `CMakeLists.txt`: | ||
|
|
||
| 1. Add matching `PLUGIN_<NAME>` option and `add_subdirectory(...)`. | ||
| 2. Update `.github/workflows/L1-tests.yml` plugin build flags. | ||
| 3. Update `.github/workflows/L2-tests.yml` where integration coverage is needed. | ||
| 4. Update `cov_build.sh` to include the plugin build flag. | ||
|
|
||
| This keeps CI and static analysis coverage aligned with source registration. | ||
|
|
||
| ### Spec and Schema Synchronization | ||
|
|
||
| ### Requirement | ||
|
|
||
| - Keep openspec docs in `openspec/specs/` in sync with behavior changes. | ||
| - For runtime schema changes under `bundle/runtime-schemas/`, re-run CMake so generated headers are refreshed. | ||
| - Do not merge behavior changes that leave specs stale. |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.