- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 3k
 
Adding Cursor Rules for the R programming language #143
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
Conversation
          
WalkthroughAdds a new R best-practices rules file under  Changes
 Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
 Poem
 Pre-merge checks and finishing touches✅ Passed checks (3 passed)
 ✨ Finishing touches🧪 Generate unit tests
 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
 🚧 Files skipped from review as they are similar to previous changes (1)
 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment   | 
    
There was a problem hiding this 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
🧹 Nitpick comments (9)
rules/r-cursorrules-prompt-file-best-practices/.cursorrules (9)
95-95: Remove or correct “in-memory data injection”.“Injection” is not the right term here and duplicates the prior bullet about manipulation.
Apply one of:
- - 'data.table' or 'dplyr' for in-memory data injection. + - (Remove this line; already covered by manipulation above)or
- - 'data.table' or 'dplyr' for in-memory data injection. + - 'readr' or 'data.table' for efficient data import (CSV/TSV, etc.).
7-7: Grammar: “Prefer Quarto if available.”- - Use RMarkdown or Quarto for reports and documentation. Prefer Quarto is available and already installed. + - Use RMarkdown or Quarto for reports and documentation. Prefer Quarto if available and already installed.- - Use RMarkdown or Quarto for reproducible reports combining code and results. Prefer 'Quarto' if already available and installed. + - Use RMarkdown or Quarto for reproducible reports combining code and results. Prefer Quarto if available and installed.Also applies to: 61-61
12-12: Typo: “unncessary” → “unnecessary”.- - Avoid using unncessary dependencies, if a task can be achieved relatively easily using base R, just use base R and import other packages only if necessary. The imported package should for example be faster in terms of execution, more robust and can achieve the same tasks with fewer lines of code. Otherwise, just use base R. + - Avoid using unnecessary dependencies. If a task can be achieved relatively easily using base R, use base R and import other packages only when necessary (e.g., measurably faster, more robust, or fewer lines of code).
4-4: Clarify ‘inst/’ usage (package-specific).‘inst/’ is conventional for R packages; for non-package projects, consider ‘assets/’ or similar.
- - Organize projects into clear directories: 'R/' (scripts), 'data/' (raw and processed), 'output/' (results, plots), 'docs/' (reports, markdowns), 'inst/' for external files used within the project (.csv, .css and so on) + - Organize projects into clear directories: 'R/' (scripts), 'data/' (raw and processed), 'output/' (results, plots), 'docs/' (reports). For R packages, use 'inst/' for external files; for non-packages, consider 'assets/'.
21-21: Grammar: singular/plural and article.- - If the R project is an R package, run 'devtools::check' to check if the packages has no issues. Notes are okay but warnings and errors should be avoided. + - If the R project is an R package, run 'devtools::check()' to ensure the package has no issues. Notes are okay; avoid warnings and errors.
37-37: Grammar tighten-up.- - Use '#' for inline comments and section headers. Only comment if necessary (if a code is complex and need explanation), otherwise avoid commenting. The code should be self explanatory. + - Use '#' for inline comments and section headers. Comment only when necessary (e.g., complex code needing explanation). The code should be self‑explanatory.
41-41: Wording: “beforehands” → “beforehand”.- - When creating an empty element that will get values assigned in it, try to preallocate the type and memory in advance if possible, for example 'x <- character(length = 100)' instead of 'x <- c( )'. + - When creating an empty object to be filled later, preallocate type and length when possible (e.g., 'x <- character(length = 100)' instead of 'x <- c()').
46-48: Clarify “apply family” and pluralize loop.- - Prefer vectorized functions and apply family ('lapply', 'sapply', 'purrr') over explicit loops. When using loop, try to preallocate type and memory beforehands. + - Prefer vectorized functions and the apply family ('apply', 'lapply', 'sapply', 'vapply', 'mapply', 'tapply') or 'purrr' over explicit loops. When using loops, preallocate type and memory beforehand.
14-14: Small consistency/grammar nits (optional).
- Capitalize section heading consistently.
 - NAMESPACE/ Rd plural.
 - “package” → “packages”.
 - ## Package structure + ## Package Structure- - If the R project is an R package, make sure to always document the functions using 'roxygen' code. Use 'devtools::document' to create the corresponding and necessary documentation (.Rd files and NAMESPACE) file. + - If the R project is an R package, document functions using roxygen2. Use 'devtools::document()' to generate the required documentation (.Rd files) and 'NAMESPACE' file.- Have a preference for the following package when relying on a dependency: + Have a preference for the following packages when relying on dependencies:Also applies to: 20-20, 91-91
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
README.md(1 hunks)rules/r-cursorrules-prompt-file-best-practices/.cursorrules(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.md
📄 CodeRabbit inference engine (.cursorrules)
Always use Markdown for documentation and README files
Files:
README.md
README.md
📄 CodeRabbit inference engine (.cursorrules)
README.md: Maintain the existing structure of the README.md file
Maintain the following structure in the README.md file: 1. Title and Awesome badge 2. Logo 3. Short description 4. "Why .cursorrules?" section 5. Table of Contents 6. Rules section (with subcategories) 7. How to Use section 8. Contributing section 9. License section
Maintain alphabetical order within each category in the README.md file
Use consistent formatting for list items in the README.md file
Update the README.md file when adding new .cursorrules files, placing them in the correct category
Ensure all links in the README.md file are relative and correct
When updating the README.md, ensure the table of contents remains accurate
When adding new categories, update both the 'Contents' and 'Rules' sections of the README.md
Files:
README.md
**/*.{md,cursorrules}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{md,cursorrules}: Use clear and concise language in all documentation and .cursorrules files
When adding examples or explanations, focus on practical use cases for Cursor AI users
Files:
README.md
🔇 Additional comments (1)
README.md (1)
236-236: LGTM: R rules entry added correctly (format, placement, link).
- README.md has a single "R Best Practices" entry (line 236).
 - rules/r-cursorrules-prompt-file-best-practices/.cursorrules exists.
 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update cursor file
Summary by CodeRabbit