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

docs(contribution-guidelines): add best practices section for coding guidelines #112

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AshwinSri23
Copy link

@AshwinSri23 AshwinSri23 commented Sep 17, 2024

🚩 Linked issue

The issue is 104. The issue can be found here..

🛠 How does this PR address the issue(s)? How does it solve the problem?

The following PR is for adding a best practices section to the coding guidelines page. Best practices would describe to new contributors conventions for different areas within cuHacking's development infrastructure.
These areas are:

  • Testing
  • Frontend
  • Backend
  • API Design
  • Docs
  • Features

✅ Checklist

Make sure your PR follows the according checklist:

Code Quality

Done Checklist Item
Code is clean and readable (functions used appropriately)
Code is commented appropriately (no unnecessary comments, follows guidelines)
Code is DRY (no repeated code)
Functions are named appropriately (camelCase)
Variables are named appropriately (camelCase)
Files are named appropriately (kebab-case)
Code performs as expected (no errors or issues when running)
Code is committed and branched accordingly

PR Review Readiness

Done Checklist Item
PR is linked to an issue (if applicable)
PR is clear and comprehensible
PR is ready for review (if not, consider using a draft PR)
PR title follows template guidelines
PR description follows template guidelines

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive section on best practices for end-to-end (E2E) testing in the coding guidelines.
    • Detailed organization of E2E tests for different devices (desktop, mobile, tablet).
    • Provided instructions for running tests and managing configurations.
  • Documentation

    • Added examples and guidelines for structuring and naming E2E tests.
    • Included information on viewing test reports through GitHub workflows.

Copy link

netlify bot commented Sep 17, 2024

Deploy Preview for cuhacking-portal-dev failed. Why did it fail? →

Name Link
🔨 Latest commit 07da48d
🔍 Latest deploy log https://app.netlify.com/sites/cuhacking-portal-dev/deploys/66e8ca2b8875c400081f9253

Copy link

coderabbitai bot commented Sep 17, 2024

Walkthrough

Walkthrough

The changes introduce a new section in the coding guidelines focused on best practices for end-to-end (E2E) testing. This section categorizes E2E tests by device type and emphasizes the organization and structure of tests. It includes instructions for using a playwright.config file, guidelines for creating tests, and recommendations for running them efficiently. The document also highlights the ability to view test reports through GitHub workflows, ensuring clarity and consistency in testing practices.

Changes

File Path Change Summary
apps/docs/src/content/docs/contribution-guidelines/coding-guidelines.mdx Added a comprehensive section on best practices for E2E testing.

Possibly related issues

Possibly related PRs

Suggested labels

documentation

Poem

🐰 In the code where bunnies hop,
Best practices help us never stop.
With tests that run on every screen,
Our coding dreams are bright and green.
So let’s structure, name, and play,
Together we’ll code the bunny way! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (3)
apps/docs/src/content/docs/contribution-guidelines/coding-guidelines.mdx (3)

99-99: Remove redundant phrase.

As suggested by the static analysis tool, use "inside" instead of "inside of" to avoid redundancy and improve clarity.

Apply this diff to fix the issue:

-All E2E tests located inside of a directory(Organized based on what overall page/tool the tests are using)
+All E2E tests are located inside a directory (organized based on the overall page/tool the tests are using).
Tools
LanguageTool

