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

StdoutRefactoringTool sets files attribute even when no files need to be modified #26

Open
mahmoud opened this issue Oct 8, 2020 · 0 comments · May be fixed by #27
Open

StdoutRefactoringTool sets files attribute even when no files need to be modified #26

mahmoud opened this issue Oct 8, 2020 · 0 comments · May be fixed by #27

Comments

@mahmoud
Copy link

mahmoud commented Oct 8, 2020

Description

Hi there! While trying to enforce 2/3 compatibility on a large codebase, I ran across an issue with modernize's --enforce flag:

$ python-modernize --future-unicode --enforce enqueue_function.py
 Loading the following fixers:
    fissix.fixes.fix_apply  (apply)
    fissix.fixes.fix_except  (except)
    fissix.fixes.fix_exec  (exec)
    fissix.fixes.fix_execfile  (execfile)
    fissix.fixes.fix_exitfunc  (exitfunc)
    fissix.fixes.fix_funcattrs  (funcattrs)
    fissix.fixes.fix_has_key  (has_key)
    fissix.fixes.fix_idioms  (idioms)
    fissix.fixes.fix_long  (long)
    fissix.fixes.fix_methodattrs  (methodattrs)
    fissix.fixes.fix_ne  (ne)
    fissix.fixes.fix_numliterals  (numliterals)
    fissix.fixes.fix_operator  (operator)
    fissix.fixes.fix_paren  (paren)
    fissix.fixes.fix_reduce  (reduce)
    fissix.fixes.fix_renames  (renames)
    fissix.fixes.fix_repr  (repr)
    fissix.fixes.fix_set_literal  (set_literal)
    fissix.fixes.fix_standarderror  (standarderror)
    fissix.fixes.fix_sys_exc  (sys_exc)
    fissix.fixes.fix_throw  (throw)
    fissix.fixes.fix_tuple_params  (tuple_params)
    fissix.fixes.fix_types  (types)
    fissix.fixes.fix_ws_comma  (ws_comma)
    fissix.fixes.fix_xreadlines  (xreadlines)
    libmodernize.fixes.fix_basestring  (basestring)
    libmodernize.fixes.fix_dict_six  (dict_six)
    libmodernize.fixes.fix_file  (file)
    libmodernize.fixes.fix_filter  (filter)
    libmodernize.fixes.fix_import  (import)
    libmodernize.fixes.fix_imports_six  (imports_six)
    libmodernize.fixes.fix_input_six  (input_six)
    libmodernize.fixes.fix_int_long_tuple  (int_long_tuple)
    libmodernize.fixes.fix_itertools_imports_six  (itertools_imports_six)
    libmodernize.fixes.fix_itertools_six  (itertools_six)
    libmodernize.fixes.fix_map  (map)
    libmodernize.fixes.fix_metaclass  (metaclass)
    libmodernize.fixes.fix_next  (next)
    libmodernize.fixes.fix_print  (print)
    libmodernize.fixes.fix_raise  (raise)
    libmodernize.fixes.fix_raise_six  (raise_six)
    libmodernize.fixes.fix_unichr  (unichr)
    libmodernize.fixes.fix_unicode_future  (unicode_future)
    libmodernize.fixes.fix_unicode_type  (unicode_type)
    libmodernize.fixes.fix_urllib_six  (urllib_six)
    libmodernize.fixes.fix_xrange_six  (xrange_six)
    libmodernize.fixes.fix_zip  (zip)
 Applying the following explicit transformations:
    (None)

RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: No changes to ebill/ebill/tasks/enqueue_function.py
RefactoringTool: Files that need to be modified:
RefactoringTool: ebill/ebill/tasks/enqueue_function.py

As you can see in the last 3 lines, "no changes" but also "need to be modified". Seems like this is a longstanding issue with 2to3.

I think the "need to be modified" is translated into the rt.files attribute that powers the --enforce flag.

I haven't dug into fissix yet, but maybe it represents a suitable layer at which to undo the damage? If a path says "no changes", remove it from the files list? Just an idea!

Details

  • OS: Ubuntu 18.04
  • Python version: 3.6.9
  • fissix version: 20.8.0
  • Can you repro on master? yes
  • Can you repro in a clean virtualenv? yes
@mahmoud mahmoud changed the title StdoutRefactoringTool sets files attribute even when no files are modified StdoutRefactoringTool sets files attribute even when no files need to be modified Oct 8, 2020
mahmoud pushed a commit to mahmoud/fissix that referenced this issue Oct 8, 2020
@mahmoud mahmoud linked a pull request Oct 8, 2020 that will close this issue
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 a pull request may close this issue.

1 participant