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

@examplesIf sometimes removing # nolint end #828

Closed
jonkeane opened this issue Aug 4, 2021 · 4 comments · Fixed by #830
Closed

@examplesIf sometimes removing # nolint end #828

jonkeane opened this issue Aug 4, 2021 · 4 comments · Fixed by #830

Comments

@jonkeane
Copy link

jonkeane commented Aug 4, 2021

In some circumstances, styler will delete the line # nolint end after examplesIf. The two critical bits I needed to trigger it are: a %>% in the example and a function definition below. Without either of those I get behavior where the line is either kept as is or transformed into #' # nolint end.


author: jkeane
date: 2021-08-03
output: "reprex::reprex\_document"
title: drear-kitty_reprex.R

styler::style_text("
# nolint start
#' @examplesIf TRUE
# nolint end
#' df %>% func()
func <- function() NULL
")
#> 
#> # nolint start
#> #' @examplesIf TRUE
#> #' df %>% func()
#> func <- function() NULL

Created on 2021-08-03 by the reprex package (v2.0.0)

@lorenzwalthert
Copy link
Collaborator

@jonkeane can you try #830 and tell me if it works for you?

@jonkeane
Copy link
Author

jonkeane commented Aug 9, 2021

Yup, that works! Thanks for the quick turn around on this

@lorenzwalthert
Copy link
Collaborator

lorenzwalthert commented Aug 9, 2021

@jonkeane I am glad {styler} can help you guys out in {arrow}. Let me know if you have further questions or find more bugs 😊. You can also see the third-party integrations that {styler} has, e.g. with pre-commit that your repo is already using. These can also be enforced with https://pre-commit.ci, but R {precommit} is not there yet, so a manual GitHub actions workflow would be needed (like 10 lines of config, can assist here also) . There are also hooks for lintr etc.

@jonkeane
Copy link
Author

jonkeane commented Aug 9, 2021

Thanks for those pointers. The Arrow project has a comment-based system for auto-formatting like this, which we setup styler to be a part of to match that style/workflow that Arrow developers are used to.

I will definitely look in to pre-commits for other projects though!

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

Successfully merging a pull request may close this issue.

2 participants