Thank you for your interest in contributing to this project! We value and appreciate any contributions you can make. To maintain a collaborative and respectful environment, please consider the following guidelines when contributing to this project.
- Before starting to contribute to the code, you must first sign the Contributor License Agreement (CLA).
- Open an issue to discuss and gather feedback on the feature or fix you wish to address.
- Fork the repository and clone it to your local machine.
- Create a new branch to work on your contribution:
git checkout -b your-branch-name
. - Make the necessary changes in your local branch.
- Ensure that your code follows the established project style and formatting guidelines.
- Perform testing to ensure your changes do not introduce errors.
- Make clear and descriptive commits that explain your changes.
- Push your branch to the remote repository:
git push origin your-branch-name
. - Open a pull request describing your changes and linking the corresponding issue.
- Await comments and discussions on your pull request. Make any necessary modifications based on the received feedback.
- Once your pull request is approved, your contribution will be merged into the main branch.
- All contributors are expected to follow the project's code of conduct. Please be respectful and considerate towards other contributors.
- Before starting work on a new feature or fix, check existing issues and pull requests to avoid duplications and unnecessary discussions.
- If you wish to work on an existing issue, comment on the issue to inform other contributors that you are working on it. This will help coordinate efforts and prevent conflicts.
- It is always advisable to discuss and gather feedback from the community before making significant changes to the project's structure or architecture.
- Ensure a clean and organized commit history. Divide your changes into logical and descriptive commits.
- Document any new changes or features you add. This will help other contributors and project users understand your work and its purpose.
- Be sure to link the corresponding issue in your pull request to maintain proper tracking of contributions.
Make sure that you have:
- Read the rest of the
CONTRIBUTING.md
sections. - Meet the prerequisites.
- Golang (version
1.20.4
or higher). - GNU Make (version
4.2.1
or higher). - Git (version
2.25.1
or higher).
Activate the development mode setting GH_SHERPA_DEV
environment variable:
export GH_SHERPA_DEV=1
Install the extension using the local path:
git clone https://github.com/InditexTech/gh-sherpa.git
cd gh-sherpa
gh extension remove sherpa && gh extension install .
NOTE: You can also use
make install
to install the extension as a binary in your$GOPATH/bin
or just run the generated binary after amake build
execution with./bin/gh-sherpa
.
You can run the tests with the following command:
make test
We use stretchr/testify suite package for testing when needed. You can also write regular tests without using the suite package.
We use vektra/mockery for mocking interfaces. You can generate the mocks with the following command:
make generate-mocks
This command will generate the mocks in the internal/mocks
directory, as configured in the .mockery.yaml
file.
NOTE: Please, refrain from using the generated
NewMockXXXX
constructors. Instead, instantiate the mocks using&MockXXXX{}
. This is needed because the generated constructors will always executemock.AssertExpectation(t)
on cleanup, which will fail if the test does not expect a call to the mock.
You can also run the tests with coverage with the following command:
make coverage
It will generate a coverage.out
file in the .local
directory. You can see the coverage report running the following
command:
go tool cover -html=.local/coverage.out
It will generate an HTML file with the coverage report that you can open in your browser.
NOTE: For Windows WSL users, you may need to convert the
coverage.out
file to a Windows-compatible path. You can do it with the following command:wslpath -w PATH/TO/GENERATED/HTML/FILE
You can verify the code integrity with the following command:
make verify
This command will do the following:
- Download the required dependencies (
make tidy
) - Check the code format using
gofmt
(make checkfmt
).- If the code format is not correct, you can fix it with
make fmt
.
- If the code format is not correct, you can fix it with
- Run the
staticcheck
linter (make lint
) - Run go vet (
make vet
) - Build the application (
make build
) - Run the tests (
make test
)
It's recommended to run this command before pushing your changes to the repository.
NOTE: Since we are using
go run
to execute the required dependencies while verifying, you don't have to install them in your development environment.
- Project documentation: Refer to our documentation for more information on the project structure and how to contribute.
- Use cases: Check out the available use cases and examples to learn how to use this extension.
- Architecture: Learn more about the project's architecture and how it works.
- Issues: Check open issues and look for opportunities to contribute. Make sure to open an issue before starting work on a new feature or fix.
Thank you for your time and contribution! Your work helps to grow and improve this project. If you have any questions, feel free to reach out to us.