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

use $HOME/.tidyall.ini if not found tidyall.ini #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

aanoaa
Copy link

@aanoaa aanoaa commented Sep 10, 2012

first, sorry i have very poor english skills.
so i don't have to write documentation for details.

Test

$HOME/.tidyall.ini

[PerlTidy]
select = **/*.{pl,pm,t}
argv = -noll -it=2

[PerlCritic]
select = lib/**/*.pm
ignore = lib/UtterHack.pm
argv = -severity 3

then, go to some where perl project without tidyall.ini

$ tidyall -a

@jonswar
Copy link
Contributor

jonswar commented Sep 12, 2012

Thanks for the patch. I thought about doing this but it ended up not working. tidyall needs to know the "root directory" of your project - to know where to put backups and cache files, and to know where to search for files with options -a/--all and -s/--svn. It only knows the project root directory because the tidyall.ini file is there.

Best
Jon

On Sep 10, 2012, at 10:48 AM, Hyungsuk Hong wrote:

first, sorry i have very poor english skills.
so i don't have to write documentation for details.

Test

$HOME/.tidyall.ini

[PerlTidy]
select = */.{pl,pm,t}
argv = -noll -it=2

[PerlCritic]
select = lib/*/.pm
ignore = lib/UtterHack.pm
argv = -severity 3
then, go to some where perl project without tidyall.ini

$ tidyall -a

You can merge this Pull Request by running:

git pull https://github.com/aanoaa/perl-code-tidyall global-ini
Or view, comment on, or merge it at:

#5

Commit Summary

use $HOME/.tidyall.ini if not found tidyall.ini
File Changes

M bin/tidyall (1)
M lib/Code/TidyAll.pm (3)
Patch Links

https://github.com/jonswar/perl-code-tidyall/pull/5.patch
https://github.com/jonswar/perl-code-tidyall/pull/5.diff

Reply to this email directly or view it on GitHub.

@aanoaa
Copy link
Author

aanoaa commented Sep 13, 2012

tidyall needs to know the "root directory" of your project

current working directory will use to root_dir.

+    $params{root_dir} = cwd() if $conf_file eq "$ENV{HOME}/.tidyall.ini";

and this patch is working till now at me. :)

@oalders
Copy link
Contributor

oalders commented Jan 17, 2014

I suppose you could also just keep the .ini file in your home dir and then symlink to it from your individual projects.

@@ -54,6 +54,7 @@ if ( ( $all_files || $svn_files || $git_files ) ) {
die "cannot use filename(s) with -a/--all, -s/--svn, or -g/--git"
if @ARGV;
$conf_file ||= $tidyall_class->find_conf_file( cwd() );
$params{root_dir} = cwd() if $conf_file eq "$ENV{HOME}/.tidyall.ini";
Copy link
Member

Choose a reason for hiding this comment

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

This is just wrong, since the file is either tidyall.ini (no dot) or .tidyallrc. You'd need to check for both.

Better to check something like:

... if dirname($conf_file) eq $ENV{HOME};

@autarch
Copy link
Member

autarch commented Aug 6, 2015

I think this should check for both tidyall.ini and .tidyallrc. It should not check for .tidyall.ini (why add a third possible file name?).

I think it does make sense to default to cwd() when the tidyall config is found in the home dir. @jonswar, do you agree?

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

Successfully merging this pull request may close these issues.

4 participants