Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit 8c45557

Browse files
Merge pull request #6 from Lendable/ci
CI improvements
2 parents 0ffe5e2 + be33472 commit 8c45557

13 files changed

Lines changed: 240 additions & 54 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
bin/
12
vendor/
23
composer.lock

.php_cs

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?php
2+
3+
$finder = \PhpCsFixer\Finder::create()
4+
->in(__DIR__.'/src')
5+
->in(__DIR__.'/tests');
6+
7+
return \PhpCsFixer\Config::create()
8+
->setRules(
9+
[
10+
'@PSR2' => true,
11+
'@PHP56Migration' => true,
12+
'@PHP70Migration' => true,
13+
'@PHP71Migration' => true,
14+
'@DoctrineAnnotation' => true,
15+
'array_syntax' => ['syntax' => 'short'],
16+
'binary_operator_spaces' => true,
17+
'blank_line_after_opening_tag' => true,
18+
'blank_line_before_return' => true,
19+
'blank_line_before_statement' => true,
20+
'cast_spaces' => ['space' => 'single'],
21+
'combine_consecutive_issets' => true,
22+
'combine_consecutive_unsets' => true,
23+
'concat_space' => ['spacing' => 'none'],
24+
'declare_equal_normalize' => ['space' => 'none'],
25+
'function_typehint_space' => true,
26+
'include' => true,
27+
'linebreak_after_opening_tag' => true,
28+
'list_syntax' => ['syntax' => 'long'],
29+
'lowercase_cast' => true,
30+
'magic_constant_casing' => true,
31+
'mb_str_functions' => false,
32+
'method_chaining_indentation' => true,
33+
'method_separation' => true,
34+
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
35+
'native_function_casing' => true,
36+
'new_with_braces' => true,
37+
'no_blank_lines_after_class_opening' => true,
38+
'no_blank_lines_after_phpdoc' => true,
39+
'no_empty_comment' => true,
40+
'no_empty_phpdoc' => true,
41+
'no_empty_statement' => true,
42+
'no_leading_import_slash' => true,
43+
'no_mixed_echo_print' => ['use' => 'echo'],
44+
'no_multiline_whitespace_around_double_arrow' => true,
45+
'no_multiline_whitespace_before_semicolons' => true,
46+
'no_null_property_initialization' => true,
47+
'no_short_bool_cast' => true,
48+
'no_singleline_whitespace_before_semicolons' => true,
49+
'no_spaces_after_function_name' => true,
50+
'no_spaces_around_offset' => true,
51+
'no_spaces_inside_parenthesis' => true,
52+
'no_superfluous_elseif' => true,
53+
'no_trailing_comma_in_list_call' => true,
54+
'no_trailing_comma_in_singleline_array' => true,
55+
'no_unneeded_control_parentheses' => true,
56+
'no_unneeded_curly_braces' => true,
57+
'no_unneeded_final_method' => true,
58+
'no_unreachable_default_argument_value' => false,
59+
'no_unused_imports' => true,
60+
'no_useless_else' => true,
61+
'no_useless_return' => true,
62+
'no_whitespace_before_comma_in_array' => true,
63+
'no_whitespace_in_blank_line' => true,
64+
'non_printable_character' => false,
65+
'object_operator_without_whitespace' => true,
66+
'phpdoc_no_access' => true,
67+
'phpdoc_no_empty_return' => true,
68+
'phpdoc_no_package' => true,
69+
'phpdoc_no_useless_inheritdoc' => true,
70+
'phpdoc_return_self_reference' => true,
71+
'phpdoc_scalar' => true,
72+
'phpdoc_single_line_var_spacing' => true,
73+
'phpdoc_to_comment' => true,
74+
'phpdoc_types' => true,
75+
'phpdoc_var_without_name' => true,
76+
'increment_style' => ['style' => 'post'],
77+
'return_type_declaration' => true,
78+
'semicolon_after_instruction' => true,
79+
'short_scalar_cast' => true,
80+
'silenced_deprecation_error' => false,
81+
'single_blank_line_before_namespace' => true,
82+
'single_line_comment_style' => false,
83+
'single_quote' => true,
84+
'space_after_semicolon' => true,
85+
'standardize_not_equals' => true,
86+
'strict_comparison' => false,
87+
'strict_param' => false,
88+
'ternary_operator_spaces' => true,
89+
'trim_array_spaces' => true,
90+
'unary_operator_spaces' => true,
91+
'void_return' => false,
92+
'whitespace_after_comma_in_array' => true,
93+
]
94+
)
95+
->setRiskyAllowed(false)
96+
->setUsingCache(false)
97+
->setIndent(" ")
98+
->setLineEnding("\n")
99+
->setFinder($finder);

