-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Welcome
This issue was automatically created by the ECR Service Layer. Below are some learning resources to help you get started. If you have questions or want to give feedback feel free to create a discussion or open a issue.
Learning Resources
- Using Git and Github HIGHLY RECOMMENDED
- Github Actions
- Devcontainers
- Mastering Markdown
- Github Learning Resources
- FAQ's
Best Practices
General best practices when working with code and repositories.
Repositories
Common best practices for any repository regardless of language or purpose.
Best Practices
1. Don't push straight to main/master
Your repositories should always have branch protection on important branches. Changes should go through a pull request and a peer review process to help protect your code.
2. Use devcontainers
Devcontainers is a tool that allows you to run your code in a container. It is a great way to run your code in a container and avoid the need to install dependencies. It helps ensure that your code is always running the same way. It also helps reduce the onboarding time for new developers. You can learn more about devcontainers here
3. Create a contributor guide
The contributor guide is generally a markdown file named CONTRIBUTING.md located in the root of your project. This guide should be a step-by-step guide to help new contributors get started.
4. Define code owners
Even in small teams defining code owners can help productivity. A code owner is a person or team that should be responsible for reviewing changes to certain files or file types.
5. Don't leak secrets in source code
This one is obvious, but accidents happen. Secrets should be stored outside of source control in something like Vault or AWS Secrets manager. In github if you want to use secrets in your pipeline you can leverage repository or environment secrets.
6. Don't commit dependencies or binaries into source control
If you have a dependencies they should be stored in a package manager. Committing binaries into source control increases code size.
7. Use a .gitignore file to prevent unwanted files
A .gitignore file helps prevent the commit of unwanted files. For example you can add the node_modules to your .gitignore to prevent the commit of locally installed npm packages.
8. Use workflows to build and test
You can setup workflows to run tests, build, and deploy your code. A common use case is running unit tests and style linting when pull requests are made.
Coding Languages
Common best practices for a specific language.
Python
1. Code should have tests
It is important to have tests for your code. This helps ensure that your code is working as expected. It helps prevent introducing bugs, and it helps prevent regressions. There are many testing frameworks available for python. pytest is a popular testing framework.
2. Use a code linter
Code should be linted to ensure that it follows the style guidelines. There are many code linters available for python. flake8 is a popular code linter.
3. Code should be documented
Functions and classes should have docstrings. This helps to document the code and make it easier to understand. There are also many tools that can generate webpages from docstrings.
Deloitte Resources
Help
You can email us on our DL: US TI Enterprise Code Repository (ustienterprisecoderepository@deloitte.com)