All Projects → overtrue → Phplint

overtrue / Phplint

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

Projects that are alternatives of or similar to Phplint

gandalf-lint
Bad Code Shall Not Pass
Stars: ✭ 29 (-95.51%)
Mutual labels:  lint, linter
Linter
Linter for Dart.
Stars: ✭ 372 (-42.41%)
Mutual labels:  linter, lint
Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (+602.94%)
Mutual labels:  linter, lint
Format.cmake
💅 Stylize your code! Automatic clang-format and cmake-format targets for CMake.
Stars: ✭ 94 (-85.45%)
Mutual labels:  lint, linter
Checkmake
experimental linter/analyzer for Makefiles
Stars: ✭ 420 (-34.98%)
Mutual labels:  linter, lint
selective
Statically find HTML anti patterns using CSS Selectors
Stars: ✭ 15 (-97.68%)
Mutual labels:  lint, linter
Detekt
Static code analysis for Kotlin
Stars: ✭ 4,169 (+545.36%)
Mutual labels:  linter, lint
pahout
A pair programming partner for writing better PHP. Pahout means PHP mahout 🐘
Stars: ✭ 43 (-93.34%)
Mutual labels:  lint, linter
Lockfile Lint
Lint an npm or yarn lockfile to analyze and detect security issues
Stars: ✭ 411 (-36.38%)
Mutual labels:  linter, lint
Gitlint
Linting for your git commit messages
Stars: ✭ 404 (-37.46%)
Mutual labels:  linter, lint
JSONCustomLintr
Library to allow creation, running, and reporting of custom lint rules for JSON files
Stars: ✭ 19 (-97.06%)
Mutual labels:  lint, linter
Gradle Lint Plugin
A pluggable and configurable linter tool for identifying and reporting on patterns of misuse or deprecations in Gradle scripts.
Stars: ✭ 473 (-26.78%)
Mutual labels:  linter, lint
eslint-config
An ESLint shareable config that I used in my projects
Stars: ✭ 15 (-97.68%)
Mutual labels:  lint, linter
elint
A easy way to lint your code
Stars: ✭ 38 (-94.12%)
Mutual labels:  lint, linter
ue5-style-guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,892 (+347.68%)
Mutual labels:  lint, linter
Exakat
The Exakat Engine : smart static analysis for PHP
Stars: ✭ 346 (-46.44%)
Mutual labels:  linter, lint
flake8-broken-line
🚨 Flake8 plugin to forbid backslashes (\) for line breaks
Stars: ✭ 85 (-86.84%)
Mutual labels:  lint, linter
cpplint
Static code checker for C++
Stars: ✭ 1,014 (+56.97%)
Mutual labels:  lint, linter
Awesome Lint
Linter for Awesome lists
Stars: ✭ 385 (-40.4%)
Mutual labels:  linter, lint
Ktlint
An anti-bikeshedding Kotlin linter with built-in formatter
Stars: ✭ 4,629 (+616.56%)
Mutual labels:  linter, lint

PHPLint

`phplint` is a tool that can speed up linting of php files by running several lint processes at once.

artboard 1

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality FOSSA Status

Installation

Locally, if you have PHP

$ composer require overtrue/phplint --dev -vvv

Locally, if you only have Docker

docker pull overtrue/phplint:latest

Usage

CLI

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

Arguments:
  path                               Path to file or directory to lint.

Options:
      --exclude=EXCLUDE              Path to file or directory to exclude from linting (multiple values allowed)
      --extensions=EXTENSIONS        Check only files with selected extensions (default: php)
  -j, --jobs=JOBS                    Number of parallel jobs to run (default: 5)
  -c, --configuration=CONFIGURATION  Read configuration from config file (default: ./.phplint.yml).
      --no-configuration             Ignore default configuration file (default: ./.phplint.yml).
      --no-cache                     Ignore cached data.
      --cache=CACHE                  Path to the cache file.
      --json[=JSON]                  Output JSON results to a file.
      --xml[=XML]                    Output JUnit XML results to a file.
  -w, --warning                      Also show warnings
  -h, --help                         Display this help message
  -q, --quiet                        Do not output any message
  -V, --version                      Display this application version
      --ansi                         Force ANSI output
      --no-ansi                      Disable ANSI output
  -n, --no-interaction               Do not ask any interactive question
  -v|vv|vvv, --verbose               Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
 Lint something

example:

$ ./vendor/bin/phplint ./ --exclude=vendor

You can also define configuration as a file .phplint.yml:

path: ./
jobs: 10
cache: build/phplint.cache
extensions:
  - php
exclude:
  - vendor
warning: false
$ ./vendor/bin/phplint

By default, the command will read configuration from file .phplint.yml of path specified, you can custom the filename by option: --configuration=FILENAME or -c FILENAME;

If you want to disable the config file, you can add option --no-configuration.

Warnings

Not all linting problems are errors, PHP also has warnings, for example when using a continue statement within a switch case. By default these errors are not reported, but you can turn this on with the warning cli flag, or by setting the warning to true in the configuration.

Program

use Overtrue\PHPLint\Linter;

$path = __DIR__ .'/app';
$exclude = ['vendor'];
$extensions = ['php'];
$warnings = true;

$linter = new Linter($path, $exclude, $extensions, $warnings);

// get errors
$errors = $linter->lint();

//
// [
//    '/path/to/foo.php' => [
//          'error' => "unexpected '$key' (T_VARIABLE)",
//          'line' => 168,
//          'file' => '/path/to/foo.php',
//      ],
//    '/path/to/bar.php' => [
//          'error' => "unexpected 'class' (T_CLASS), expecting ',' or ';'",
//          'line' => 28,
//          'file' => '/path/to/bar.php',
//      ],
// ]

GitHub Actions

uses: overtrue/[email protected]
with:
  path: .
  options: --exclude=*.log

Other CI/CD (f.e. Bitbucket Pipelines, GitLab CI)

Run this command using overtrue/phplint:latest Docker image:

/root/.composer/vendor/bin/phplint ./ --exclude=vendor

PHP 扩展包开发

想知道如何从零开始构建 PHP 扩展包?

请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— 《PHP 扩展包实战教程 - 从入门到发布》

License

MIT

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].