.travis.yml

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,73 @@ php:
1212
- nightly
1313

1414
env:
15-
- DEPENDENCIES=no
16-
- DEPENDENCIES=beta
17-
- DEPENDENCIES=low
18-
- SYMFONY_VERSION=2.7.*
19-
- SYMFONY_VERSION=2.8.*
20-
- SYMFONY_VERSION=3.0.*
21-
- SYMFONY_VERSION=3.1.*
22-
- SYMFONY_VERSION=3.2.*
23-
- SYMFONY_VERSION=3.3.*
24-
- SYMFONY_VERSION=3.4.*
25-
- SYMFONY_VERSION=4.0.*
15+
global:
16+
- LATEST_PHP_VERSION="7.2"
17+
matrix:
18+
- DEPENDENCIES="beta"
19+
- DEPENDENCIES="low"
20+
- DEPENDENCIES="stable"
21+
- SYMFONY_VERSION="2.8.*"
22+
- SYMFONY_VERSION="3.0.*"
23+
- SYMFONY_VERSION="3.1.*"
24+
- SYMFONY_VERSION="3.2.*"
25+
- SYMFONY_VERSION="3.3.*"
26+
- SYMFONY_VERSION="3.4.*"
27+
- SYMFONY_VERSION="4.0.*"
28+
- SYMFONY_VERSION="4.1.*"
29+
- SYMFONY_VERSION="dev-master"
2630

2731
matrix:
32+
fast_finish: true
2833
allow_failures:
2934
- php: nightly
30-
- env: DEPENDENCIES=beta
31-
- env: DEPENDENCIES=low
35+
- env: DEPENDENCIES="beta"
36+
- env: DEPENDENCIES="low"
37+
- env: SYMFONY_VERSION="dev-master"
38+
3239

3340
before_install:
34-
- composer self-update
35-
# Set composer minimum-stability configuration filter to beta versions
36-
- if [ "$DEPENDENCIES" = "beta" ]; then perl -pi -e 's/^}$/,"minimum-stability":"beta"}/' composer.json; fi;
37-
# Disable xdebug, there is no use of it being enabled
38-
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
39-
# Prevent Travis throwing an out of memory error
4041
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
41-
# Test if we have a token for github as the project may hit the 60 rph limit
42-
- if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
42+
- if [ -n "$GH_TOKEN" ]; then
43+
composer config github-oauth.github.com ${GH_TOKEN};
44+
fi;
45+
- mkdir -p build/logs
4346

4447
install:
45-
- if [ "$DEPENDENCIES" = "low" ]; then composer --prefer-lowest --prefer-stable update; else composer update; fi;
48+
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
49+
composer remove friendsofphp/php-cs-fixer phpstan/phpstan --dev;
50+
fi
51+
- if [ "$DEPENDENCIES" = "beta" ]; then
52+
composer config minimum-stability beta;
53+
composer update -n --prefer-dist;
54+
elif [ "$DEPENDENCIES" = "low" ]; then
55+
composer update -n --prefer-dist --prefer-lowest;
56+
else
57+
composer update -n --prefer-dist;
58+
fi;
4659

