Thank you for considering contributing to this project! We appreciate your help in improving and expanding the project.
To ensure a smooth contribution process, please read the following guidelines before contributing.
If you find a bug or want to request a feature, feel free to open an issue on GitHub. Before creating a new issue, please check to ensure it hasn’t been reported already.
If you are looking to contribute code, please follow these steps:
git checkout -b your-branch-name
main
branch of this repository.We are committed to fostering a welcoming, respectful, and collaborative environment for everyone. Please follow our Code of Conduct.
If you notice a bug or issue with the project, feel free to submit a bug report or even fix the bug yourself. Always check the open issues to see if someone else is already working on it.
We’re always open to new ideas! If you have a feature in mind, please open an issue to discuss it before creating a pull request. This ensures that your effort aligns with the project’s direction and isn’t duplicated.
Contributions to documentation are highly valued. Whether it’s improving existing documentation, adding missing pieces, or creating new tutorials, your contributions will help others understand and use the project better.
Here’s the updated section for your CONTRIBUTING.md file, reflecting the technologies used in your project:
Ensure you have the following installed before starting:
git clone https://github.com/issamshadid/backend.git
cd backend
dotnet restore
appsettings.json
file points to your SQL Server instance. Run migrations to set up the database schema:
dotnet ef database update
dotnet run
This will guide your contributors through the necessary setup steps, including ensuring they have the correct versions of .NET, Entity Framework, and SQL Server. Let me know if you need further adjustments!
Please write meaningful commit messages that describe the reason for the change. Use the following format for your commits:
fix
, feat
, docs
, style
, refactor
, test
, chore
.Example:
feat(auth): add login functionality with OAuth support
To maintain high code quality and ensure that contributions to your .NET project align with the project’s goals, it’s important to have clear Pull Request (PR) Guidelines. Here’s a customized Pull Request Guidelines section for your .NET Core 8
project using Entity Framework and SQL Server:
When submitting a pull request to the project, please follow these guidelines to ensure a smooth review and integration process.
Ensure that your work is done in a separate branch. This keeps the main
or master
branch clean and makes it easier to review changes.
git checkout -b feature/your-feature-name
git checkout -b fix/issue-description
Follow the code style and conventions used in the project. Here are some common guidelines:
If your project uses static code analysis tools like StyleCop, Roslyn Analyzers, or SonarQube, make sure to run the analysis before submitting the PR to ensure that there are no style violations or critical issues.
Example:
dotnet build
If your changes include database modifications (via Entity Framework Migrations):
dotnet ef migrations add MigrationName
dotnet ef database update
Ensure that your commit messages are clear and descriptive. Use the following format for your commit messages:
feat
, fix
, docs
, style
, refactor
, test
, chore
.auth
, db
, api
).Example:
feat(api): add user authentication with JWT
fix(db): resolve issue with foreign key constraints in User table
If there are any merge conflicts with the main
or master
branch, resolve them locally before submitting the pull request.
main
:
git checkout main
git pull origin main
git checkout your-branch-name
git rebase main
In the pull request description, make sure to include:
Closes #<issue-number>
if the PR resolves an open issue.Each pull request should focus on a single issue or feature. Avoid submitting “mega-PRs” with multiple unrelated changes, as these are difficult to review.
After submitting the PR:
If requested, update your pull request based on feedback and push changes toyour branch. You can update your pull request by simply pushing new commits to the same branch.
git push origin your-branch-name
main
branch.By following these Pull Request Guidelines, you help ensure that the project maintains high-quality code and that contributions are easy to review and integrate. Thank you for your contribution!
Here’s a detailed Style Guidelines section for your .NET Core
project, including Code Style conventions. These guidelines will help contributors maintain consistent code formatting and structure throughout the project.
To ensure a clean and readable codebase, please follow the code style guidelines below when contributing to the project.
{
on the same line as the declaration.}
on a new line.Example:
public class Example
{
public void DoSomething()
{
if (condition)
{
// Do work here
}
else
{
// Handle alternative
}
}
}
int userId = 10;
public string UserName { get; set; }
Method names should be descriptive and use action verbs (e.g., GetData
, SaveUser
, ProcessOrder
).
Example:
public void SaveUserData(User user)
{
// Implementation here
}
Interface names should be prefixed with an I
and follow PascalCase.
Example:
public class UserRepository { }
public interface IUserService { }
Use XML comments (///
) for public methods and classes to provide context and documentation.
Example:
/// <summary>
/// Retrieves user data from the database.
/// </summary>
/// <param name="userId">The ID of the user.</param>
/// <returns>User data.</returns>
public User GetUserById(int userId)
{
// Explanation of complex logic if necessary
return _userRepository.Get(userId);
}
int result = a + b;
Use PascalCase for constant names and declare them as readonly
or const
where appropriate.
Example:
public const int MaxItems = 100;
For LINQ queries, prefer method syntax over query syntax unless query syntax improves readability.
Example (preferred method syntax):
var users = usersList.Where(u => u.IsActive).OrderBy(u => u.Name).ToList();
Use constructor injection for dependencies whenever possible.
Example:
public class UserService
{
private readonly IUserRepository _userRepository;
public UserService(IUserRepository userRepository)
{
_userRepository = userRepository;
}
}
Methods returning asynchronous tasks should be named with the Async
suffix.
Example:
public async Task<User> GetUserAsync(int userId)
{
return await _userRepository.GetUserByIdAsync(userId);
}
Use auto-properties where possible:
Example:
public string Name { get; set; }
Use ??
(null coalescing operator) for simple null checks.
Example:
string name = user?.Name ?? "Default Name";
For more complex null checks or when you expect a thrown exception, use:
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
If applicable, run automated style checks before submitting your pull request:
dotnet format
By adhering to these style guidelines, we can maintain a consistent and clean codebase, making it easier for everyone to contribute, read, and maintain the code.
All pull requests will be reviewed by a project maintainer before merging. Be prepared to make adjustments based on feedback, and try to respond to review comments in a timely manner.
When submitting an issue, please include as much detail as possible:
If you discover a security vulnerability, please do not open a public issue. Instead, report it privately by contacting the project maintainers at [shadeed.1990@gmail.com].