Skip to content

lorenzwalthert_medium #4

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

Merged
merged 2 commits into from
Mar 25, 2017
Merged

Conversation

lorenzwalthert
Copy link
Collaborator

@lorenzwalthert lorenzwalthert commented Mar 24, 2017

In order to be consistent with style_pkg(), I used withr::with_dir to perform the styling. This, at the same time, means that the message printed (by transform_lines_enc internally) at the end of the styling to indicate which files were changed shows the paths relative to the temporary working directory used by withr::with_dir and not the directory that was the working directory before and after the execution of style_src(). If this is confusing, we have to do it without withr::with_dir, but then it would not be consistent anymore with style_pkg(), so I guess we can do it as proposed in this PR.

To increase the flexibility of the function regarding files in sub directories, style_src() has an argument recursive that will be passed to dir internally, so the user can choose whether to style files in just the selected directory or also in all sub-directories.

@lorenzwalthert lorenzwalthert force-pushed the lorenzwalthert_medium branch from 112ca85 to 7a1d347 Compare March 24, 2017 09:42
@lorenzwalthert lorenzwalthert force-pushed the lorenzwalthert_medium branch from 7a1d347 to 8bcea3c Compare March 24, 2017 09:43
@lorenzwalthert lorenzwalthert changed the title add style_src function lorenzwalthert_medium Mar 24, 2017
@krlmlr
Copy link
Member

krlmlr commented Mar 25, 2017

Thanks. We should eventually add a test, but that will be part of getting close to full test coverage. Mocking can be done with stubthat, mockery, or mockr.

@krlmlr krlmlr merged commit 59aee05 into r-lib:master Mar 25, 2017
@lorenzwalthert lorenzwalthert deleted the lorenzwalthert_medium branch March 25, 2017 09:24
lorenzwalthert added a commit that referenced this pull request Jun 23, 2017
Style correct when code does not start on first line
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