adopt-ruff icon indicating copy to clipboard operation
adopt-ruff copied to clipboard

Encoding issue

Open ArneBachmannDLR opened this issue 1 year ago • 0 comments

(311) D:\forks\HACE\autocook>adopt-ruff --code-path autocook --ruff-conf-path pyproject.toml
C:\Users\bach_ar\.conda\envs\311\Lib\site-packages\pydantic\_internal\_config.py:272: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
  warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
2024-02-22 09:35:12.526 | DEBUG    | adopt_ruff.main:_main:316 - code_path.resolve()=D:\forks\HACE\autocook\autocook
2024-02-22 09:35:12.528 | DEBUG    | adopt_ruff.main:_main:317 - ruff_conf_path=pyproject.toml
2024-02-22 09:35:12.530 | DEBUG    | adopt_ruff.main:_main:318 - include_preview=True
2024-02-22 09:35:12.538 | DEBUG    | adopt_ruff.main:_main:319 - include_sometimes_fixable=False
2024-02-22 09:35:12.540 | DEBUG    | adopt_ruff.main:_main:320 - repo_name=None
2024-02-22 09:35:12.558 | DEBUG    | adopt_ruff.main:run_ruff:31 - parsed ruff_version=0.1.14
Exception in thread Thread-3 (_readerthread):
Traceback (most recent call last):
  File "C:\Users\bach_ar\.conda\envs\311\Lib\threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "C:\Users\bach_ar\.conda\envs\311\Lib\threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\bach_ar\.conda\envs\311\Lib\subprocess.py", line 1597, in _readerthread
    buffer.append(fh.read())
                  ^^^^^^^^^
  File "C:\Users\bach_ar\.conda\envs\311\Lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 112446: character maps to <undefined>
┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐
│ C:\Users\bach_ar\.conda\envs\311\Lib\site-packages\adopt_ruff\main.py:322 in _main               │
│                                                                                                  │
│   319 │   logger.debug(f"{include_sometimes_fixable=}")                                          │
│   320 │   logger.debug(f"{repo_name=}")                                                          │
│   321 │                                                                                          │
│ > 322 │   rules, violations, ruff_version = run_ruff(code_path)                                  │
│   323 │   config: RuffConfig = RuffConfig.from_file(                                             │
│   324 │   │   path=ruff_conf_path or search_config_file(code_path),                              │
│   325 │   │   rules=rules,                                                                       │
│                                                                                                  │
│ ┌───────────────────────── locals ──────────────────────────┐                                    │
│ │                 code_path = WindowsPath('autocook')       │                                    │
│ │           include_preview = True                          │                                    │
│ │ include_sometimes_fixable = False                         │                                    │
│ │                 repo_name = None                          │                                    │
│ │            ruff_conf_path = WindowsPath('pyproject.toml') │                                    │
│ └───────────────────────────────────────────────────────────┘                                    │
│                                                                                                  │
│ C:\Users\bach_ar\.conda\envs\311\Lib\site-packages\adopt_ruff\main.py:40 in run_ruff             │
│                                                                                                  │
│    37 │   # Now when ruff is found, assume the following commands will run properly              │
│    38 │   rules = {                                                                              │
│    39 │   │   Rule(**value)                                                                      │
│ >  40 │   │   for value in json.loads(                                                           │
│    41 │   │   │   subprocess.run(                                                                │
│    42 │   │   │   │   ["ruff", "rule", "--all", "--output-format=json"],                         │
│    43 │   │   │   │   check=True,                                                                │
│                                                                                                  │
│ ┌──────────────── locals ────────────────┐                                                       │
│ │         path = WindowsPath('autocook') │                                                       │
│ │ ruff_version = <Version('0.1.14')>     │                                                       │
│ └────────────────────────────────────────┘                                                       │
│                                                                                                  │
│ C:\Users\bach_ar\.conda\envs\311\Lib\json\__init__.py:339 in loads                               │
│                                                                                                  │
│   336 │   │   │   │   │   │   │   │     s, 0)                                                    │
│   337 │   else:                                                                                  │
│   338 │   │   if not isinstance(s, (bytes, bytearray)):                                          │
│ > 339 │   │   │   raise TypeError(f'the JSON object must be str, bytes or bytearray, '           │
│   340 │   │   │   │   │   │   │   f'not {s.__class__.__name__}')                                 │
│   341 │   │   s = s.decode(detect_encoding(s), 'surrogatepass')                                  │
│   342                                                                                            │
│                                                                                                  │
│ ┌───────── locals ─────────┐                                                                     │
│ │               cls = None │                                                                     │
│ │                kw = {}   │                                                                     │
│ │       object_hook = None │                                                                     │
│ │ object_pairs_hook = None │                                                                     │
│ │    parse_constant = None │                                                                     │
│ │       parse_float = None │                                                                     │
│ │         parse_int = None │                                                                     │
│ │                 s = None │                                                                     │
│ └──────────────────────────┘                                                                     │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

ArneBachmannDLR avatar Feb 22 '24 08:02 ArneBachmannDLR