All Projects → SonarSource → Sonar Php

SonarSource / Sonar Php

Licence: other
🐘 SonarPHP: PHP static analyzer for SonarQube & SonarLint

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Sonar Php

Sonarjs
SonarSource Static Analyzer for JavaScript and TypeScript
Stars: ✭ 696 (+141.67%)
Mutual labels:  static-analysis, sonarqube, static-code-analysis, code-quality
Sonar Dotnet
Code analyzer for C# and VB.NET projects https://redirect.sonarsource.com/plugins/vbnet.html
Stars: ✭ 466 (+61.81%)
Mutual labels:  static-analysis, sonarqube, static-code-analysis, code-quality
codeclimate-duplication
Code Climate engine for code duplication analysis
Stars: ✭ 96 (-66.67%)
Mutual labels:  static-code-analysis, static-analysis, code-quality
Cflint
Static code analysis for CFML (a linter)
Stars: ✭ 156 (-45.83%)
Mutual labels:  static-analysis, static-code-analysis, code-quality
codeclimate-phpcodesniffer
Code Climate Engine for PHP Code Sniffer
Stars: ✭ 27 (-90.62%)
Mutual labels:  static-code-analysis, static-analysis, code-quality
Sonar Jproperties Plugin
SonarQube Java Properties Analyzer
Stars: ✭ 5 (-98.26%)
Mutual labels:  static-analysis, sonarqube, code-quality
Static Analysis
⚙️ A curated list of static analysis (SAST) tools for all programming languages, config files, build tools, and more.
Stars: ✭ 9,310 (+3132.64%)
Mutual labels:  static-analysis, static-code-analysis, code-quality
Codeclimate
Code Climate CLI
Stars: ✭ 2,273 (+689.24%)
Mutual labels:  static-analysis, static-code-analysis, code-quality
Checkstyle
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.
Stars: ✭ 6,481 (+2150.35%)
Mutual labels:  static-analysis, static-code-analysis, code-quality
static-code-analysis-plugin
A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Stars: ✭ 36 (-87.5%)
Mutual labels:  static-code-analysis, static-analysis, code-quality
sonar-css-plugin
SonarQube CSS / SCSS / Less Analyzer
Stars: ✭ 46 (-84.03%)
Mutual labels:  static-analysis, sonarqube, code-quality
codeclimate-eslint
Code Climate Engine for ESLint
Stars: ✭ 86 (-70.14%)
Mutual labels:  static-code-analysis, static-analysis, code-quality
sonarqube-action
Integrate SonarQube scanner to GitHub Actions
Stars: ✭ 90 (-68.75%)
Mutual labels:  static-analysis, sonarqube, code-quality
Sonarts
Static code analyzer for TypeScript
Stars: ✭ 776 (+169.44%)
Mutual labels:  static-analysis, sonarqube, code-quality
sonar-esql-plugin
Sonar plugin to analyze ESQL-sourcecode of IBM Integration Bus projects
Stars: ✭ 26 (-90.97%)
Mutual labels:  static-code-analysis, sonarqube, code-quality
Sonar Java
☕️ SonarSource Static Analyzer for Java Code Quality and Security
Stars: ✭ 745 (+158.68%)
Mutual labels:  static-analysis, sonarqube, static-code-analysis
Infer
A static analyzer for Java, C, C++, and Objective-C
Stars: ✭ 12,823 (+4352.43%)
Mutual labels:  static-analysis, static-code-analysis, code-quality
Sonarqube
Continuous Inspection
Stars: ✭ 6,365 (+2110.07%)
Mutual labels:  static-analysis, sonarqube, code-quality
sonar-gherkin-plugin
SonarQube Cucumber Gherkin Analyzer
Stars: ✭ 33 (-88.54%)
Mutual labels:  static-analysis, sonarqube, code-quality
localhost-sonarqube
Analysing source code locally with SonarQube in a Docker environment.
Stars: ✭ 17 (-94.1%)
Mutual labels:  static-analysis, sonarqube, code-quality

