Skip to content

Commit 1692158

Browse files
Get the static code analysis back (#49)
A misconfiguration stopped the code analysis, and the PHP8 version broke the tests because the test code didn't respect the typehint. So, the Scrutinizer and Codacy are established and working. Now is possible to get metrics about the project
1 parent 90ebac5 commit 1692158

Some content is hidden

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

44 files changed

+121
-131
lines changed

.scrutinizer.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,34 @@ tools:
2424

2525
build:
2626
dependencies:
27-
before:
28-
- "sudo composer self-update"
2927
override:
3028
- "composer install --no-interaction --prefer-dist"
31-
tests:
32-
override:
33-
-
34-
command: './vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=clover.xml'
35-
coverage:
36-
file: 'clover.xml'
37-
format: 'php-clover'
29+
nodes:
30+
analysis:
31+
tests:
32+
override:
33+
- php-scrutinizer-run
34+
35+
coverage:
36+
environment:
37+
php:
38+
ini:
39+
"xdebug.mode": coverage
40+
tests:
41+
override:
42+
-
43+
command: './vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=clover.xml'
44+
coverage:
45+
file: 'clover.xml'
46+
format: 'php-clover'
3847
environment:
3948
php:
40-
version: 7.0.8
49+
version: 8
4150
mysql: false
4251
postgresql: false
4352
redis: false
4453
elasticsearch: false
4554
rabbitmq: false
4655
mongodb: false
4756
neo4j: false
48-
memcached: false
57+
memcached: false

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Brazanation Documents
22
=====================
33

4-
[![Build Status](https://travis-ci.org/brazanation/php-documents.svg?branch=master)](https://travis-ci.org/brazanation/php-documents)
5-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0bdf934bc4224a9fb9d51dc9162fb000)](https://www.codacy.com/app/tonicospinelli/php-documents?utm_source=github.com&utm_medium=referral&utm_content=brazanation/php-documents&utm_campaign=Badge_Grade)
6-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/brazanation/php-documents/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/brazanation/php-documents/?branch=master)
7-
[![Code Coverage](https://scrutinizer-ci.com/g/brazanation/php-documents/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/brazanation/php-documents/?branch=master)
8-
[![StyleCI](https://styleci.io/repos/66179431/shield)](https://styleci.io/repos/66179431)
4+
[![Build Status](https://scrutinizer-ci.com/g/brazanation/php-documents/badges/build.png?b=main)](https://scrutinizer-ci.com/g/brazanation/php-documents/build-status/main)
5+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/f8c31359fca64c0c9c8375182fbceefd)](https://www.codacy.com/gh/brazanation/php-documents/dashboard?utm_source=github.com&utm_medium=referral&utm_content=brazanation/php-documents&utm_campaign=Badge_Grade)
6+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/brazanation/php-documents/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/brazanation/php-documents/?branch=main)
7+
[![Code Coverage](https://scrutinizer-ci.com/g/brazanation/php-documents/badges/coverage.png?b=main)](https://scrutinizer-ci.com/g/brazanation/php-documents/?branch=main)
8+
[![StyleCI](https://github.styleci.io/repos/66179431/shield?branch=main)](https://github.styleci.io/repos/66179431?branch=main)
99

1010
A PHP library to provide Brazilian Documents safer, easier and fun!
1111

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"php": ">=7.0"
77
},
88
"require-dev": {
9-
"phpunit/phpunit": "^6.4",
9+
"phpunit/phpunit": "^9.5",
1010
"codacy/coverage": "^1.0"
1111
},
1212
"license": "MIT",

src/DigitCalculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ private function calculateAdditionalDigit(string $digit) : int
273273
private function calculateSingleSum(int $total) : int
274274
{
275275
if ($this->singleSum) {
276-
return intval(($total / 10) + ($total % 10));
276+
return (int) (($total / 10) + ($total % 10));
277277
}
278278

279279
return $total;

src/JudiciaryProcess.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ protected function extractBaseNumber(string $number) : string
118118
*/
119119
public function calculateDigit(string $input) : string
120120
{
121-
$remainderNumber = intval($this->sequentialNumber) % 97;
121+
$remainderNumber = (int) $this->sequentialNumber % 97;
122122

123123
$judiciaryNumber = "{$remainderNumber}{$this->year}{$this->judiciary}{$this->court}";
124124

125-
$remainderJudiciary = intval($judiciaryNumber) % 97;
125+
$remainderJudiciary = (int) $judiciaryNumber % 97;
126126
$originNumber = "{$remainderJudiciary}{$this->origin}00";
127127

128128
$remainder = (float) $originNumber % 97;

src/StateRegistration/Amapa.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct()
3030
*/
3131
public function calculateDigit(string $baseNumber) : string
3232
{
33-
$number = intval($baseNumber);
33+
$number = (int) $baseNumber;
3434
$lastDigit = $this->discoverLastDigit($number);
3535
$digitToReplace = $this->discoverDigitToReplace($number);
3636

src/StateRegistration/Goias.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private function setCurrentDigit(string $digit)
4848
*/
4949
public function calculateDigit(string $baseNumber) : string
5050
{
51-
$digitToReplace = $this->discoverDigitToReplace(intval($baseNumber));
51+
$digitToReplace = $this->discoverDigitToReplace((int) $baseNumber);
5252

5353
$calculator = new DigitCalculator($baseNumber);
5454
$calculator->useComplementaryInsteadOfModule();

tests/CnhTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,12 @@ public function provideEmptyData() : array
3636
{
3737
return [
3838
[Cnh::LABEL, ''],
39-
[Cnh::LABEL, null],
40-
[Cnh::LABEL, 0],
4139
];
4240
}
4341

4442
public function provideInvalidNumber() : array
4543
{
4644
return [
47-
[Cnh::LABEL, 1],
4845
[Cnh::LABEL, '11111111111'],
4946
[Cnh::LABEL, '06843273172'],
5047
];

tests/CnpjTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,12 @@ public function provideEmptyData() : array
3737
{
3838
return [
3939
[Cnpj::LABEL, ''],
40-
[Cnpj::LABEL, null],
41-
[Cnpj::LABEL, 0],
4240
];
4341
}
4442

4543
public function provideInvalidNumber() : array
4644
{
4745
return [
48-
[Cnpj::LABEL, 1],
4946
[Cnpj::LABEL, '11111111111111'],
5047
[Cnpj::LABEL, '00111222100099'],
5148
[Cnpj::LABEL, '00.111.222/1000-99'],

tests/CnsTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,12 @@ public function provideEmptyData() : array
4242
{
4343
return [
4444
[Cns::LABEL, ''],
45-
[Cns::LABEL, null],
46-
[Cns::LABEL, 0],
4745
];
4846
}
4947

5048
public function provideInvalidNumber() : array
5149
{
5250
return [
53-
[Cns::LABEL, 1],
5451
[Cns::LABEL, '123123232323'],
5552
[Cns::LABEL, '861238979874'],
5653
];

0 commit comments

Comments
 (0)