Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Contributor Covenant Code of Conduct

Please read our Organization's [Contributor Covenant Code of Conduct](https://github.com/PalisadoesFoundation/.github/blob/main/profile/CODE_OF_CONDUCT.md).
Please read our Organization's [Contributor Covenant Code of Conduct](https://developer.palisadoes.org/docs/contributor-guide/code-of-conduct).
140 changes: 41 additions & 99 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,112 +1,54 @@
# Contributing
# Contributing to Talawa-Admin

Thank you for your interest in contributing to the repository. Regardless of the size of the contribution you make, all contributions are welcome and are appreciated.
Thank you for your interest in contributing to Talawa Admin. Regardless of the size of the contribution you make, all contributions are welcome and are appreciated.

If you are new to contributing to open source, please read the Open Source Guides on [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/).

## Table of Contents

<!-- TOC -->
<!-- toc -->

- [Contributing](#contributing)
- [Contributing to Talawa-Admin](#contributing-to-talawa-admin)
- [Table of Contents](#table-of-contents)
- [General](#general)
- [Contributing Code](#contributing-code)

<!-- /TOC -->
- [Testing and Code Quality](#testing-and-code-quality)
- [Quick Reference](#quick-reference)
- [Making Contributions](#making-contributions)

<!-- tocstop -->

## General

Please read the [Palisadoes Contributing Guidelines](https://github.com/PalisadoesFoundation/.github/blob/main/profile/CONTRIBUTING.md).

## Contributing Code

Code contributions come in the form of pull requests. These are done by forking the repo and making changes locally.

Make sure you have read the [Documentation for Setting up the Project](https://github.com/PalisadoesFoundation/switchmap-ng#project-setup)

The process of proposing a change to the repository can be summarized as:

1. Fork the repository and branch off `develop`.
2. Your newly forked repository can be cloned locally using `git clone <YOUR FORKED REPO URL>`.
3. Make the Palisadoes Foundation's repo your `git upstream` for your local repo.
4. Make the desired changes to the repository.
5. Run the app and test your changes.
6. If you've added code, then test suites must be added.

1. **_General_:**

1. We need to get to 100% test coverage for the app. We periodically increase the desired test coverage for our pull requests to meet this goal.
2. Pull requests that don't meet the minimum test coverage levels will not be accepted. This may mean that you will have to create tests for code you did not write. You can decide which part of the code base needs additional tests if this happens to you.

2. **_Testing_:**

1. Test using this set of commands:

```
npm install
npm run test --watchAll=false --coverage
```

2. Debug tests in browser

You can see the output of failing tests in broswer by running `jest-preview` package before running your tests

```
npm install
npm run jest-preview
npm run test --watchAll=false --coverage
```

You don't need to re-run the `npm run jest-preview` command each time, simply run the `npm run test` command if the Jest Preview server is already running in the background, it'll automatically detect any failing tests and show the preview at `http://localhost:3336` as shown in this screenshot -

![Debugging Test Demo](./public/images/jest-preview.webp)

3. **_Test Code Coverage_:**

1. _General Information_
1. The current code coverage of the repo is: [![codecov](https://codecov.io/gh/PalisadoesFoundation/switchmap-ng/branch/develop/graph/badge.svg?token=II0R0RREES)](https://codecov.io/gh/PalisadoesFoundation/switchmap-ng)
2. You can determine the percentage test coverage of your code by running these two commands in sequence:
```
npm install
npm run test --watchAll=false --coverage
genhtml coverage/lcov.info -o coverage
```
3. The output of the `npm run test` command will give you a tablular coverage report per file
4. The overall coverage rate will be visible on the penultimate line of the `genhtml` command's output.
5. The `genhtml` command is part of the Linux `lcov` package. Similar packages can be found for Windows and MacOS.
6. The currently acceptable coverage rate can be found in the [GitHub Pull Request file](.github/workflows/pull-requests.yml). Search for the value below the line containing `min_coverage`.
2. _Testing Individual Files_
1. You can test an individual file by running this command:
```
npm run test --watchAll=false /path/to/test/file
```
2. You can get the test coverage report for that file by running this command. The report will list all tests in the suite. Those tests that are not run will have zero values. You will need to look for the output line relevant to your test file.
```
npm run test --watchAll=false --coverage /path/to/test/file
```
3. _Creating your code coverage account_

1. You can also see your code coverage online for your fork of the repo. This is provided by `codecov.io`

1. Go to this link: `https://app.codecov.io/gh/XXXX/YYYY` where XXXX is your GitHub account username and YYYY is the name of the repository
2. Login to `codecov.io` using your GitHub account, and add your **repo** and **branches** to the `codecov.io` dashboard.
![Debugging Test Demo](/public/images/codecov/authorise-codecov-github.jpg)
3. Remember to add the `Repository Upload Token` for your forked repo. This can be found under `Settings` of your `codecov.io` account.

4. Click on Setup Repo option
![Debugging Test Demo](</public/images/codecov/homescrenn%20(1).jpg>)
5. Use the value of this token to create a secret named CODE_COV for your forked repo.
[![Code-cov-token.jpg](/public/images/codecov/Code-cov-token.jpg)]()
[![addd-your-key.jpg](/public/images/codecov/addd-your-key.jpg)]()
6. You will see your code coverage reports with every push to your repo after following these steps
[![results.jpg](/public/images/codecov/results.jpg)]()

7. After making changes you can add them to git locally using `git add <file_name>`(to add changes only in a particular file) or `git add .` (to add all changes).
8. Before making a commit, run all hooks manually to catch and fix issues early using: `pre-commit run --all-files`. Some hooks (like formatters) may auto-fix code. If so, re-add the fixed files using: `git add .`.
9. After adding the changes you need to commit them using `git commit -m '<commit message>'`(look at the commit guidelines below for commit messages).
10. Once you have successfully commited your changes, you need to push the changes to the forked repo on github using: `git push origin <branch_name>`.(Here branch name must be name of the branch you want to push the changes to.)
11. Now create a pull request to the repository from your forked repo. Open an issue regarding the same and link your PR to it.
12. Ensure the test suite passes, either locally or on CI once a PR has been created.
13. Review and address comments on your pull request if requested.
Please read the [Palisadoes Contributing Guidelines](https://developer.palisadoes.org/docs/contributor-guide/contributing).

## Testing and Code Quality

For detailed information about testing, linting, formatting, and code coverage, please refer to our comprehensive [Testing Guide](docs/docs/docs/developer-resources/testing.md).

### Quick Reference

**Testing:**
- Run all tests: `pnpm run test`
- Run specific test: `pnpm run test /path/to/test/file`
- Run with coverage: `pnpm run test:coverage`
- Run with sharding: `pnpm run test:shard`

**Linting and Formatting:**
- Fix linting issues: `pnpm run lint:fix`
- Fix formatting issues: `pnpm run format:fix`
- Check linting: `pnpm run lint:check`
- Check formatting: `pnpm run format:check`

**Cypress E2E Testing:**
- See the [Cypress Guide](cypress/README.md) for end-to-end testing

For complete documentation including test sharding, code coverage setup, debugging, and git hooks, visit the [Testing Guide](docs/docs/docs/developer-resources/testing.md).

## Making Contributions

1. After making changes you can add them to git locally using `git add <file_name>`(to add changes only in a particular file) or `git add .` (to add all changes).
1. After adding the changes you need to commit them using `git commit -m '<commit message>'`(look at the commit guidelines below for commit messages).
1. Once you have successfully commited your changes, you need to push the changes to the forked repo on github using: `git push origin <branch_name>`.(Here branch name must be name of the branch you want to push the changes to.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use proper capitalization for "GitHub".

The official name uses a capital "H".

Apply this diff:

-1. Once you have successfully commited your changes, you need to push the changes to the forked repo on github using: `git push origin <branch_name>`.(Here branch name must be name of the branch you want to push the changes to.)
+1. Once you have successfully commited your changes, you need to push the changes to the forked repo on GitHub using: `git push origin <branch_name>`.(Here branch name must be name of the branch you want to push the changes to.)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
1. Once you have successfully commited your changes, you need to push the changes to the forked repo on github using: `git push origin <branch_name>`.(Here branch name must be name of the branch you want to push the changes to.)
1. Once you have successfully commited your changes, you need to push the changes to the forked repo on GitHub using: `git push origin <branch_name>`.(Here branch name must be name of the branch you want to push the changes to.)
🧰 Tools
🪛 LanguageTool

[uncategorized] ~51-~51: The official name of this software platform is spelled with a capital “H”.
Context: ... push the changes to the forked repo on github using: git push origin <branch_name>....

(GITHUB)

🤖 Prompt for AI Agents
In CONTRIBUTING.md around line 51, the word "github" is not using the official
capitalization; update the text to use "GitHub" (capital G and H) in the
sentence describing how to push to the forked repo so it reads "...push the
changes to the forked repo on GitHub using: `git push origin <branch_name>`."

1. Now create a pull request to the Talawa-admin repository from your forked repo. Open an issue regarding the same and link your PR to it.
1. Ensure the test suite passes, either locally or on CI once a PR has been created.
1. Review and address comments on your pull request if requested.
2 changes: 1 addition & 1 deletion ISSUE_GUIDELINES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Issue Reporting Guidelines

Please read our Organization's [Issue Reporting Guidelines](https://github.com/PalisadoesFoundation/.github/blob/main/profile/ISSUE_GUIDELINES.md).
Please read our Organization's [Issue Reporting Guidelines](https://developer.palisadoes.org/docs/contributor-guide/issues).

2 changes: 1 addition & 1 deletion PR_GUIDELINES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Pull Request Guidelines

Please read our [General PR Guidelines](https://github.com/PalisadoesFoundation/.github/blob/main/profile/PR_GUIDELINES.md) first.
Please read our [General PR Guidelines](https://developer.palisadoes.org/docs/contributor-guide/contributing) first.
Loading
Loading