+
Skip to content

Conversation

ErikDanielsson
Copy link
Contributor

This PR addresses the issue raised in #3708. It does this by catching the UnicodeDecodeError and prompting the user for an action. This way, the user can more easily see if the undecoded file should be there or not. The user then has the option to include the warning in the diff, if the file should be ignored or if the diff creation should be aborted altogether.

To not prompt several times I've added an ignore list as an attribute to the print_diff and write_diff functions. This is updated when a an erronenous file is found. If passed to the next function (see patch.py) the ignore list is used instead of prompting the user.

A better solution is likely to convert the ComponentsDiffer class from a static to a normal class. Then the ignore list, and other things could be attributes of the class instead.

I've also updated the output from the patch command which showed the diff several times. Now it prints a panel with all changes instead of printing some with the logger.

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

)
)
files = list(files)
log.info(files)
Copy link
Member

Choose a reason for hiding this comment

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

make it a warning or remove

choices=[
questionary.Choice("Abort diff creation", "a"),
questionary.Choice("Ignore file", "i"),
questionary.Choice("Warn in diff", "w"),
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to offer the option to warn, if we can't read the file, I would say either we abort and let the user remove it, or ignore the file.

Co-authored-by: Júlia Mir Pedrol <mirp.julia@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载