Code Quality and Security for PHP Build Status

This SonarSource project is a static code analyser for PHP language used as an extension for the SonarQube platform. It will allow you to produce stable and easily supported code by helping you find and correct bugs, vulnerabilities and smells in your code.

Features

Useful links

More documentation

Have question or feedback?

To provide feedback (request a feature, report a bug etc.) use the SonarSource Community Forum. Please do not forget to specify the language (PHP!), plugin version and SonarQube version.

If you have a question on how to use plugin (and the docs don't help you), we also encourage you to use the community forum.

Contributing

Topic in SonarSource Community Forum

To request a new feature, please create a new thread in SonarSource Community Forum. Even if you plan to implement it yourself and submit it back to the community, please start a new thread first to be sure that we can follow up on it.

Pull Request (PR)

To submit a contribution, create a pull request for this repository. Please make sure that you follow our code style and all tests are passing (Travis build is created for each PR).

Custom Rules

If you have an idea for a rule but you are not sure that everyone needs it you can implement a custom rule available only for you.

Custom Rules API Changes

  • 3.15 (January 2021)
    • PHPCustomRulesDefinition was removed, it was deprecated since version 2.13 (March 2018)
    • Removed dependency on sslr-squid-bridge which is not maintained anymore
  • 3.11, support of PHP 8:
    • ParameterTree#type() is deprecated. Use ParameterTree#declaredType() instead.
    • ReturnTypeClauseTree#type() is deprecated. Use ReturnTypeClauseTree#declaredType() instead.
    • ClassPropertyDeclarationTree#typeAnnotation() is deprecated. Use ClassPropertyDeclarationTree#declaredType() instead.
    • CatchBlockTree#variable() can now return NULL.
    • FunctionCallTree#arguments() is deprecated. Use FunctionCallTree#callArguments() instead.
    • AnonymousClassTree#arguments() is deprecated. Use AnonymousClassTree#callArguments() instead.
    • New tree: CallArgumentTree. This tree wraps expressions passed as arguments now.
    • New kind of expression: ThrowExpressionTree.
    • New kind of expression: MatchExpressionTree.
    • ParameterTree now has a visibility method.

Testing

To run tests locally follow these instructions.

Build the Project and Run Unit Tests

To build the plugin and run its unit tests, execute this command from the project's root directory (you will need Maven):

mvn clean install

Integration Tests

To run integration tests, you will need to create a properties file like the one shown below, and set its location in an environment variable named ORCHESTRATOR_CONFIG_URL.

# version of SonarQube server
sonar.runtimeVersion=7.9

orchestrator.updateCenterUrl=http://update.sonarsource.org/update-center-dev.properties

Before running any of integration tests make sure the submodules are checked out:

  git submodule init
  git submodule update

Plugin Test

The "Plugin Test" is an additional integration test which verifies plugin features such as metric calculation, coverage etc. To launch it, execute this command from directory its/plugin:

mvn clean install

Ruling Test

The "Ruling Test" is a special integration test which launches the analysis of a large code base, saves the issues created by the plugin in report files, and then compares those results to the set of expected issues (stored as JSON files). To launch ruling test:

cd its/ruling
mvn clean install

This test gives you the opportunity to examine the issues created by each rule and make sure they're what you expect. You can inspect new/lost issues checking web-pages mentioned in the logs at the end of analysis:

INFO  - HTML Issues Report generated: /path/to/project/sonar-php/its/sources/src/.sonar/issues-report/issues-report.html
INFO  - Light HTML Issues Report generated: /path/to/project/sonar-php/its/sources/src/.sonar/issues-report/issues-report-light.html

If everything looks good to you, you can copy the file with the actual issues located at

sonar-php/its/ruling/target/actual/

into the directory with the expected issues

sonar-php/its/ruling/src/test/resources/expected/

License

Copyright 2010-2021 SonarSource.

Licensed under the GNU Lesser General Public License, Version 3.0

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].