Skip to content

deprecate with_defaults -> linters_with_defaults - #1117

Merged
MichaelChirico merged 8 commits into
masterfrom
feature/with_defaults-refactor
May 16, 2022
Merged

MichaelChirico merged 8 commits into
masterfrom
feature/with_defaults-refactor

Conversation

@AshesITR

@AshesITR AshesITR commented May 2, 2022

Copy link
Copy Markdown
Collaborator

Fixes #1029

  • rename the core function to modify_defaults
  • add deprecation test for with_defaults()
  • update documentation to refer to linters_with_defaults() instead of with_defaults() where appropriate.

 - rename the core function to modify_defaults
 - add deprecation test for with_defaults()
 - update documentation to refer to linters_with_defaults() instead of with_defaults() where appropriate.
@AshesITR AshesITR mentioned this pull request May 2, 2022
AshesITR and others added 4 commits May 11, 2022 14:28
* add use_lintr()

* document `type`

* add tests, fix minor issues

* normalize both paths in test

* add more comments to DCF file

* test type = "full" as well

* reference use_lintr() in vignette and fix broken code

* avoid \"

* incorporate feedback

* document()

* reference vignette

* split expect_silent() tests and prevent unintentional line breaks

Co-authored-by: Michael Chirico <[email protected]>
old_defaults <- with_defaults(),
rex::rex("Use linters_with_defaults instead.")
)
expect_equal(defaults, old_defaults)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

identical?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These are currently identical, but not e.g. if using linters_with_tags("default") as a reference, because this constructs new functions with their own environments.
That's why I decided to only test equality.

@MichaelChirico

Copy link
Copy Markdown
Collaborator

I wonder if linters_with_defaults(default = defaults, ...) is a bit tough to read? too redundant? maybe i've just been starting at it too long. Is there a better name for that argument that gets at what it's for? default_set? baseline?

@AshesITR

Copy link
Copy Markdown
Collaborator Author

To be fair, the argument is usually not needed, and it would read linters_with_defaults(default = default_linters) compare
linters_with_tags(tags = ).

We could pluralize the argument for better consistency across the two?

@MichaelChirico

Copy link
Copy Markdown
Collaborator

I think that's indeed a little better. Let's go with that for now. I am worried I'm overthinking this.

MichaelChirico
MichaelChirico previously approved these changes May 16, 2022
@MichaelChirico
MichaelChirico merged commit fff7808 into master May 16, 2022
@MichaelChirico
MichaelChirico deleted the feature/with_defaults-refactor branch May 16, 2022 08:27
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.

Refactor with_defaults()

2 participants