Skip to content

Commit 6426f14

Browse files
author
Mikolaj Misiurewicz
committed
feat(standards): updated the code to follow the coding standards and added circle.ci tests
1 parent 203607b commit 6426f14

File tree

319 files changed

+200
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

319 files changed

+200
-170
lines changed

.circleci/config.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: 2.1
2+
3+
commands:
4+
composer:
5+
description: 'Configure & Install vendor packages'
6+
steps:
7+
- restore_cache:
8+
key: composer
9+
- run: composer self-update
10+
- run: 'curl -H "Authorization: token $COMPOSER_TOKEN" https://api.github.com/rate_limit'
11+
- run: composer config --global github-oauth.github.com $COMPOSER_TOKEN
12+
- run: composer install --no-interaction --no-progress
13+
- save_cache:
14+
key: composer
15+
paths:
16+
- ~/.composer/
17+
checks:
18+
description: 'Run checks'
19+
steps:
20+
- run: make all
21+
22+
jobs:
23+
checks:
24+
docker:
25+
- image: markupglasgow/php:7.1-cli-composer
26+
steps:
27+
- checkout
28+
- composer
29+
- checks
30+
31+
workflows:
32+
version: 2
33+
checks:
34+
jobs:
35+
- checks:
36+
filters:
37+
tags:
38+
# ensures the CI runs for tags, see https://discuss.circleci.com/t/builds-for-tags-not-triggering/17681/2
39+
only: /.*/

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.PHONY: all
2+
default: all;
3+
4+
analysis:
5+
vendor/bin/phpstan.phar analyse -c phpstan.neon ./src --level 7
6+
7+
unit:
8+
vendor/bin/phpunit --no-coverage
9+
10+
standards:
11+
vendor/bin/phpcs -p --colors --standard=ruleset.xml ./src
12+
13+
mess:
14+
vendor/bin/phpmd ./src text phpmd.xml
15+
16+
all: analysis unit standards mess

README.md

Lines changed: 11 additions & 1 deletion

composer.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"name": "markup/needle-bundle",
33
"description": "A Symfony bundle for search. Defines a standard search query builder (including filters and faceting), and integrates with different backends (currently Solr and Elastic).",
4-
"keywords": ["search", "faceting", "solr"],
4+
"keywords": [
5+
"search",
6+
"faceting",
7+
"solr"
8+
],
59
"type": "symfony-bundle",
610
"license": "MIT",
711
"authors": [
@@ -47,7 +51,14 @@
4751
}
4852
],
4953
"autoload": {
50-
"psr-4": { "Markup\\NeedleBundle\\": "" }
54+
"psr-4": {
55+
"Markup\\NeedleBundle\\": "src"
56+
}
57+
},
58+
"autoload-dev": {
59+
"psr-4": {
60+
"Markup\\NeedleBundle\\Tests\\": "Tests"
61+
}
5162
},
5263
"extra": {
5364
"branch-alias": {

phpmd.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="needle"
3+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
6+
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
7+
<description>Needle Ruleset</description>
8+
9+
<rule ref="vendor/markup/coding-standard/phpmd.xml">
10+
<exclude name="ElseExpression"/>
11+
<exclude name="CouplingBetweenObjects"/>
12+
<exclude name="CyclomaticComplexity"/>
13+
<exclude name="BooleanGetMethodName"/>
14+
<exclude name="ExcessiveMethodLength"/>
15+
<exclude name="NPathComplexity"/>
16+
<exclude name="LongVariable"/>
17+
</rule>
18+
</ruleset>

phpstan.neon

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
parameters:
22
excludes_analyse:
3-
- %currentWorkingDirectory%/DependencyInjection/Configuration.php
4-
- %currentWorkingDirectory%/Tests/*
5-
- %currentWorkingDirectory%/vendor/*
6-
- %currentWorkingDirectory%/bin/*
3+
- */DependencyInjection/Configuration.php
74
ignoreErrors:
85
- '#Query::addDocuments\(\) expects array#'
9-
- '#Class Symfony\\Component\\DependencyInjection\\ChildDefinition not found#'
10-
- '#Class Symfony\\Component\\DependencyInjection\\DefinitionDecorator not found#'
11-
- '#Access to undefined constant Symfony\\Component\\DependencyInjection\\ContainerInterface::SCOPE_PROTOTYPE#'
126
reportUnmatchedIgnoredErrors: false
137
inferPrivatePropertyTypeFromConstructor: true

phpunit.xml.dist

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,4 @@
88
</testsuite>
99
</testsuites>
1010

11-
<filter>
12-
<whitelist>
13-
<directory>./</directory>
14-
<exclude>
15-
<directory>./Resources</directory>
16-
<directory>./Tests</directory>
17-
<directory>./vendor</directory>
18-
</exclude>
19-
</whitelist>
20-
</filter>
2111
</phpunit>

ruleset.xml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,8 @@
44

55
<config name="ignore_warnings_on_exit" value="true"/>
66

7-
<arg name="tab-width" value="4"/>
8-
<arg name="encoding" value="utf-8"/>
9-
107
<rule ref="vendor/markup/coding-standard/Markup/ruleset.xml"/>
118

12-
<!-- Use Unix newlines -->
13-
<rule ref="Generic.Files.LineEndings">
14-
<properties>
15-
<property name="eolChar" value="\n"/>
16-
</properties>
17-
</rule>
18-
199
<!--Override to disable Fie length checks-->
2010
<rule ref="Generic.Files.LineLength">
2111
<severity>4</severity>
@@ -24,6 +14,7 @@
2414
<rule ref="Markup.Doctrine.EntityManager.EntityManagerFound"/>
2515
<rule ref="Markup.Doctrine.PreventInheritanceOfDoctrine.EntityRepositoryFound"/>
2616

27-
<exclude-pattern>Tests/*</exclude-pattern>
28-
<exclude-pattern>vendor/*</exclude-pattern>
17+
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue.NullabilitySymbolRequired">
18+
<type>warning</type>
19+
</rule>
2920
</ruleset>

Adapter/ElasticResultPromisePagerfantaAdapter.php renamed to src/Adapter/ElasticResultPromisePagerfantaAdapter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(PromiseInterface $resultPromise)
2222
/**
2323
* Returns the number of results.
2424
*
25-
* @return integer The number of results.
25+
* @return int The number of results.
2626
*/
2727
public function getNbResults()
2828
{
@@ -32,8 +32,8 @@ public function getNbResults()
3232
/**
3333
* Returns an slice of the results.
3434
*
35-
* @param integer $offset The offset.
36-
* @param integer $length The length.
35+
* @param int $offset The offset.
36+
* @param int $length The length.
3737
*
3838
* @return array|\Traversable The slice.
3939
*/
File renamed without changes.

0 commit comments

Comments
 (0)