Skip to content

9.8 | The new linter #239

Description

@llaville

With the new API (that I've tried to avoid the most of possible BC breaks), the new linter will provide a lint command as follow :

Description:
  Files syntax check only

Usage:
  lint [options] [--] [<path>...]

Arguments:
  path                               Path to file or directory to lint [default: ["."]]

Options:
      --exclude=EXCLUDE              Path to file or directory to exclude from linting (multiple values allowed)
      --output-format=OUTPUT-FORMAT  Format of requested reports (multiple values allowed)
  -o, --output-file=OUTPUT-FILE      Generate an output to the specified path (default: standard output)
  -h, --help                         Display help for the given command. When no command is given display help for the list command
      --silent                       Do not output any message
  -q, --quiet                        Only errors are displayed. All other output is suppressed
  -V, --version                      Display this application version
      --ansi|--no-ansi               Force (or disable --no-ansi) ANSI output
  -n, --no-interaction               Do not ask any interactive question
  -b, --bootstrap=BOOTSTRAP          PHP script that is included before the application run
  -x, --extensions=EXTENSIONS        Allows to change/extend features easily with one or more extensions (multiple values allowed)
  -c, --configuration=CONFIGURATION  Path to configuration file [default: ".phplint.yml"]
      --no-configuration             Ignore default configuration file (Deprecated option, use "--configuration never" instead)
  -e, --env=ENV                      The Environment name [default: "dev"]
  -v|vv|vvv, --verbose               Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Here are major changes :

  1. The configuration system that you will be able to interact via the unique --configuration flag (possible values are auto, always, never, or a path to the project config file to keep BC with previous version 9.7.x)

  2. The OutputManager that is loaded by default when running PHPLint on CLI (SAPI) and provide two new flags : --output-file and output-format (to avoid conflict with --format of the Symfony Console Help subsystem)

Tip

The OutputManager print results, as before, on standard ouput (easy reading for human), but you can also disable this extension by specify the PHPLINT_FRONTEND=noninteractive env var.
Running echo $? will give you the exit code without displaying any other output. The same behavior, as we run lint command with the --quiet flag
0 means all source files scanned are syntaxically correct
1means at least one file are invalid.

  1. The new extension system -x | --extensions will allows to load additional extension/plugin on fly : use with the ProgressManager, the DiagnoseManager, the OutputManager, the CacheManager, the ProfileManager, .... and your own extension implemented by yourself !

Main GOAL

Reduce as much as possible vendor dependencies and features that you don't want to have, to speed up your scan !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions