overtrue / phplint

:bug: A tool that can speed up linting of php files by running several lint processes at once.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"no configuration file is found" message without --no-configuration flag

leonelectro opened this issue · comments

New Issue

As of 9.0.2, runs without .phplint.yml fail with File ".phplint.yml" does not exist. unless the --no-configuration flag is added.

Diagnose

Output of `composer show` command
amphp/amp                             v2.6.2    A non-blocking concurrency framework for PHP applications.
amphp/byte-stream                     v1.8.1    A stream abstraction to make working with non-blocking I/O simple.
composer/package-versions-deprecated  1.11.99.5 Composer plugin that provides efficient querying for installed package versions (no runtime IO)
composer/pcre                         1.0.1     PCRE wrapping library that offers type-safe preg_* replacements.
composer/semver                       3.3.2     Semver library that offers utilities, version constraint parsing and validation.
composer/xdebug-handler               2.0.5     Restarts a process without Xdebug.
dnoegel/php-xdg-base-dir              v0.1.1    implementation of xdg base directory specification for php
doctrine/annotations                  1.14.3    Docblock Annotations Parser
doctrine/deprecations                 v1.0.0    A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or sele...
doctrine/instantiator                 2.0.0     A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                        2.1.0     PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
felixfbecker/advanced-json-rpc        v3.2.1    A more advanced JSONRPC implementation
felixfbecker/language-server-protocol v1.5.2    PHP classes for the Language Server Protocol
friendsofphp/php-cs-fixer             v2.19.3   A tool to automatically fix PHP code style
myclabs/deep-copy                     1.11.0    Create deep copies (clones) of your objects
netresearch/jsonmapper                v4.1.0    Map nested JSON structures onto PHP classes
nikic/php-parser                      v4.15.3   A PHP parser written in PHP
openlss/lib-array2xml                 1.0.0     Array2XML conversion library credit to lalit.org
overtrue/phplint                      9.0.2     `phplint` is a tool that can speed up linting of php files by running several lint processes at once.
phar-io/manifest                      2.0.3     Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                       3.2.1     Library for handling version information and constraints
php-cs-fixer/diff                     v1.3.1    sebastian/diff v2 backport support for PHP5.6
phpdocumentor/reflection-common       2.2.0     Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock     5.3.0     With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is...
phpdocumentor/type-resolver           1.6.2     A PSR-5 based resolver of Class names, Types and Structural Element Names
phpstan/phpstan                       1.9.17    PHPStan - PHP Static Analysis Tool
phpunit/php-code-coverage             9.2.24    Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator             3.0.6     FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                   3.1.1     Invoke callables with a timeout
phpunit/php-text-template             2.0.4     Simple template engine.
phpunit/php-timer                     5.0.3     Utility class for timing
phpunit/phpunit                       9.6.3     The PHP Unit Testing framework.
psr/cache                             3.0.0     Common interface for caching libraries
psr/container                         2.0.2     Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                  1.0.0     Standard interfaces for event handling.
psr/log                               2.0.0     Common interface for logging libraries
sebastian/cli-parser                  1.0.1     Library for parsing CLI options
sebastian/code-unit                   1.0.8     Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup    2.0.3     Looks up which function or method a line of code belongs to
sebastian/comparator                  4.0.8     Provides the functionality to compare PHP values for equality
sebastian/complexity                  2.0.2     Library for calculating the complexity of PHP code units
sebastian/diff                        4.0.4     Diff implementation
sebastian/environment                 5.1.5     Provides functionality to handle HHVM/PHP environments
sebastian/exporter                    4.0.5     Provides the functionality to export PHP variables for visualization
sebastian/global-state                5.0.5     Snapshotting of global state
sebastian/lines-of-code               1.0.3     Library for counting the lines of code in PHP source code
sebastian/object-enumerator           4.0.4     Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector            2.0.4     Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context           4.0.5     Provides functionality to recursively process PHP variables
sebastian/resource-operations         3.0.3     Provides a list of PHP built-in functions that operate on resources
sebastian/type                        3.2.1     Collection of value objects that represent the types of the PHP type system
sebastian/version                     3.0.2     Library that helps with managing the version number of Git-hosted PHP projects
symfony/cache                         v6.2.5    Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts               v3.2.0    Generic abstractions related to caching
symfony/console                       v5.4.19   Eases the creation of beautiful and testable command line interfaces
symfony/deprecation-contracts         v3.2.0    A generic function and convention to trigger deprecation notices
symfony/event-dispatcher              v5.4.19   Provides tools that allow your application components to communicate with each other by dispatching events and listening t...
symfony/event-dispatcher-contracts    v3.2.0    Generic abstractions related to dispatching event
symfony/filesystem                    v5.4.19   Provides basic utilities for the filesystem
symfony/finder                        v5.4.19   Finds files and directories via an intuitive fluent interface
symfony/options-resolver              v5.4.19   Provides an improved replacement for the array_replace PHP function
symfony/polyfill-ctype                v1.27.0   Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme        v1.27.0   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer      v1.27.0   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring             v1.27.0   Symfony polyfill for the Mbstring extension
symfony/polyfill-php70                v1.20.0   Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-php72                v1.27.0   Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73                v1.27.0   Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80                v1.27.0   Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process                       v5.4.19   Executes commands in sub-processes
symfony/service-contracts             v3.2.0    Generic abstractions related to writing services
symfony/stopwatch                     v5.4.19   Provides a way to profile code
symfony/string                        v6.2.5    Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/var-exporter                  v6.2.5    Allows exporting any serializable PHP data structure to plain PHP code
symfony/yaml                          v6.2.5    Loads and dumps YAML files
theseer/tokenizer                     1.2.1     A small library for converting tokenized PHP source code into XML and potentially other formats
vimeo/psalm                           4.30.0    A static analysis tool for finding errors in PHP applications
webmozart/assert                      1.11.0    Assertions to validate method input/output with nice error messages.
webmozart/path-util                   2.3.0     A robust cross-platform utility for normalizing, comparing and modifying file paths.

Summary

The docs say "If no configuration file is found, PHPLint will proceed with the default settings." This was true until 9.0.2.

We're using composer and running with $PHPLINT --warning -- ./tests ../../wp-content/plugins ../../wp-content/themes. Adding --no-configuration resolves the issue.

Expected behaviour

Runs work without a config file and without the --no-configuration flag.

Actual behaviour

$ vendor/bin/phplint ./tests/

In Parser.php line 53:
                                       
  File ".phplint.yml" does not exist.  
                                       

lint [--exclude EXCLUDE] [--extensions EXTENSIONS] [-j|--jobs JOBS] [-c|--configuration CONFIGURATION] [--no-configuration] [--cache CACHE] [--no-cache] [-p|--progress PROGRESS] [--no-progress] [--log-json [LOG-JSON]] [--log-junit [LOG-JUNIT]] [-w|--warning] [--memory-limit MEMORY-LIMIT] [--ignore-exit-code] [--] [<path>...]
 vendor/bin/phplint --no-configuration ./tests/
phplint 9.0.1 by overtrue and contributors.

Runtime       : PHP 8.1.7-1ubuntu3.2
Configuration : No config file loaded


Time: < 1 sec, Memory: 4.0 MiB, Cache: 24 hits, 0 miss

                                                                                                                        
 [OK] 24 files                                                                                                          

Also seeing the same issue in our GitHub Action output!

Easy fix, will do tomorrow !
@leonelectro Thanks for reporting.

Finally fix is already available on main branch, if you want to give it a try. Release tomorrow !

Confirmed as fixed for me. Thanks!

Version 9.0.3 has just been released