Package: arcanist
Version: 0~git20180509-2
Severity: normal
Tags: patch
Control: forward -1 
https://discourse.phabricator-community.org/t/arcanistpuppetlinter-broken-with-modern-versions-of-puppet-lint-uses-obsolete-log-format-key/2296

Dear Maintainer,

`arc lint` on Puppet manifests is broken with modern versions of
puppet-lint because it uses an old log-format directive.

Trying to lint a Puppet repository with arc lint using puppet-lint >= 
2.1.0 produces:

   Exception 
  Some linters failed:
      - CommandException: Command failed with error #1!
        COMMAND
        'puppet-lint' '--error-level=all' 
'--log-format=%{linenumber}|%{column}|%{kind}|%{check}|%{message}' 
'/some/path/puppet/manifests/site.pp'
        
        STDOUT
        (empty)
        
        STDERR
        /usr/lib/ruby/vendor_ruby/puppet-lint.rb:119:in `%': key{linenumber} 
not found (KeyError)
                from /usr/lib/ruby/vendor_ruby/puppet-lint.rb:119:in 
`format_message'
                from /usr/lib/ruby/vendor_ruby/puppet-lint.rb:166:in `block in 
report'
                from /usr/lib/ruby/vendor_ruby/puppet-lint.rb:156:in `each'
                from /usr/lib/ruby/vendor_ruby/puppet-lint.rb:156:in `report'
                from /usr/lib/ruby/vendor_ruby/puppet-lint.rb:215:in 
`print_problems'
                from /usr/lib/ruby/vendor_ruby/puppet-lint/bin.rb:67:in `block 
in run'
                from /usr/lib/ruby/vendor_ruby/puppet-lint/bin.rb:62:in `each'
                from /usr/lib/ruby/vendor_ruby/puppet-lint/bin.rb:62:in `run'
                from /usr/bin/puppet-lint:7:in `<main>'
        
  (Run with `--trace` for a full exception trace.)

`%{linenumber}` had been deprecated since 2014[1] in favor of `%{line}`
and was eventually removed in puppet-lint 2.1.0[2].

The attached patch fixes the issue, making arcanist compatible with the 
current puppet-lint version in Debian.

Regards,
Apollon

[1] 
https://github.com/rodjek/puppet-lint/commit/dd77ecaab12dc516c45ca620212e0f45b6b5a628
[2] 
https://github.com/rodjek/puppet-lint/commit/870cc9577b1dd58c3453402880cbf9fd5900fc31

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 
'testing'), (90, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=el_GR.UTF-8, LC_CTYPE=el_GR.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages arcanist depends on:
ii  libphutil               0~git20180509-2
ii  php-cli                 2:7.3+68
ii  php-curl                2:7.3+68
ii  php-xml                 2:7.3+68
ii  php5-cli                5.6.30+dfsg-0+deb8u1
ii  php7.0-cli [php-cli]    7.0.31-1
ii  php7.0-xml [php-xml]    7.0.31-1
ii  php7.2-cli [php-cli]    7.2.9-1
ii  php7.2-curl [php-curl]  7.2.9-1
ii  php7.2-xml [php-xml]    7.2.9-1
ii  php7.3-cli [php-cli]    7.3.0~rc4-1
ii  php7.3-curl [php-curl]  7.3.0~rc4-1
ii  php7.3-xml [php-xml]    7.3.0~rc4-1

arcanist recommends no packages.

Versions of packages arcanist suggests:
ii  python  2.7.15-3

-- no debconf information
>From f7cad0d4c46409a403f6fad5161e45742ec445b0 Mon Sep 17 00:00:00 2001
From: Apollon Oikonomopoulos <apoi...@debian.org>
Date: Mon, 14 Jan 2019 23:27:12 +0200
Subject: [PATCH] Puppet linter: use %{line} in the log format

`arc lint` on Puppet manifests is broken with modern versions of
puppet-lint because it uses an old log-format directive.

`%{linenumber}` had been deprecated since 2014[1] in favor of `%{line}`
and was eventually removed in puppet-lint 2.1.0[2].

Fix this by using `%{line}`, which should work for everyone these days.

[1] https://github.com/rodjek/puppet-lint/commit/dd77ecaab12dc516c45ca620212e0f45b6b5a628
[2] https://github.com/rodjek/puppet-lint/commit/870cc9577b1dd58c3453402880cbf9fd5900fc31
---
 src/lint/linter/ArcanistPuppetLintLinter.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lint/linter/ArcanistPuppetLintLinter.php b/src/lint/linter/ArcanistPuppetLintLinter.php
index 8336cd42..5b78ffd0 100644
--- a/src/lint/linter/ArcanistPuppetLintLinter.php
+++ b/src/lint/linter/ArcanistPuppetLintLinter.php
@@ -56,7 +56,7 @@ final class ArcanistPuppetLintLinter extends ArcanistExternalLinter {
     return array(
       '--error-level=all',
       sprintf('--log-format=%s', implode('|', array(
-        '%{linenumber}',
+        '%{line}',
         '%{column}',
         '%{kind}',
         '%{check}',
-- 
2.19.2

Reply via email to