Skip to content

Commit 9168291

Browse files
Replace php with python plugin for the new engine (#1)
1 parent 746fb58 commit 9168291

File tree

8 files changed

+19
-47
lines changed

8 files changed

+19
-47
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: image test
22

3-
IMAGE_NAME ?= codeclimate/codeclimate-sonar-php
3+
IMAGE_NAME ?= codeclimate/codeclimate-sonar-python
44

55
image:
66
docker build --rm -t $(IMAGE_NAME) .

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
# Code Climate Sonar-PHP Engine
1+
# Code Climate Sonar-Python Engine
22

3-
[![CircleCI](https://circleci.com/gh/codeclimate/codeclimate-sonar-php.svg?style=svg&circle-token=72a9e9a49dc6a8653be6a69321012fe1d84abc3d)](https://circleci.com/gh/codeclimate/codeclimate-sonar-php)
4-
[![Maintainability](https://api.codeclimate.com/v1/badges/2bdcb2e92bbc0efb855b/maintainability)](https://codeclimate.com/github/codeclimate/codeclimate-sonar-php/maintainability)
5-
[![Test Coverage](https://api.codeclimate.com/v1/badges/2bdcb2e92bbc0efb855b/test_coverage)](https://codeclimate.com/github/codeclimate/codeclimate-sonar-php/test_coverage)
6-
7-
`codeclimate-sonar-php` is a Code Climate engine that wraps [Sonarlint](http://www.sonarlint.org) in standalone mode.
3+
`codeclimate-sonar-python` is a Code Climate engine that wraps [Sonarlint](http://www.sonarlint.org) in standalone mode.
84

95
## Installation
106
```
@@ -22,7 +18,7 @@ make test
2218
2. Configure a `.codeclimate.yml` file in your repo.
2319
```yml
2420
engines:
25-
sonar-php:
21+
sonar-python:
2622
enabled: true
2723
config:
2824
tests_patterns:
@@ -38,7 +34,7 @@ exclude_paths:
3834
Ignore issues with severity below the minimum:
3935
```
4036
engines:
41-
sonar-php:
37+
sonar-python:
4238
enabled: true
4339
config:
4440
minimum_severity: critical # default: major

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies {
3636
compile("com.github.codeclimate:sonar-wrapper:master-SNAPSHOT")
3737

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

4141
testCompile("org.assertj:assertj-core:2.8.0")
4242
testCompile("org.skyscreamer:jsonassert:1.5.0")

fixtures/app/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"enabled": true,
33
"include_paths": [
4-
"main.php"
4+
"main.py"
55
]
66
}

fixtures/app/main.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

fixtures/app/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class MyClass:
2+
def __enter__(self):
3+
pass
4+
def __exit__(self, exc_type, exc_val): # Noncompliant
5+
pass

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ include 'api'
1515
include 'services:webservice'
1616
*/
1717

18-
rootProject.name = 'codeclimate-sonar-php'
18+
rootProject.name = 'codeclimate-sonar-python'

src/test/resources/sanity_check_expected_issues.json

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,17 @@
11
[
22
{
33
"type": "issue",
4-
"check_name": "php:S108",
5-
"severity": "major",
6-
"description": "Either remove or fill this block of code.",
7-
"content": {
8-
"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>"
9-
},
10-
"location": {
11-
"path": "main.php",
12-
"lines": {
13-
"begin": 7,
14-
"end": 8
15-
}
16-
},
17-
"categories": [
18-
"Bug Risk"
19-
]
20-
},
21-
{
22-
"type": "issue",
23-
"check_name": "php:S2014",
4+
"check_name": "python:S2733",
245
"severity": "blocker",
25-
"description": "Remove this use of \"$this\".",
6+
"description": "Add the missing argument.",
267
"content": {
27-
"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>"
8+
"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>"
289
},
2910
"location": {
30-
"path": "main.php",
11+
"path": "main.py",
3112
"lines": {
32-
"begin": 7,
33-
"end": 7
13+
"begin": 4,
14+
"end": 4
3415
}
3516
},
3617
"categories": [

0 commit comments

Comments
 (0)