AtomLinter / linter-phpcs

Linter plugin for PHP, using PHP_CodeSniffer.
63 stars 31 forks source link

Something went wrong attempting to parse the PHPCS output. #351

Closed Skeeve closed 5 years ago

Skeeve commented 5 years ago

I receive this error even with this most basic file:

<?php

running phpcs on commandline with the same file gives me

$ phpcs Ohne\ Titel

FILE: […]/Ohne Titel
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | Missing file doc comment
----------------------------------------------------------------------

Time: 59ms; Memory: 4Mb

The Developer Tools do not output anything except for

PHPCS Response            main.js? [sm]:326

Some system Info

$ atom --version
Atom    : 1.31.1
Electron: 2.0.7
Chrome  : 61.0.3163.100
Node    : 8.9.3
$ apm list
Built-in Atom Packages (92)
├── atom-dark-syntax@0.29.0
├── atom-dark-ui@0.53.2
├── atom-light-syntax@0.29.0
├── atom-light-ui@0.46.2
├── base16-tomorrow-dark-theme@1.5.0
├── base16-tomorrow-light-theme@1.5.0
├── one-dark-ui@1.12.4
├── one-light-ui@1.12.5
├── one-dark-syntax@1.8.4
├── one-light-syntax@1.8.4
├── solarized-dark-syntax@1.1.5
├── solarized-light-syntax@1.1.5
├── about@1.9.1
├── archive-view@0.65.1
├── autocomplete-atom-api@0.10.7
├── autocomplete-css@0.17.5
├── autocomplete-html@0.8.4
├── autocomplete-plus@2.40.7
├── autocomplete-snippets@1.12.0
├── autoflow@0.29.4
├── autosave@0.24.6
├── background-tips@0.28.0
├── bookmarks@0.45.1
├── bracket-matcher@0.89.2
├── command-palette@0.43.5
├── dalek@0.2.2
├── deprecation-cop@0.56.9
├── dev-live-reload@0.48.1
├── encoding-selector@0.23.9
├── exception-reporting@0.43.1
├── find-and-replace@0.215.12
├── fuzzy-finder@1.8.2
├── github@0.19.0
├── git-diff@1.3.9
├── go-to-line@0.33.0
├── grammar-selector@0.50.1
├── image-view@0.63.1
├── incompatible-packages@0.27.3
├── keybinding-resolver@0.38.2
├── line-ending-selector@0.7.7
├── link@0.31.4
├── markdown-preview@0.159.23
├── metrics@1.6.2
├── notifications@0.70.5
├── open-on-github@1.3.1
├── package-generator@1.3.0
├── settings-view@0.255.0
├── snippets@1.3.5
├── spell-check@0.74.0
├── status-bar@1.8.15
├── styleguide@0.49.12
├── symbols-view@0.118.2
├── tabs@0.109.2
├── timecop@0.36.2
├── tree-view@0.224.2
├── update-package-dependencies@0.13.1
├── welcome@0.36.7
├── whitespace@0.37.6
├── wrap-guide@0.40.3
├── language-c@0.60.4
├── language-clojure@0.22.7
├── language-coffee-script@0.49.3
├── language-csharp@1.0.4
├── language-css@0.42.11
├── language-gfm@0.90.5
├── language-git@0.19.1
├── language-go@0.46.2
├── language-html@0.51.5
├── language-hyperlink@0.16.3
├── language-java@0.30.0
├── language-javascript@0.129.9
├── language-json@0.19.2
├── language-less@0.34.2
├── language-make@0.22.3
├── language-mustache@0.14.5
├── language-objective-c@0.15.1
├── language-perl@0.38.1
├── language-php@0.44.0
├── language-property-list@0.9.1
├── language-python@0.51.4
├── language-ruby@0.72.7
├── language-ruby-on-rails@0.25.3
├── language-sass@0.62.0
├── language-shellscript@0.27.4
├── language-source@0.9.0
├── language-sql@0.25.10
├── language-text@0.7.4
├── language-todo@0.29.4
├── language-toml@0.18.2
├── language-typescript@0.4.6
├── language-xml@0.35.2
└── language-yaml@0.32.0

Community Packages (33) /Users/shk/.atom/packages
├── Sublime-Style-Column-Selection@1.7.5
├── aligner-golang@0.1.0
├── asciidoc-preview@2.12.1
├── atom-autocomplete-php@0.25.6
├── atom-beautify@0.33.1
├── atom-ide-ui@0.13.0
├── busy-signal@1.4.3
├── git-plus@8.1.0
├── go-plus@5.8.6
├── goto-definition@1.3.4
├── ide-go@0.12.3
├── ide-php@0.7.15 (disabled)
├── intentions@1.1.5
├── language-asciidoc@1.11.0
├── language-blade@0.41.2
├── language-gettext@0.6.1
├── language-vue@0.23.1
├── linter@2.2.0
├── linter-eslint@8.4.1 (disabled)
├── linter-js-standard@5.1.0
├── linter-perl@0.8.2
├── linter-perlcritic@2.1.0 (disabled)
├── linter-php@1.5.1 (disabled)
├── linter-phpcs@1.6.10
├── linter-python@3.1.2
├── linter-ui-default@1.7.1
├── php-cs-fixer@4.1.1 (disabled)
├── php-ide-serenata@4.5.0 (disabled)
├── project-manager@3.3.6
├── python-indent@1.1.6
├── python-tools@0.6.9
├── standard-formatter@2.8.0
└── symbols-tree-view@0.14.0 (disabled)
Skeeve commented 5 years ago

