команда arc lint завершается с ошибкой №1

Я настроил arc lint на использование pylint, определив линтеры в .arclint файле:

{
  "linters": {
    "pylint": {
      "type": "pylint",
      "include": "(\\.py$)"
    }
  }
}

После выполнения команды arc lint для любого *.py я получаю следующее исключение:

[2016-07-12 14:18:10] EXCEPTION: (PhutilAggregateException) Some linters failed:
- CommandException: Command failed with error #1!
  COMMAND
  'pylint' '--reports=no' '--msg-template={line}|{column}|{msg_id}|{symbol}|{msg}' '/Users/aivaneyko/Projects/raw/module/file.py'

  STDOUT
  ************* Module module.file


  STDERR
  Traceback (most recent call last):
    File "/Users/aivaneyko/Projects/raw/env/bin/pylint", line 11, in <module>
      sys.exit(run_pylint())
    File "/Users/aivaneyko/Projects/raw/env/lib/python2.7/site-packages/pylint/__init__.py", line 23, in run_pylint
      Run(sys.argv[1:])
    File "/Users/aivaneyko/Projects/raw/env/lib/python2.7/site-packages/pylint/lint.py", line 1315, in __init__
      linter.check(args)
    File "/Users/aivaneyko/Projects/raw/env/lib/python2.7/site-packages/pylint/lint.py", line 736, in check
      self._do_check(files_or_modules)
    File "/Users/aivaneyko/Projects/raw/env/lib/python2.7/site-packages/pylint/lint.py", line 867, in _do_check
      self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
    File "/Users/aivaneyko/Projects/raw/env/lib/python2.7/site-packages/pylint/lint.py", line 947, in check_astroid_module
      walker.walk(ast_node)
    File "/Users/aivaneyko/Projects/raw/env/lib/python2.7/site-packages/pylint/utils.py", line 938, in walk
      self.wa... (1,689 more bytes) ... at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:274]
arcanist(head=master, ref.master=4d4d16f25985), phutil(head=master, ref.master=32c56dc20b39)
  #0 <#2> ExecFuture::resolvex() called at [<arcanist>/src/lint/linter/ArcanistExternalLinter.php:448]
  #1 <#2> ArcanistExternalLinter::resolveFuture(string, ExecFuture) called at [<arcanist>/src/lint/linter/ArcanistFutureLinter.php:34]
  #2 <#2> ArcanistFutureLinter::didLintPaths(array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:594]
  #3 <#2> ArcanistLintEngine::executeDidLintOnPaths(ArcanistPyLintLinter, array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:545]
  #4 <#2> ArcanistLintEngine::executeLintersOnChunk(array, array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:473]
  #5 <#2> ArcanistLintEngine::executeLinters(array) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:216]
  #6 ArcanistLintEngine::run() called at [<arcanist>/src/workflow/ArcanistLintWorkflow.php:334]
  #7 ArcanistLintWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]

Мой вывод arc --version:

арканист 4d4d16f25985f133501f20fdddd183e525f00341 (28 июня 2016 г.)

libphutil 32c56dc20b39cffd0cfef931f6f4ab9c99f12677 (7 июля 2016 г.)

Мой вывод pylint --version:

pylint 1.5.6, astroid 1.4.7 Python 2.7.10 (по умолчанию, 23 октября 2015 г., 19:19:21) [совместимый с GCC 4.2.1 Apple LLVM 7.0.0 (clang-700.0.59.5)]

Я столкнулся с исключением на PHP 5.5.34, после обновления до PHP 5.6.23 проблема все еще существует. Также безуспешно пытался установить другую версию арканиста - arcanist 57f6fb59d73994d90cd94143787424ce0fdbf73b (25 Jan 2016), libphutil f43291e99d36045bc459e5133454c0d8fd8768ea (21 Jan 2016).

ОС: Эль-Капитан 10.11.5


person Andriy Ivaneyko    schedule 12.07.2016    source источник
comment
Вы пытались запустить команду pylint в консоли вручную? Я попробовал arc lint --все с файлом .arclint, который вы предоставили, и все работает отлично. У меня Pylint версии 1.6.1.   -  person Kostya Shkryob    schedule 12.07.2016
comment
@KostyaShkryob Да, я пробовал, все работает. Кроме того, я безуспешно пробовал pylint 1.6.1.   -  person Andriy Ivaneyko    schedule 12.07.2016


Ответы (1)


В моем случае проблема была связана с ValueError: unknown locale: UTF-8.

Если вы столкнулись с той же ошибкой в ​​MacOS, вот быстрое решение (экспорт в bash):

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Как исправить :

Пожалуйста, используйте скрипт "test.php" для воспроизведения проблемы (укажите путь к файлу вместо "путь к файлу/файлу"):

<?php
$descriptorspec = array(
    0 => array("pipe", "r"),
    1 => array("pipe", "w"),
    2 => array("file", "error_output.txt", "a")
);
$process = proc_open('"pylint" "--reports=no" "--msg-template={line}|{column}|{msg_id}|{symbol}|{msg}"   "path-to-file/file"', $descriptorspec, $pipes);
if (is_resource($process)) {
    fclose($pipes[0]);
    echo stream_get_contents($pipes[1]);
    fclose($pipes[1]);
    $return_value = proc_close($process);
    echo "command returned $return_value\n";
}
?>

Вы можете проверить ошибки в файле «error_output.txt», если они существуют.

Удачи! :)

person Roman    schedule 18.07.2016