Closed tolki5 closed 1 year ago
Hello! Unpack the archive and try to target the a.bat
file in the command attribute. What output will be produced by the notepad++?
a.zip
Hi there,
thank you for your support! I tried and it's works. Two errors are marked.
I tried a lower version of phpcs, specifically this one: https://github.com/squizlabs/PHP_CodeSniffer/tree/2.9 and its works.
So is the problem in the fact that the report from phpcs is structured differently in the higher version?
Not so likely... Try to change the content of a.bat to
@echo off
C:\Users\Tolki\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\bin\phpcs.bat --report=checkstyle C:\path-to\php-file\with-errors.php
And run it from command line? And then open php-file from the notepad++?
Run in cmd: `<?xml version="1.0" encoding="UTF-8"?>
Try to replace "C:\path-to\php-file\with-errors.php" in the a.bat to "%1"
Looks like it is a execute permissions issue.
I changed and got the message again:
Linter: Invalid output format. Only checkstyle-compactible output allowed.
I checked the permissions and everything should be fine. I'm really confused :-(
One more point. I tried to use another phpcs:
https://github.com/php-parallel-lint/PHP-Parallel-Lint
In cmd i got this result: `<?xml version="1.0" encoding="UTF-8"?>
I've had this start too since updating to latest eslint. (And the nightmare of updating npm to latest version).
When I run the command in a command prompt I get
<?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3"><file name="C:\Users\blahblah.js"><error line="53" column="1" severity="error" message="All 'var' declarations must be at the top of the function scope. (vars-on-top)" source="eslint.rules.vars-on-top" /><error line="53" column="1" severity="error" message="Unexpected var, use let or const instead. (no-var)" source="eslint.rules.no-var" /></file></checkstyle>
But all I see in notepad is 'Linter: linter.xml load error. Check file format'
jshint is working fine
and today this has started working fine and I'm not sure what I did to change it.
<?xml version="1.0" encoding="UTF-8" ?> <NotepadPlus> <linter extension=".php" command="C:\Users\Tolki\AppData\Roaming\Composer\vendor\squizlabs\php_codesniffer\bin\phpcs.bat --report=checkstyle"/> </NotepadPlus>
Hi @tolki5 . I think its a PATH or parameter problem. First, make sure you have the full path to php.exe in your system PATH variable. Second, don't use phpcs.bat and use the following linter.xml:
<?xml version="1.0" encoding="utf-8" ?>
<NotepadPlus>
<linter extension=".php" command='php.exe "X\phpcs.phar" --report=checkstyle'/>
</NotepadPlus>
Replace X with fullpath to phpcs.phar file. Don't use environment variables in X. I don't know why the variables are not expanded. If the path does not contain spaces, it is not necessary to use the double quotes.
The problem with my last solution... is that it doesn't work! :( The bat file takes a temporary file as a parameter (if you are editing the file c:\path\to\file\index.php, the script receives c:\path\to\file\index.php.temp.linter.file.tmp as the parameter) which has 0 bytes. To fix this problem, I had to create a BAT script (I place it in c:\phpcs.bat) with the following content:
@echo off
set F=%1
set F=%F:.temp.linter.file.tmp=%
php.exe "X\phpcs.phar" --report=checkstyle "%F%"
Like before, replace X with fullpath to phpcs.phar file. The linter.xml file should be:
<?xml version="1.0" encoding="utf-8" ?>
<NotepadPlus>
<linter extension=".php" command='c:\phpcs.bat'/>
</NotepadPlus>
Hello,
Linter keeps returning the following error “Linter: Invalid output format. Only checkstyle-compatible output allowed.” Even though running the command in cmd produces valid XML.
Here is example of XML returned in cmd:
Here’s my installation info: Notepad++ v8.5.1 (64-bit) Build time : Mar 21 2023 - 19:16:10 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : "C:\Users\Tolki\Desktop\x-men-kalkulace.txt" Admin mode : ON Local Conf mode : OFF Cloud Config : OFF OS Name : Windows 10 Pro (64-bit) OS Version : 21H2 OS Build : 19044.2728 Current ANSI codepage : 1250 Plugins : Linter (0.1) mimeTools (2.9) NppConverter (4.5) NppExec (0.8.2) NppExport (0.4)
My linter configuration is:
Thank you for support!