Skip to content

Replace php with python for the new engine #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: image test

IMAGE_NAME ?= codeclimate/codeclimate-sonar-php
IMAGE_NAME ?= codeclimate/codeclimate-sonar-python

image:
docker build --rm -t $(IMAGE_NAME) .
Expand Down
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Code Climate Sonar-PHP Engine
# Code Climate Sonar-Python Engine

[![CircleCI](https://circleci.com/gh/codeclimate/codeclimate-sonar-php.svg?style=svg&circle-token=72a9e9a49dc6a8653be6a69321012fe1d84abc3d)](https://circleci.com/gh/codeclimate/codeclimate-sonar-php)
[![Maintainability](https://api.codeclimate.com/v1/badges/2bdcb2e92bbc0efb855b/maintainability)](https://codeclimate.com/github/codeclimate/codeclimate-sonar-php/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/2bdcb2e92bbc0efb855b/test_coverage)](https://codeclimate.com/github/codeclimate/codeclimate-sonar-php/test_coverage)

`codeclimate-sonar-php` is a Code Climate engine that wraps [Sonarlint](http://www.sonarlint.org) in standalone mode.
`codeclimate-sonar-python` is a Code Climate engine that wraps [Sonarlint](http://www.sonarlint.org) in standalone mode.

## Installation
```
Expand All @@ -22,7 +18,7 @@ make test
2. Configure a `.codeclimate.yml` file in your repo.
```yml
engines:
sonar-php:
sonar-python:
enabled: true
config:
tests_patterns:
Expand All @@ -38,7 +34,7 @@ exclude_paths:
Ignore issues with severity below the minimum:
```
engines:
sonar-php:
sonar-python:
enabled: true
config:
minimum_severity: critical # default: major
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies {
compile("com.github.codeclimate:sonar-wrapper:master-SNAPSHOT")

// Plugins
compile("org.sonarsource.php:sonar-php-plugin:2.10.0.2087")
compile("org.sonarsource.python:sonar-python-plugin:1.8.0.1496")

testCompile("org.assertj:assertj-core:2.8.0")
testCompile("org.skyscreamer:jsonassert:1.5.0")
Expand Down
2 changes: 1 addition & 1 deletion fixtures/app/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"enabled": true,
"include_paths": [
"main.php"
"main.py"
]
}
10 changes: 0 additions & 10 deletions fixtures/app/main.php

This file was deleted.

5 changes: 5 additions & 0 deletions fixtures/app/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class MyClass:
def __enter__(self):
pass
def __exit__(self, exc_type, exc_val): # Noncompliant
pass
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ include 'api'
include 'services:webservice'
*/

rootProject.name = 'codeclimate-sonar-php'
rootProject.name = 'codeclimate-sonar-python'
31 changes: 6 additions & 25 deletions src/test/resources/sanity_check_expected_issues.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
[
{
"type": "issue",
"check_name": "php:S108",
"severity": "major",
"description": "Either remove or fill this block of code.",
"content": {
"body": "<p>Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.</p>\n<h2>Noncompliant Code Example</h2>\n<pre>\nfor ($i = 0; $i &lt; 42; $i++){} // Empty on purpose or missing piece of code ?\n</pre>\n<h2>Exceptions</h2>\n<p>When a block contains a comment, this block is not considered to be empty.</p>"
},
"location": {
"path": "main.php",
"lines": {
"begin": 7,
"end": 8
}
},
"categories": [
"Bug Risk"
]
},
{
"type": "issue",
"check_name": "php:S2014",
"check_name": "python:S2733",
"severity": "blocker",
"description": "Remove this use of \"$this\".",
"description": "Add the missing argument.",
"content": {
"body": "<p><code>$this</code> refers to the current class instance. But static methods can be accessed without instantiating the class, and <code>$this</code>\nis not available to them. Using <code>$this</code> in a static context will result in a fatal error at runtime.</p>\n<h2>Noncompliant Code Example</h2>\n<pre>\nclass Clazz {\n $name=NULL; // instance variable\n\n public static function foo(){\n if ($this-&gt;name != NULL) {\n // ...\n }\n }\n}\n</pre>\n<h2>Compliant Solution</h2>\n<pre>\nclass Clazz {\n $name=NULL; // instance variable\n\n public static function foo($nameParam){\n if ($nameParam != NULL) {\n // ...\n }\n }\n}\n</pre>"
"body": "<p>The <code>__exit__</code> method is invoked with four arguments: self, type, value and traceback. Leave one of these out of the method declaration\nand the result will be a <code>TypeError</code> at runtime.</p>\n<h2>Noncompliant Code Example</h2>\n<pre>\nclass MyClass:\n def __enter__(self):\n pass\n def __exit__(self, exc_type, exc_val): # Noncompliant\n pass\n</pre>"
},
"location": {
"path": "main.php",
"path": "main.py",
"lines": {
"begin": 7,
"end": 7
"begin": 4,
"end": 4
}
},
"categories": [
Expand Down