Skip to content
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

Adding guidelines for writing platform agnostic code #18188

Merged
merged 6 commits into from
Feb 14, 2023
Merged
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ During the collector release process, all `./.chloggen/*.yaml` files are transcr

Alternately, copy `./.chloggen/TEMPLATE.yaml`, or just create your file from scratch.

## Platform Agnostic Code

In order to ensure compatibility with different operating systems, it is advised to write a code that is platform-agnostic. Below are some guidelines to follow when writing platform-agnostic code:
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved

* Avoid using platform-specific libraries, features etc. Please opt for cross-platform solutions.
Aneurysm9 marked this conversation as resolved.
Show resolved Hide resolved

* Avoid hard-coding platform specific values. Use environment variables or configuration files for storing platform specific values.
Aneurysm9 marked this conversation as resolved.
Show resolved Hide resolved
Aneurysm9 marked this conversation as resolved.
Show resolved Hide resolved

* Be mindful of
- Standard file systems and file paths such as forward slashes (/) instead of backward slashes (\) in Windows.
Aneurysm9 marked this conversation as resolved.
Show resolved Hide resolved
- Consistent line ending formats such as Unix (LF) or Windows (CRLF).

* Test your implementation thoroughly on different platforms and fix any issues.
swapnilashtekar marked this conversation as resolved.
Show resolved Hide resolved

With above guidelines, you can write code that is more portable and easier to maintain across different platforms.

## Adding New Components

**Before** any code is written, [open an
Expand Down