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

Make sure the content to the left of TODO items doesn't get deleted when marking a TODO item as complte #27

Merged
merged 6 commits into from
May 17, 2024

Conversation

olivroy
Copy link
Owner

@olivroy olivroy commented May 16, 2024

Current status is that there is too much deletion happening..

WHich means that somethings ends up resolving to an empty string somewhere.

I probably should change my testing strategy to make sure smaller chunks are behaving well.

todo rename rm_line to rn_tag

I will probably remove the rm_line argument, it seems unsafe + not well tested.

Give more info of the source of todo deletion.

I may have broken line resolving, although I didn't touch this part
Copy link

coderabbitai bot commented May 16, 2024

Walkthrough

The recent updates to the reuseme package aim to enhance functionality and error handling across various functions, including more precise content deletion in complete_todo(), better handling of news files and headings in file_outline(), refined regex patterns in R/outline.R, and enhanced line extraction and error management in R/use-todo.R.

Changes

File Change Summary
NEWS.md, R/outline.R Refinements in content deletion, error handling, and regex patterns.
R/use-todo.R, tests/testthat/test-use-todo.R Enhanced line extraction, logic, and error handling in complete_todo() function and test updates.

In code we trust, improvements we make,
To handle lines with care, for clarity's sake.
Regex refined, and errors addressed,
Our functions now shine, passing every test.
🐇✨


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.

@olivroy olivroy changed the title Trunc todo code Make sure the content to the left of TODO items doesn't get deleted when marking a TODO item as complte May 16, 2024
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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 8d87bd6 and e009468.
Files selected for processing (4)
  • NEWS.md (1 hunks)
  • R/outline.R (2 hunks)
  • R/use-todo.R (1 hunks)
  • tests/testthat/test-use-todo.R (3 hunks)
Files skipped from review due to trivial changes (1)
  • tests/testthat/test-use-todo.R
Additional Context Used
LanguageTool (16)
NEWS.md (16)

Near line 31: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ... * file_outline() better support for todo in md files * file_outline() should ...


Near line 33: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ...tline()should recognize and transform markdown links automatically with newmarkup_hr...


Near line 35: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ...nly takes care of changing gh issues in markdown links. New markup_href() is more gene...


Near line 50: The progressive form of the verb may be more appropriate here.
Context: ...work better with Quarto books, avoiding to look in _book and _execute, and classify...


Near line 50: Do not mix variants of the same word (‘regexp’ and ‘regex’) within a single text.
Context: ...c file name, hence not looking for this regexp when searching for conflicts. * `file_...


Near line 54: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ... default. * file_outline() truncates todo items to fit on a single line. * can n...


Near line 58: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...k. * Simplified internal function from mark_todo_as_complete() to complete_todo() * ...


Near line 60: Did you mean “giving”? Or maybe you should add a pronoun? In active voice, ‘encourage’ + ‘to’ takes an object, usually a pronoun.
Context: ...element on the first line (to encourage to give an informative description as first lin...


Near line 60: It appears that a hyphen is missing in the plural noun “to-dos”?
Context: ...informative description as first line) (todos or tests excluded) * Improved support ...


Near line 77: Possible missing preposition found.
Context: ... what to do. force is now deprecated. Is now separated in smaller functions that...


Near line 94: Did you mean “writing”? Or maybe you should add a pronoun? In active voice, ‘allow’ + ‘to’ takes an object, usually a pronoun.
Context: ... max before min. * use_todo() allows to write to no project with use_todo("all::") *...


Near line 94: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ... allows to write to no project with use_todo("all::") * use_todo() provides the h...


Near line 96: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...use_todo() provides the handy :: as a shortcut for `use_todo("tod...


Near line 96: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...j>:: as a shortcut for `use_todo("todo items", "proj") to write TODO ite...


Near line 96: It appears that a hyphen is missing in the noun “to-do” (= task) or did you mean the verb “to do”?
Context: ...odo items> as a shortcut for `use_todo("todo items", "proj") to write TODO items to ...


Near line 100: To form a complete sentence, be sure to include a subject.
Context: ... a RStudio project * complete_todo() can be used multiple times sequentially and...

Additional comments not posted (7)
R/use-todo.R (4)

140-140: LGTM!


144-148: LGTM!


161-173: LGTM!


187-191: LGTM!

R/outline.R (3)

595-596: Improved regex pattern accuracy.


614-616: Ensured regex pattern is modified twice if needed.


616-616: Ensured regex pattern is modified twice if needed.

NEWS.md Show resolved Hide resolved
@@ -133,36 +133,63 @@ complete_todo <- function(line_id, file, regexp, rm_line = NULL) {
))
}

line_content_before_comment <- stringr::str_extract(line_content, "([^#]+)#", group = 1)
Copy link

Choose a reason for hiding this comment

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

Consider renaming line_content_before_comment to line_content_prefix for clarity.

- line_content_before_comment <- stringr::str_extract(line_content, "([^#]+)#", group = 1)
+ line_content_prefix <- stringr::str_extract(line_content, "([^#]+)#", group = 1)

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
line_content_before_comment <- stringr::str_extract(line_content, "([^#]+)#", group = 1)
line_content_prefix <- stringr::str_extract(line_content, "([^#]+)#", group = 1)

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between e009468 and 3c62002.
Files selected for processing (2)
  • R/outline.R (2 hunks)
  • R/use-todo.R (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • R/outline.R
  • R/use-todo.R

@olivroy olivroy merged commit 14ec8e7 into main May 17, 2024
7 checks passed
@olivroy olivroy deleted the trunc-todo-code branch May 17, 2024 11:36
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 3c62002 and 89a8065.
Files selected for processing (2)
  • R/use-todo.R (2 hunks)
  • tests/testthat/test-use-todo.R (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • R/use-todo.R
  • tests/testthat/test-use-todo.R

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.

None yet

1 participant