[style] ~99-~99: This phrase is redundant. Consider using “inside”.
Context: ...test organization All E2E tests located inside of a directory(Organized based on what ove...

(OUTSIDE_OF)


100-100: Remove redundant phrase.

As suggested by the static analysis tool, use "inside" instead of "inside of" to avoid redundancy and improve clarity.

Apply this diff to fix the issue:

-- For example, all E2E tests relating to the cuhacking portal are stored inside of the portal--e2e directory. 
+- For example, all E2E tests related to the cuhacking portal are stored inside the `portal-e2e` directory.
Tools
LanguageTool

[style] ~100-~100: This phrase is redundant. Consider using “inside”.
Context: ...ting to the cuhacking portal are stored inside of the portal--e2e directory. - All rela...

(OUTSIDE_OF)


140-140: Rephrase the sentence for clarity.

As suggested by the static analysis tool, consider rephrasing the sentence to strengthen the wording and improve clarity.

Apply this diff to rephrase the sentence:

-- Report is produced regardless of whether you push code that makes changes to these E2E tests. 
+- The report is generated even if the pushed code does not modify the E2E tests.
Tools
LanguageTool

[style] ~140-~140: Consider shortening or rephrasing this to strengthen your wording.
Context: ...egardless of whether you push code that makes changes to these E2E tests. When running differe...

(MAKE_CHANGES)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 54c12dd and 07da48d.

Files selected for processing (1)
  • apps/docs/src/content/docs/contribution-guidelines/coding-guidelines.mdx (1 hunks)
Additional context used
LanguageTool
apps/docs/src/content/docs/contribution-guidelines/coding-guidelines.mdx

[grammar] ~89-~89: Did you mean the adjective “End-to-end” (spelled with hyphens)?
Context: ...Testing* #### E2E Test catagorization End to end Testing broken down into 2 different pa...

(END_TO_END_HYPHEN)


[style] ~99-~99: This phrase is redundant. Consider using “inside”.
Context: ...test organization All E2E tests located inside of a directory(Organized based on what ove...

(OUTSIDE_OF)


[style] ~100-~100: This phrase is redundant. Consider using “inside”.
Context: ...ting to the cuhacking portal are stored inside of the portal--e2e directory. - All rela...

(OUTSIDE_OF)


[style] ~140-~140: Consider shortening or rephrasing this to strengthen your wording.
Context: ...egardless of whether you push code that makes changes to these E2E tests. When running differe...

(MAKE_CHANGES)

Additional comments not posted (6)
apps/docs/src/content/docs/contribution-guidelines/coding-guidelines.mdx (6)

88-88: Great addition!

The "Best Practices" section is a valuable addition to the coding guidelines documentation. It will provide clear guidance to contributors and help maintain consistency across the codebase.


105-105: Informative note about the playwright.config file.

The information about using a playwright.config file for managing tests across different environments is helpful for contributors. It provides clarity on how to handle tests for various environments.


109-109: Appropriate subsection title.

The "Creating E2E tests" subsection title is clear and relevant to the content that follows. It provides a logical structure to the best practices section.


123-123: Clear naming convention guideline.

The "Naming conventions" subsection title is appropriate, and the guideline for constants (all caps with words separated by underscores) is a common and widely accepted practice. It helps maintain consistency in the codebase.


126-126: Helpful subsection on running tests.

The "Running tests" subsection title is appropriate, and providing information about the commands to run tests is helpful for contributors. It facilitates the testing process and ensures consistency.


137-137: Informative subsection on viewing tests.

The "Viewing tests" subsection title is appropriate, and mentioning that all tests can be viewed on the GitHub workflow is helpful for contributors. It provides clarity on where to find test results and reports.


## Best Practices
### **Testing**
#### E2E Test catagorization
Copy link

Choose a reason for hiding this comment

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

Fix typo and use hyphenated form.

  • Please fix the typo in the subsection title. It should be "categorization" instead of "catagorization".
  • As suggested by the static analysis tool, use the hyphenated form "End-to-end" instead of "End to end" for consistency and clarity.

Apply this diff to fix the issues:

-#### E2E Test catagorization
-End to end Testing broken down into 2 different parts
+#### End-to-End Test Categorization
+End-to-end testing is broken down into 2 different parts:
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
#### E2E Test catagorization
#### End-to-End Test Categorization
End-to-end testing is broken down into 2 different parts:
Tools
LanguageTool

[grammar] ~89-~89: Did you mean the adjective “End-to-end” (spelled with hyphens)?
Context: ...Testing* #### E2E Test catagorization End to end Testing broken down into 2 different pa...

(END_TO_END_HYPHEN)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

docs(contribution-guidelines): add best practices as a subsection
2 participants