Skip to content
This repository was archived by the owner on Oct 22, 2019. It is now read-only.

Commit f4c614c

Browse files
martinssipenkoNoelDavies
authored andcommitted
Add code style check into CI pipeline (#21)
Added CI using CircleCI
1 parent 4668eeb commit f4c614c

30 files changed

Lines changed: 52 additions & 33 deletions

.circleci/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ unit-config: &unit-config
5151
name: Wait for backing services to start
5252
command: dockerize -wait tcp://127.0.0.1:6379 -timeout 30s
5353

54+
- run:
55+
name: Run PHP Code Sniffer
56+
command: ./vendor/bin/phpcs
57+
5458
- run:
5559
name: Run tests
5660
command: ./vendor/bin/phpunit

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
"require": {
1616
"php": "^7.3",
1717
"ext-json": "*",
18-
"guzzlehttp/guzzle": "^6.2",
18+
"guzzlehttp/guzzle": "^6.3",
1919
"symfony/polyfill-apcu": "^1.6"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "^7.5"
22+
"phpunit/phpunit": "^7.5",
23+
"squizlabs/php_codesniffer": "^3.5"
2324
},
2425
"suggest": {
2526
"ext-redis": "Required if using Redis.",

examples/flush_adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
} elseif ($adapter === 'in-memory') {
1515
$inMemoryAdapter = new Prometheus\Storage\InMemory();
1616
$inMemoryAdapter->flushMemory();
17-
}
17+
}

examples/pushgateway.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
$counter->incBy(6, ['blue']);
2323

2424
$pushGateway = new PushGateway('192.168.59.100:9091');
25-
$pushGateway->push($registry, 'my_job', ['instance'=>'foo']);
25+
$pushGateway->push($registry, 'my_job', ['instance' => 'foo']);

examples/some_gauge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Prometheus\Storage\Redis;
77

88

9-
error_log('c='. $_GET['c']);
9+
error_log('c=' . $_GET['c']);
1010

1111
$adapter = $_GET['adapter'];
1212

examples/some_histogram.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Prometheus\CollectorRegistry;
66
use Prometheus\Storage\Redis;
77

8-
error_log('c='. $_GET['c']);
8+
error_log('c=' . $_GET['c']);
99

1010
$adapter = $_GET['adapter'];
1111

phpcs.xml.dist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PHP_CodeSniffer">
3+
<file>src/</file>
4+
<file>tests/</file>
5+
<file>examples/</file>
6+
7+
<exclude-pattern type="relative">vendor/*</exclude-pattern>
8+
9+
<arg value="nps"/>
10+
11+
<rule ref="PSR12"/>
12+
</ruleset>

src/Prometheus/Collector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Prometheus;
@@ -57,7 +58,7 @@ public function __construct(Adapter $storageAdapter, $namespace, $name, $help, $
5758
/**
5859
* @return string
5960
*/
60-
public abstract function getType();
61+
abstract public function getType();
6162

6263
/**
6364
* @return string

src/Prometheus/CollectorRegistry.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Prometheus;

src/Prometheus/Counter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
2-
declare(strict_types = 1);
2+
3+
declare(strict_types=1);
34

45
namespace Prometheus;
56

0 commit comments

Comments
 (0)