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

Open
wants to merge 4 commits into
from

Projects

None yet

4 participants

@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
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
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
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.

@autarch autarch commented on the diff Aug 6, 2015
bin/tidyall
@@ -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";
@autarch
autarch Aug 6, 2015 Contributor

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
Contributor
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