Code Monkey home page Code Monkey logo

sublimelinter-contrib-phpstan's People

Contributors

braver avatar dartui avatar gltgrzegorz avatar kaste avatar rockstar04 avatar tikki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sublimelinter-contrib-phpstan's Issues

PhpStan(erred) on Notice

Hi!

So apparently, when phpstan is using a phpstan.neon file it outputs this:

SublimeLinter: WARNING: phpstan output:
Note: Using configuration file [...]/docroot/phpstan.neon.

Which is picked up as a warning for some reason. It shouldn't.

For the record. There is no other error / notice in the log regarding to phpstan. So I'm guessing it doesn't wait for any kind of output in case everything is okay.

Message in statusbar phpstan(erred)

First, thank you for making this :)
but I have a problem of getting it to work

Sublime Linter v4.6.6
Sublime Linter Stan v0.2.0

Installed PhpStan globaly, and added the path /home/predrag/.config/composer/vendor/bin to Sublime linter paths settings.

I have a do.php file, with this content:

<?php 

hello();

I expect to show a errors count or error message in the panel.
But nothing is shown except phpstan(erred) and when I open the panel it says `No lint results.

Enabled debuging in Sublime linter, and here is the log:

SublimeLinter: linter.py:887: Checking lint mode background vs lint reason on_load
SublimeLinter: #1 linter.py:907: 'phpstan' is linting 'do.php'
SublimeLinter: #1 util.py:142: PATH:
    /home/predrag/.config/composer/vendor/bin
    /home/predrag/.npm-global/bin
    /usr/local/sbin
    /usr/local/bin
    /usr/sbin
    /usr/bin
    /sbin
    /bin
    /usr/games
    /usr/local/games
SublimeLinter: #1 linter.py:1263: Running ...

  /home/predrag/Sites/forum  (working dir)
  $ /home/predrag/.config/composer/vendor/bin/phpstan analyse --errorFormat=raw --no-progress --autoload-file /home/predrag/Sites/forum/do.php --level max /home/predrag/Sites/forum/do.php

SublimeLinter: #1 linter.py:589: WARNING: phpstan output:
PHP Fatal error:  Uncaught Error: Call to undefined function hello() in /home/predrag/Sites/forum/do.php:3
Stack trace:
#0 phar:///home/predrag/.config/composer/vendor/phpstan/phpstan-shim/phpstan.phar/src/Command/AnalyseCommand.php(63): require_once()
#1 phar:///home/predrag/.config/composer/vendor/phpstan/phpstan-shim/phpstan.phar/vendor/symfony/console/Command/Command.php(241): PHPStan\Command\AnalyseCommand->execute(Object(PHPStanVendor\Symfony\Component\Console\Input\ArgvInput), Object(PHPStanVendor\Symfony\Component\Console\Output\ConsoleOutput))
#2 phar:///home/predrag/.config/composer/vendor/phpstan/phpstan-shim/phpstan.phar/vendor/symfony/console/Application.php(905): PHPStanVendor\Symfony\Component\Console\Command\Command->run(Object(PHPStanVendor\Symfony\Component\Console\Input\ArgvInput), Object(PHPStanVendor\Symfony\Component\Console\Output\ConsoleOutput))
#3 phar:///home/predrag/.config/composer/vendor/phpstan/phpstan-shim/phpstan.phar/vendor/symfony/console/Application.php(207): PHPStanVendor\Symfony\Component\C in /home/predrag/Sites/forum/do.php on line 3

SublimeLinter: #1 linter.py:591: Note: above warning will become an error in the future. Implement `on_stderr` if you think this is wrong.
SublimeLinter: sublime_linter.py:444: Linting buffer 25 took 0.23s

Forced maximum analysis level

It seems that this plugin currently forces the maximum analysis level unless SublimeLinter.linters.phpstan.level is configured in Sublime Text.

This leads to us having to maintain and sync this level in both phpstan.neon (which we use to configure PHPStan in our projects) as well as the Sublime Text project file (so we would have consistent analysis both in Sublime Text and in other environments such as manually running PHPStan in the shell, or more importantly, CI environments).

Could you remove this default and just let PHPStan use its own default if no value is otherwise configured? If the default level needs to be defined for some reason, do you have any suggestions on how we can force the level defined in phpstan.neon to take precedence?

Invalid argument on phpstan

SublimeLinter: #6 linter.py:677       WARNING: phpstan output:

                                              
  The "--errorFormat" option does not exist.  
                                              

analyse [--paths-file PATHS-FILE] [-c|--configuration CONFIGURATION] [-l|--level LEVEL] [--no-progress] [--debug] [-a|--autoload-file AUTOLOAD-FILE] [--error-format ERROR-FORMAT] [--memory-limit MEMORY-LIMIT] [--] [<paths>...]

Should be --error-format not --errorFormat

Code Execution

This plugin seems dangerous in that it is specifying the file being analysed as the autoload file as well. phpstan will execute the autoload file which isn't expected from a static analysis tool and could be very dangerous for scripts with side effects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.