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

Add -nst to .perltidyrc #1370

Merged
merged 1 commit into from
Jun 21, 2019
Merged

Add -nst to .perltidyrc #1370

merged 1 commit into from
Jun 21, 2019

Conversation

Grinnz
Copy link
Contributor

@Grinnz Grinnz commented Jun 20, 2019

Summary

The -nst option disables -st which is enabled by -pbp, which causes the tidied code to be written to STDOUT instead of a a new file suffixed with .tdy. This means only one file can be tidied at a time, and the -st option is also incompatible with the -b option, which allows updating files in place, a workflow well suited for git.

Instead of perltidy lib/Some/File.pm > lib/SomeFile.pm.tdy, now just do perltidy lib/Some/File.pm and multiple files can be specified in one command.

perltidy -b lib/Some/File.pm will update the file(s) in place and create lib/Some/File.pm.bak.

perltidy -b -bext=/ lib/Some/File.pm will update the file(s) in place and delete the backup file(s) as long as there were no errors.

Motivation

To make it easier for contributors to run perltidy on their contributions.

References

jhthorsen/json-validator#162

@Grinnz
Copy link
Contributor Author

Grinnz commented Jun 20, 2019

Calling for a vote @mojolicious/core

@s1037989
Copy link
Contributor

s1037989 commented Jun 20, 2019

To make it easier for contributors to run perltidy on their contributions.

I can say I've always been confused by how I need to run perltidy. Granted, I don't use perltidy otherwise :S

perltidy -b lib/Some/File.pm will update the file(s) in place and create lib/Some/File.pm.bak.

It may be easy to do already, but I've not found explicit instructions for how to run perltidy for this project. Even if this PR isn't accepted, just having a specific instruction on how specifically we should run perltidy would be helpful. The simplicity above of how to use perltidy is great!

@Grinnz
Copy link
Contributor Author

Grinnz commented Jun 20, 2019

I think it would be good to have a wiki page about invoking perltidy if nothing else.

@Grinnz
Copy link
Contributor Author

Grinnz commented Jun 20, 2019

Note that -pbp also includes -se, which causes errors to be sent to STDERR instead of a filename.ERR file, but I don't think that impedes the workflows I described.

@CandyAngel CandyAngel merged commit b6366ba into master Jun 21, 2019
@jhthorsen jhthorsen deleted the Grinnz-patch-1 branch June 21, 2019 20:33
@Grinnz
Copy link
Contributor Author

Grinnz commented Jun 21, 2019

I've updated/renamed the wiki page https://github.com/mojolicious/mojo/wiki/Perltidy to possibly be more helpful.

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

5 participants