This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 270987

Summary: Code Analysis not working with current Version of phpcs and php-cs-fixer
Product: php Reporter: OwnerOfThisIsle
Component: CodeAssignee: junichi11
Status: RESOLVED FIXED    
Severity: normal CC: crocodile, junichi11, tmysik
Priority: P2    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: screenshot of Enabled option

Description OwnerOfThisIsle 2017-06-28 08:10:18 UTC
In both cases the problem is that it uses wrong cmd line arguments:

Case PHPCS:
If I use the Feature under Source->Inspect...
Then choose Code Sniffer:
It uses the not working Parameter --runtime-set Default_standard PSR2
when it should correctly use --Standard PSR2
The former worked in older Versions of phpcs, but is not allowed anymore.
Details:
https://github.com/squizlabs/PHP_CodeSniffer/issues/1529

Case PHP-CS-FIXER
If I use the Feature under Source->Inspect...
Then choose Coding Standards Fixer:
It uses the not working Parameter --level PSR2
which leads to the Output
[Symfony\Component\Console\Exception\RuntimeException]  
  The "--level" option does not exist.  




In General:
Since those cmd line arguments seem to be not constant enough, it might be a better alternative to provide an Option to add custom Parameters in the config 
area Tools->Options->PHP->Code Analysis
Comment 1 Tomas Mysik 2017-06-29 06:47:43 UTC
Junichi could be interested in this issue I guess ;)

Thanks.
Comment 2 junichi11 2017-06-29 11:33:49 UTC
I'll try to look at it later.

Thanks.
Comment 3 junichi11 2017-07-05 04:56:17 UTC
Created attachment 164693 [details]
screenshot of Enabled option

Tomas, currently, If a customizer is used, all analyzer's commands are run. So, I think that "Enabled" option should be added to each analyzer customizer panel. May I do it?
Comment 4 Tomas Mysik 2017-07-05 08:25:18 UTC
Feel free to do whatever is needed and/or you think that should be done :)

Thanks!
Comment 5 junichi11 2017-07-05 11:20:55 UTC
(In reply to Tomas Mysik from comment #4)
> Feel free to do whatever is needed and/or you think that should be done :)

I'll do it. Thank you for your answer!
Comment 6 junichi11 2017-07-05 23:37:02 UTC
Fixed.

http://hg.netbeans.org/web-main/rev/c06ab7245812

Code Sniffer:
Use --standard=PSR2 instead of --runtime-set default_standard PSR2.

CS-Fixer:
Add a version ComboBox.
If version 2 is selected, just show the option text field.

All analyzers:
Add an "Enabled" checkbox to each customizer panel.


@OwnerOfThisIsle
Could you verify it when it will be available in a development build?

Thanks!
Comment 7 OwnerOfThisIsle 2017-07-06 06:52:46 UTC
I think I could check, when and where can I get a dev build?
Comment 8 junichi11 2017-07-06 07:00:00 UTC
(In reply to OwnerOfThisIsle from comment #7)
> I think I could check, when and where can I get a dev build?

If it is available, a message is added automatically to this issue. Probably, tomorrow or later.

You can download it here[1].

[1] http://bits.netbeans.org/download/trunk/nightly/latest/

Thanks.
Comment 9 junichi11 2017-07-20 22:33:22 UTC
Although a message is not added, probably this is available in a dev version because the new dev version is released.

Thanks.
Comment 10 OwnerOfThisIsle 2017-08-17 09:04:39 UTC
Hi, i tried a nightly and saw the PHPCS Call using the correct param.
Unfortunately I cannot tell much more, cause the nightly was pretty unstable and kept throwing popup Windows at me..
Comment 11 junichi11 2017-08-18 06:18:49 UTC
(In reply to OwnerOfThisIsle from comment #10)
> Hi, i tried a nightly and saw the PHPCS Call using the correct param.

Thanks for your verification!

> Unfortunately I cannot tell much more, cause the nightly was pretty unstable
> and kept throwing popup Windows at me..

Does it mean that Code Analysis features have a problem? It would be nice if you can check your log.
Comment 12 OwnerOfThisIsle 2017-08-18 07:22:21 UTC
I can't tell if the Errors are related:

java.lang.StackOverflowError
	at java.util.HashMap.putVal(HashMap.java:628)
	at java.util.HashMap.put(HashMap.java:611)
	at java.util.HashSet.add(HashSet.java:219)
	at org.netbeans.modules.javascript2.model.api.ModelUtils.resolveTypeFromSemiType(ModelUtils.java:639)
	at org.netbeans.modules.javascript2.model.api.ModelUtils.resolveAssignments(ModelUtils.java:1294)
	at org.netbeans.modules.javascript2.model.api.ModelUtils.resolveAssignments(ModelUtils.java:1262)
	at org.netbeans.modules.javascript2.model.api.ModelUtils.resolveTypes(ModelUtils.java:1215)
	at org.netbeans.modules.javascript2.model.api.ModelUtils.resolveTypes(ModelUtils.java:1232)
	at org.netbeans.modules.javascript2.model.api.ModelUtils.resolveTypes(ModelUtils.java:1232)
	at
... hundred times the last two lines

They occur often (2 per Minute) and look more less the same as above.
Comment 13 junichi11 2017-08-21 06:31:05 UTC
(In reply to OwnerOfThisIsle from comment #12)
> I can't tell if the Errors are related:
> 
> java.lang.StackOverflowError
> 	at java.util.HashMap.putVal(HashMap.java:628)
> 	at java.util.HashMap.put(HashMap.java:611)
> 	at java.util.HashSet.add(HashSet.java:219)
> 	at
> org.netbeans.modules.javascript2.model.api.ModelUtils.
> resolveTypeFromSemiType(ModelUtils.java:639)
> 	at
> org.netbeans.modules.javascript2.model.api.ModelUtils.
> resolveAssignments(ModelUtils.java:1294)
> 	at
> org.netbeans.modules.javascript2.model.api.ModelUtils.
> resolveAssignments(ModelUtils.java:1262)
> 	at
> org.netbeans.modules.javascript2.model.api.ModelUtils.
> resolveTypes(ModelUtils.java:1215)
> 	at
> org.netbeans.modules.javascript2.model.api.ModelUtils.
> resolveTypes(ModelUtils.java:1232)
> 	at
> org.netbeans.modules.javascript2.model.api.ModelUtils.
> resolveTypes(ModelUtils.java:1232)
> 	at
> ... hundred times the last two lines
> 
> They occur often (2 per Minute) and look more less the same as above.

Thank you!
It seems that JavaScript area has a problem. You should report it with detail as a new issue if possible.
Comment 14 crocodile 2017-11-08 08:01:43 UTC
*** Bug 271260 has been marked as a duplicate of this bug. ***