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

Add diff-advance exercise #365

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

BaoCaiH
Copy link
Contributor

@BaoCaiH BaoCaiH commented Mar 1, 2024

Exercise for issue #356

Summary by CodeRabbit

  • Documentation
    • Introduced a new Git Kata guide covering advanced usage of git diff, including branch comparisons and selective testing techniques.

@MadsNielsen
Copy link
Contributor

@coderabbitai review

Copy link

coderabbitai bot commented Apr 26, 2024

diff-advance/README.md: # Summary

The new file README.md introduces a Git Kata focusing on advanced git diff usage. It covers comparing branches, using --word-diff and --name-only options, and a practical example for selective testing of changed files within a pipeline setup.

Walkthrough

The changes bring forth a fresh Git Kata centered on mastering sophisticated git diff techniques. This Kata encompasses branch comparisons, employing --word-diff and --name-only options, and showcases a practical scenario for selectively testing altered files in a pipeline configuration.

Changes

File Path Summary
.../README.md Introduces a Git Kata on advanced git diff usage, covering branch comparisons and selective testing.
.../setup.ps1, .../setup.sh Setup scripts for sourcing utilities, preparing branches, making initial commits, and updating pipelines.

🐇🌟
In the warren of code, a new Kata takes flight,
With diffs that shimmer in the digital light.
Branches entwine, words in a dance,
In the git-lit expanse, changes enhance.
Skipping through commits, a coder's trance! 🌙
🐇🌟


<!-- walkthrough_end --><!-- This is an auto-generated comment: raw summary by coderabbit.ai -->
<!--


```plaintext
diff-advance/README.md: # Summary

The new file `README.md` introduces a Git Kata focusing on advanced `git diff` usage. It covers comparing branches, using `--word-diff` and `--name-only` options, and a practical example for selective testing of changed files within a pipeline setup.

-->


Recent Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7da672e and 44c32f4.
Files selected for processing (1)
  • diff-advance/README.md (1 hunks)
Additional Context Used
LanguageTool (2)
diff-advance/README.md (2)

Near line 1: Possible spelling mistake found.
Context: # Git Kata: Git Diff Advance ## Setup Run `sourc...


Near line 16: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...nd an utilities file. Let's say we only want to test the pipelines because we're confid...

Additional comments not posted (4)
diff-advance/README.md (4)

1-6: Introduction and setup instructions are clear and concise.


7-15: Tasks section is well-structured and covers the intended learning objectives effectively.


18-23: Command example and its explanation are correctly formatted and clear.


25-31: Relevant commands and options are listed correctly and are well-formatted.


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>.
    • 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 show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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: 0

Out of diff range and nitpick comments (2)
diff-advance/README.md (2)

13-13: Consider revising to "Notice what is being removed and added."


16-16: Consider revising to "Let's say we only want to test the pipelines because we're confident enough with the utils not to test them (naughty-list programmer)."

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: 4

Out of diff range and nitpick comments (1)
diff-advance/README.md (1)

16-16: Try to vary your phrasing to enhance readability.

3. Compare `git diff master pipeline-improvement` and `git diff pipeline-improvement master`. Notice what is being removed and added.
4. Include `--word-diff` with `git diff`. In addition to the default, word diff can also be used in different modes, i.e. `--word-diff=color`. See how it is different from normal diff.
5. Include `--name-only` option with `git diff` and see the result.
6. With `--name-only`, we get a list of changed files. This can be useful for example when we want to do selective compile/test of changed files instead of a full re-build, given that steps can be compiled/tested independently. In our exercise, there are 3 steps in a pipeline and a utilities file. Let's say we only want to test the pipelines because we're confident enough with the utils to not test them (naughty-list programmer). We can do something like this:
Copy link

Choose a reason for hiding this comment

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

Consider using "an" instead of "a" before "utilities file" as it sounds more natural.

- a utilities file
+ an utilities file

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.

Suggested change
6. With `--name-only`, we get a list of changed files. This can be useful for example when we want to do selective compile/test of changed files instead of a full re-build, given that steps can be compiled/tested independently. In our exercise, there are 3 steps in a pipeline and a utilities file. Let's say we only want to test the pipelines because we're confident enough with the utils to not test them (naughty-list programmer). We can do something like this:
6. With `--name-only`, we get a list of changed files. This can be useful for example when we want to do selective compile/test of changed files instead of a full re-build, given that steps can be compiled/tested independently. In our exercise, there are 3 steps in a pipeline and an utilities file. Let's say we only want to test the pipelines because we're confident enough with the utils to not test them (naughty-list programmer). We can do something like this:

This will:
1. Get a list of the changed files
2. Filter for only `.pipeline` files
3. `cat`/test only these files
Copy link

Choose a reason for hiding this comment

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

Avoid redundancy by using synonyms or restructuring the sentence.

- `cat`/test only these files
+ `cat`/test these files

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.

Suggested change
3. `cat`/test only these files
3. `cat`/test these files

Comment on lines 18 to 24
`git diff --name-only | grep .pipeline | xargs cat`

This will:
1. Get a list of the changed files
2. Filter for only `.pipeline` files
3. `cat`/test only these files

Copy link

Choose a reason for hiding this comment

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

Clarify the example command to enhance understanding.

- `git diff --name-only | grep .pipeline | xargs cat`
+ `git diff --name-only | grep '.pipeline' | xargs cat`

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.

Suggested change
`git diff --name-only | grep .pipeline | xargs cat`
This will:
1. Get a list of the changed files
2. Filter for only `.pipeline` files
3. `cat`/test only these files
`git diff --name-only | grep '.pipeline' | xargs cat`
This will:
1. Get a list of the changed files
2. Filter for only `.pipeline` files
3. `cat`/test only these files

Comment on lines 25 to 30
## Relevant commands and options
- `git diff`
- `--word-diff`
- `--name-only`
- `grep`
- `xargs`
Copy link

Choose a reason for hiding this comment

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

Ensure proper markdown formatting by adding blank lines around the list.

+ 
- `git diff`
- `--word-diff`
- `--name-only`
- `grep`
- `xargs`
+ 

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.

Suggested change
## Relevant commands and options
- `git diff`
- `--word-diff`
- `--name-only`
- `grep`
- `xargs`
## Relevant commands and options
- `git diff`
- `--word-diff`
- `--name-only`
- `grep`
- `xargs`

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

diff-advance/README.md Show resolved Hide resolved
@BaoCaiH
Copy link
Contributor Author

BaoCaiH commented Apr 26, 2024

You can close this if you want, I'm not doing any more changes base on this AI's review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants