Skip to content

Commit

Permalink
Minor changes + better templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Jul 16, 2022
1 parent e50e9dd commit f4c2158
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 88 deletions.
21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md

This file was deleted.

43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/1_Bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 🐛 Bug Report
description: ⚠️ NEVER report security issues, email security AT spomky-labs.com instead
labels: Bug

body:
- type: input
id: affected-versions
attributes:
label: Version(s) affected
placeholder: x.y.z
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: A clear and concise description of the problem
validations:
required: true
- type: textarea
id: how-to-reproduce
attributes:
label: How to reproduce
description: |
⚠️ This is the most important part of the report ⚠️
Without a way to easily reproduce your issue, there is little chance we will be able to help you and work on a fix.
Please, take the time to show us some code and/or config that is needed for others to reproduce the problem easily.
Most of the time, creating a "bug reproducer" is the best way to help us and increases the chances someone
will have a look at it.
validations:
required: true
- type: textarea
id: possible-solution
attributes:
label: Possible Solution
description: |
Optional: only if you have suggestions on a fix/reason for the bug
Don't hesitate to create a pull request with your solution, it helps get faster feedback.
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: "Optional: any other context about the problem: log messages, screenshots, etc."
12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/2_Feature_request.md

This file was deleted.

17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/2_Feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 🚀 Feature Request
description: RFC and ideas for new features and improvements
body:
- type: textarea
id: description
attributes:
label: Description
description: A clear and concise description of the new feature
validations:
required: true
- type: textarea
id: example
attributes:
label: Example
description: |
A simple example of the new feature in action (include PHP code, YAML config, etc.)
If the new feature changes an existing feature, include a simple before/after comparison.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/3_Documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 📖 Documentation Issue
description: To report typo or obsolete section in the documentation
body:
- type: textarea
id: description
attributes:
label: Description
description: A clear and concise description of the error you found in the documentation
validations:
required: true
5 changes: 0 additions & 5 deletions .github/ISSUE_TEMPLATE/3_Documentation_issue.md

This file was deleted.

6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Support Question
url: https://spomky-labs.com/contact/
about: We use GitHub issues only to discuss about bugs and new features. For this kind of questions about using the library, please use Stackoverflow (or similar) or send a quote request at https://spomky-labs.com/contact/
- name: Support Question
url: https://spomky-labs.com/contact/
about: We use GitHub issues only to discuss about bugs and new features. For this kind of questions about using the library, please use Stackoverflow (or similar) or send a quote request at https://spomky-labs.com/contact/
19 changes: 1 addition & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ all: vendor ## Run all tests
vendor/bin/phpunit --color

tu: vendor ## Run only unit tests
vendor/bin/phpunit --color tests/Unit

ti: vendor ## Run only integration tests
vendor/bin/phpunit --color tests/Integration

tf: vendor ## Run only functional tests
vendor/bin/phpunit --color tests/Functional
vendor/bin/phpunit --color tests

st: vendor ## Run static analyse
vendor/bin/phpstan analyse
Expand All @@ -49,20 +43,9 @@ rector: vendor ## Check all files using Rector
# Others #
########################

twig-lint: vendor ## All Twig template checks
bin/console lint:twig templates/

mu: vendor ## Mutation tests
vendor/bin/infection -s --threads=$(nproc) --min-msi=70 --min-covered-msi=50 --test-framework-options="--exclude-group=Performance"

db: vendor ## Create the database (should only be used in local env
bin/console doctrine:database:drop --env=test --force
bin/console doctrine:database:create --env=test
bin/console doctrine:schema:create --env=test

clean: vendor ## Cleanup the var folder
rm -rf var

cc: vendor ## Show test coverage rates (HTML)
vendor/bin/phpunit --coverage-html ./build

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TOTP / HOTP library in PHP
[![Latest Unstable Version](https://poser.pugx.org/spomky-labs/otphp/v/unstable.png)](https://packagist.org/packages/spomky-labs/otphp)
[![License](https://poser.pugx.org/spomky-labs/otphp/license.png)](https://packagist.org/packages/spomky-labs/otphp)

A php library for generating one-time passwords according to [RFC 4226](http://tools.ietf.org/html/rfc4226) (HOTP Algorithm) and [RFC 6238](http://tools.ietf.org/html/rfc6238) (TOTP Algorithm)
A php library for generating one-time passwords according to [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226) (HOTP Algorithm) and [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238) (TOTP Algorithm)

This library is compatible with Google Authenticator apps available for Android and iPhone.
It is also compatible with other applications such as [FreeOTP](https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp) for example.
Expand Down
11 changes: 3 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">./</directory>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<directory>./tests</directory>
<directory>./doc</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="OTP Test Suite">
<directory suffix="Test.php">./tests</directory>
<directory>./tests</directory>
</testsuite>
</testsuites>
<listeners>
Expand Down
44 changes: 24 additions & 20 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,35 @@
use Rector\Core\ValueObject\PhpVersion;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(SetList::DEAD_CODE);
$rectorConfig->import(LevelSetList::UP_TO_PHP_81);
$rectorConfig->import(SymfonyLevelSetList::UP_TO_SYMFONY_60);
$rectorConfig->import(SymfonySetList::SYMFONY_CODE_QUALITY);
$rectorConfig->import(SymfonySetList::SYMFONY_52_VALIDATOR_ATTRIBUTES);
$rectorConfig->import(SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION);
$rectorConfig->import(SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES);
$rectorConfig->import(DoctrineSetList::DOCTRINE_CODE_QUALITY);
$rectorConfig->import(DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES);
$rectorConfig->import(PHPUnitSetList::PHPUNIT_EXCEPTION);
$rectorConfig->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD);
$rectorConfig->import(PHPUnitSetList::PHPUNIT_91);
$rectorConfig->import(PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER);
$rectorConfig->paths([__DIR__ . '/src']);
$rectorConfig->phpVersion(PhpVersion::PHP_81);
$rectorConfig->importNames();
$rectorConfig->importShortClasses();
return static function (RectorConfig $config): void {
$config->sets([
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_81,
SymfonyLevelSetList::UP_TO_SYMFONY_54,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
SymfonySetList::SYMFONY_STRICT,
DoctrineSetList::DOCTRINE_CODE_QUALITY,
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
PHPUnitLevelSetList::UP_TO_PHPUNIT_100,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_EXCEPTION,
PHPUnitSetList::REMOVE_MOCKS,
PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER,
]);
$config->services()->set(TypedPropertyRector::class);
$config->parallel();
$config->paths([__DIR__ . '/src']);
$config->phpVersion(PhpVersion::PHP_81);
$config->importNames();
$config->importShortClasses();

$services = $rectorConfig->services();
$services->set(TypedPropertyRector::class);
};
2 changes: 2 additions & 0 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

/**
* This class is used to load OTP object from a provisioning Uri.
*
* @see \OTPHP\Test\FactoryTest
*/
final class Factory implements FactoryInterface
{
Expand Down
3 changes: 3 additions & 0 deletions src/HOTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Assert\Assertion;

/**
* @see \OTPHP\Test\HOTPTest
*/
final class HOTP extends OTP implements HOTPInterface
{
protected function __construct(null|string $secret, int $counter, string $digest, int $digits)
Expand Down
3 changes: 3 additions & 0 deletions src/TOTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Assert\Assertion;

/**
* @see \OTPHP\Test\TOTPTest
*/
final class TOTP extends OTP implements TOTPInterface
{
protected function __construct(null|string $secret, int $period, string $digest, int $digits, int $epoch = 0)
Expand Down

0 comments on commit f4c2158

Please sign in to comment.