grantmcconnaughey / Lintly

Automated GitHub PR code reviewer for Python, JavaScript, CSS, and more.
MIT License
92 stars 18 forks source link

lintly fails if the PR contains a non utf-8 character #56

Open ikerexxe opened 2 years ago

ikerexxe commented 2 years ago

I'm working on a PR that includes a configuration file with Japanese characters. Even though that file isn't checked by the code reviewer the execution fails while getting the PR diff.

Logs:

Lintly: 2022-04-05 13:14:22,481 [INFO] lintly.builds: Lintly found violations in 43 files
Lintly: 2022-04-05 13:14:22,482 [DEBUG] lintly.backends.github: Sending a get request to /repos/SSSD/sssd/pulls/6065
Traceback (most recent call last):
  File "/usr/local/bin/lintly", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/lintly/cli.py", line 74, in main
    build.execute()
  File "/usr/local/lib/python3.9/site-packages/lintly/builds.py", line 76, in execute
    diff = self.get_pr_diff()
  File "/usr/local/lib/python3.9/site-packages/lintly/builds.py", line 86, in get_pr_diff
    return self.git_client.get_pr_diff(self.config.pr)
  File "/usr/local/lib/python3.9/site-packages/lintly/backends/github.py", line 173, in get_pr_diff
    return diff.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 17043: invalid start byte