Seems it's the Joomla standard I use. Running

$ phpcs --standard=Joomla Ohne\ Titel
E

FILE: /Users/shk/Projects/SIWECOS/business-logic-api/Ohne Titel
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | Missing file doc comment
----------------------------------------------------------------------

Time: 97ms; Memory: 4Mb

Gives an additional "E" as first character :( Maybe that's the issue.

After a few tests: It isn't.

Skeeve commented 5 years ago

I've experimented a bit more.

Seems this is the commandline executed by the plugin

phpcs --report=json -q --encoding=UTF-8 --warning-severity=2 --tab-width=4 -s --stdin-path='Ohne Titel' -

My understanding is that phpcs should parse my file from commandline.

Unfortunately executing above command simply hangs on my Mac. Something's really weird here.

Executing

phpcs --report=json -q --encoding=UTF-8 --warning-severity=2 --tab-width=4 -s 'Ohne Titel'

works as expected.

Skeeve commented 5 years ago

More tests revealed that I have to execute:

phpcs --report=json -q --encoding=UTF-8 --warning-severity=2 --tab-width=4 -s --stdin-path='Ohne Titel' - < Ohne\ Titel
{"totals":{"errors":1,"warnings":0,"fixable":0},"files":{"\/Users\/shk\/Projects\/SIWECOS\/business-logic-api\/Ohne Titel":{"errors":1,"warnings":0,"messages":[{"message":"Missing file doc comment","source":"PEAR.Commenting.FileComment.Missing","severity":5,"type":"ERROR","line":1,"column":1,"fixable":false}]}}}

And - as you can see - the result is fine.

Nevertheless linter-phpcs receives receives an empty reply :(

Does no one have a clue what's going wrong here?

Skeeve commented 5 years ago

More tests revealed that I have to execute:

phpcs --report=json -q --encoding=UTF-8 --warning-severity=2 --tab-width=4 -s --stdin-path='Ohne Titel' - < Ohne\ Titel
{"totals":{"errors":1,"warnings":0,"fixable":0},"files":{"\/Users\/shk\/Projects\/SIWECOS\/business-logic-api\/Ohne Titel":{"errors":1,"warnings":0,"messages":[{"message":"Missing file doc comment","source":"PEAR.Commenting.FileComment.Missing","severity":5,"type":"ERROR","line":1,"column":1,"fixable":false}]}}}

And - as you can see - the result is fine.

Nevertheless linter-phpcs receives receives an empty reply :(

Does no one have a clue what's going wrong here?

I also tried to "ktrace" phpcs while called from atom. I have the feeling it's not started due to a page fault.

First few lines of the trace show:

walltime                          delta(us)(duration)    debug-id                             arg1             arg2             arg3             arg4             thread-id        cpu  process-name(pid)                             

2018-10-10 09:33:33.495931 CEST         0.0              UTrap_PageFault                      99b              e0fc3028         1                6d88581          fa5              2   Atom Helper(387)  
2018-10-10 09:33:33.495932 CEST         0.1              MACH_vmfault                         99b              99be0fc3000      0                0                fa5              2   Atom Helper(387)  
2018-10-10 09:33:33.495937 CEST         5.4(5.4)         MACH_vmfault                         99b              99be0fc3000      0                4                fa5              2   Atom Helper(387)  
2018-10-10 09:33:33.495990 CEST        53.3              9010026                              3214da1426cc8687 1                602              2                abb7             0   ktrace(1670)  
2018-10-10 09:33:33.495990 CEST         0.1              MACH_MKRUNNABLE                      5aef             4                0                4                abb7             0   ktrace(1670)  
2018-10-10 09:33:33.495991 CEST         0.4              MACH_SCHED_CHOOSE_PROCESSOR          5aef             1                3                4                abb7             0   ktrace(1670)  
2018-10-10 09:33:33.495991 CEST         0.5              CPUPM_PST_LOAD_TXFR                  3                4                0                0                abb7             0   ktrace(1670)  
2018-10-10 09:33:33.495991 CEST         0.1              MACH_SCHED_REMOTE_AST                3                0                0                0                abb7             0   ktrace(1670)  
2018-10-10 09:33:33.495992 CEST         1.0              CPUPM_IDLE_MWAIT                     4                60               0                1                94               3   kernel_task(0)  
2018-10-10 09:33:33.495992 CEST         0.0              INTERRUPT                            72               ffffff80002b513c 0                3                abb7             0   ktrace(1670)  
Skeeve commented 5 years ago

Final status: Seems somehow my atom installation is borken… Removin ~/.atom and installing linter-phpcs and its dependencies reveals no strange issues at all.