4760
script:
48-
- composer validate-files
61+
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
62+
echo "File validation is skipped for older PHP versions";
63+
else
64+
composer validate-files;
65+
fi;
66+
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
67+
echo "Static analysis is skipped for older PHP versions";
68+
else
69+
composer run-static-analysis;
70+
fi;
71+
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
72+
echo "Code style check is skipped for older PHP versions";
73+
else
74+
composer check-code-style;
75+
fi;
76+
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
77+
echo "Security check is skipped for older PHP versions";
78+
else
79+
composer check-security;
80+
fi;
81+
- composer run-tests-with-clover
82+
83+
after_script:
84+
- bin/php-coveralls -v

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
[![Build Status](https://api.travis-ci.org/Lendable/VisitorTrackingBundle.svg)](https://travis-ci.org/Lendable/VisitorTrackingBundle)
1+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Lendable/VisitorTrackingBundle/badges/quality-score.png)](https://scrutinizer-ci.com/g/Lendable/VisitorTrackingBundle/?branch=master)
2+
[![Build Status](https://api.travis-ci.org/Lendable/VisitorTrackingBundle.svg?branch=master)](https://www.travis-ci.org/Lendable/VisitorTrackingBundle)
3+
[![Coverage Status](https://coveralls.io/repos/github/raml-org/raml-php-parser/badge.svg?branch=master)](https://coveralls.io/github/raml-org/raml-php-parser?branch=master)
4+
[![Latest Stable Version](https://poser.pugx.org/lendable/visitor-tracking-bundle/version)](https://packagist.org/packages/lendable/visitor-tracking-bundle)
5+
[![Total Downloads](https://poser.pugx.org/lendable/visitor-tracking-bundle/downloads)](https://packagist.org/packages/lendable/visitor-tracking-bundle)
26

37
Visitor Tracking Bundle
48
=======================

composer.json

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,78 @@
66
"tracking",
77
"Symfony2"
88
],
9-
"homepage": "https://github.com/Lendable/VisitorTrackingBundle.git",
9+
"homepage": "https://github.com/Lendable/VisitorTrackingBundle",
1010
"license": "MIT",
11+
1112
"authors": [
1213
{
1314
"name": "The Lendable Team",
1415
"email": "contact@lendable.co.uk"
1516
}
1617
],
18+
19+
"autoload": {
20+
"psr-4": {
21+
"Alpha\\VisitorTrackingBundle\\": "src/"
22+
}
23+
},
24+
"autoload-dev": {
25+
"psr-4": {
26+
"Alpha\\VisitorTrackingBundle\\Tests\\": "tests/"
27+
}
28+
},
29+
1730
"require": {
1831
"php": ">=7.1",
19-
"symfony/framework-bundle": "^3.3",
2032
"doctrine/doctrine-bundle": "~1.6",
2133
"doctrine/orm": "~2.1",
2234
"stof/doctrine-extensions-bundle": "*",
23-
"symfony/security-bundle": "^3.3"
35+
"symfony/framework-bundle": "^3.3|^4.0",
36+
"symfony/security-bundle": "^3.3|^4.0"
2437
},
2538
"require-dev": {
39+
"behat/behat": "^3.4",
40+
"behat/mink-extension": "^2.3",
41+
"behat/symfony2-extension": "^2.1",
2642
"friendsofphp/php-cs-fixer": "*",
2743
"jakub-onderka/php-parallel-lint": "^1.0",
28-
"phpunit/phpunit": "^5.6",
29-
"roave/security-advisories": "dev-master",
44+
"phpstan/phpstan": "^0.10.2",
45+
"phpunit/phpunit": "^5.7",
46+
"satooshi/php-coveralls": "^2.0",
47+
"sensiolabs/security-checker": "^4.1",
3048
"symfony/phpunit-bridge": "^3.0|^4.0"
3149
},
32-
"autoload": {
33-
"psr-4": {
34-
"Alpha\\VisitorTrackingBundle\\": "src/"
35-
}
36-
},
37-
"autoload-dev": {
38-
"psr-4": {
39-
"Alpha\\VisitorTrackingBundle\\Tests\\": "tests/"
40-
}
41-
},
50+
4251
"scripts": {
4352
"check-code-style": [
44-
"vendor/bin/php-cs-fixer fix --config='./.php_cs' --show-progress=none --dry-run --no-interaction -v"
53+
"bin/php-cs-fixer fix --config='./.php_cs' --show-progress=none --dry-run --no-interaction --diff -v"
54+
],
55+
"check-security": [
56+
"bin/security-checker security:check"
4557
],
4658
"fix-code-style": [
47-
"vendor/bin/php-cs-fixer fix --config='./.php_cs' --show-progress=none --no-interaction -v"
59+
"bin/php-cs-fixer fix --config='./.php_cs' --show-progress=none --no-interaction --diff -v"
60+
],
61+
"run-static-analysis": [
62+
"bin/phpstan analyse --level=1 src/"
63+
],
64+
"run-static-analysis-including-tests": [
65+
"@run-static-analysis",
66+
"bin/phpstan analyse --level=1 tests/"
4867
],
4968
"run-tests": [
50-
"vendor/bin/phpunit"
69+
"bin/phpunit"
70+
],
71+
"run-tests-with-clover": [
72+
"bin/phpunit --coverage-clover build/logs/clover.xml"
5173
],
5274
"validate-files": [
53-
"vendor/bin/parallel-lint --exclude vendor ."
75+
"bin/parallel-lint --exclude vendor --exclude bin ."
5476
]
5577
},
78+
5679
"config": {
80+
"bin-dir": "bin",
5781
"sort-packages": true
5882
},
5983
"prefer-stable": true

phpunit.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
colors="true"
4+
convertErrorsToExceptions="true"
5+
convertNoticesToExceptions="false"
6+
convertWarningsToExceptions="true"
7+
stopOnFailure="false"
8+
bootstrap="vendor/autoload.php"
9+
verbose="true"
10+
syntaxCheck="true">
11+
12+
<testsuites>
13+
<testsuite>
14+
<directory>./tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
18+
<filter>
19+
<whitelist>
20+
<directory suffix=".php">./src</directory>
21+
</whitelist>
22+
</filter>
23+
24+
</phpunit>

src/Entity/Device.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Gedmo\Mapping\Annotation as Gedmo;
99

1010
/**
11-
* @ORM\Entity()
11+
* @ORM\Entity
1212
*/
1313
class Device
1414
{

src/Entity/Lifetime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Gedmo\Mapping\Annotation as Gedmo;
1111

1212
/**
13-
* @ORM\Entity()
13+
* @ORM\Entity
1414
*/
1515
class Lifetime
1616
{

src/Entity/PageView.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Gedmo\Mapping\Annotation as Gedmo;
99

1010
/**
11-
* @ORM\Entity()
11+
* @ORM\Entity
1212
*/
1313
class PageView
1414
{
@@ -36,7 +36,7 @@ class PageView
3636
protected $created;
3737

3838
/**
39-
* @return integer
39+
* @return int
4040
*/
4141
public function getId()
4242
{

src/Entity/Seed.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Doctrine\ORM\Mapping as ORM;
88

99
/**
10-
* @ORM\Entity()
10+
* @ORM\Entity
1111
*/
1212
class Seed
1313
{
@@ -117,7 +117,6 @@ private function setValue(int $numberOfValues, ?array $weights = null): void
117117
foreach ($weights as $seed => $weight) {
118118
$total += $weight;
119119
if ($random <= $total) {
120-
121120
if (!\is_string($seed)) {
122121
$seed = (string) $seed;
123122
}

0 commit comments

Comments
 (0)