From 3b5f68ef082ea25b6cf940a381e5db63f31d6459 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Sat, 1 Oct 2022 21:06:04 -0500 Subject: [PATCH 1/3] Define constant instead of duplicate literal --- src/XsdMaxOccurs/Finder.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/XsdMaxOccurs/Finder.php b/src/XsdMaxOccurs/Finder.php index b48a19a..9ea9371 100644 --- a/src/XsdMaxOccurs/Finder.php +++ b/src/XsdMaxOccurs/Finder.php @@ -12,6 +12,8 @@ final class Finder implements FinderInterface { + const NS_XMLSCHEMA = 'http://www.w3.org/2001/XMLSchema'; + /** @var string */ private $targetNamespace = ''; @@ -38,7 +40,7 @@ private function obtainPathsForXPathQuery(DOMDocument $document, string $query): { $paths = []; $xpath = new DOMXPath($document); - $xpath->registerNamespace('x', 'http://www.w3.org/2001/XMLSchema'); + $xpath->registerNamespace('x', self::NS_XMLSCHEMA); $nodes = $xpath->query($query) ?: new DOMNodeList(); foreach ($nodes as $node) { if ($node instanceof DOMElement) { @@ -63,7 +65,7 @@ private function obtainPathForElement(DOMElement $xsElement): string private function findParentElement(DOMElement $node): ?DOMElement { for ($node = $node->parentNode; $node instanceof DOMElement; $node = $node->parentNode) { - if ('element' !== $node->localName || 'http://www.w3.org/2001/XMLSchema' !== $node->namespaceURI) { + if ('element' !== $node->localName || self::NS_XMLSCHEMA !== $node->namespaceURI) { continue; } return $node; @@ -74,7 +76,7 @@ private function findParentElement(DOMElement $node): ?DOMElement private function findTargetNamespace(DOMDocument $document): string { $xpath = new DOMXPath($document); - $xpath->registerNamespace('x', 'http://www.w3.org/2001/XMLSchema'); + $xpath->registerNamespace('x', self::NS_XMLSCHEMA); /** @var DOMNodeList $targets */ $targets = $xpath->query('/x:schema/@targetNamespace') ?: new DOMNodeList(); /** @var DOMAttr|null $firstTarget */ From 8f98ba28c9506996905df9c1469ab7a5261e752c Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Sat, 1 Oct 2022 21:07:29 -0500 Subject: [PATCH 2/3] Update badges --- README.md | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d951911..01edc1d 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,20 @@ # phpcfdi/cfdi-to-json [![Source Code][badge-source]][source] +[![Packagist PHP Version Support][badge-php-version]][php-version] +[![Discord][badge-discord]][discord] [![Latest Version][badge-release]][release] [![Software License][badge-license]][license] [![Build Status][badge-build]][build] -[![Scrutinizer][badge-quality]][quality] -[![Coverage Status][badge-coverage]][coverage] +[![Reliability][badge-reliability]][reliability] +[![Maintainability][badge-maintainability]][maintainability] +[![Code Coverage][badge-coverage]][coverage] +[![Violations][badge-violations]][violations] [![Total Downloads][badge-downloads]][downloads] > Herramienta para convertir archivos CFDI a JSON -## Acerca de +## Acerca de `phpcfdi/cfdi-to-json` Esta es una herramienta que sigue sus propias convenciones para convertir los archivos de CFDI (XML de SAT) a formato JSON. @@ -250,12 +254,12 @@ sin temor a romper tu aplicación. ## Contribuciones -Las contribuciones con bienvenidas. Por favor lee [CONTRIBUTING][] para más detalles +Las contribuciones con bienvenidas. Por favor, revisa [CONTRIBUTING][] para más detalles y recuerda revisar el archivo de tareas pendientes [TODO][] y el archivo [CHANGELOG][]. ## Copyright and License -The `phpcfdi/cfdi-to-json` library is copyright © [PhpCfdi](https://www.phpcfdi.com) +The `phpcfdi/cfdi-to-json` library is copyright © [PhpCfdi](https://www.phpcfdi.com/) and licensed for use under the MIT License (MIT). Please see [LICENSE][] for more information. [contributing]: https://github.com/phpcfdi/cfdi-to-json/blob/main/CONTRIBUTING.md @@ -263,17 +267,25 @@ and licensed for use under the MIT License (MIT). Please see [LICENSE][] for mor [todo]: https://github.com/phpcfdi/cfdi-to-json/blob/main/docs/TODO.md [source]: https://github.com/phpcfdi/cfdi-to-json +[php-version]: https://packagist.org/packages/phpcfdi/cfdi-to-json +[discord]: https://discord.gg/aFGYXvX [release]: https://github.com/phpcfdi/cfdi-to-json/releases [license]: https://github.com/phpcfdi/cfdi-to-json/blob/main/LICENSE [build]: https://github.com/phpcfdi/cfdi-to-json/actions/workflows/build.yml?query=branch:main -[quality]: https://scrutinizer-ci.com/g/phpcfdi/cfdi-to-json/ -[coverage]: https://scrutinizer-ci.com/g/phpcfdi/cfdi-to-json/code-structure/main/code-coverage/src +[reliability]:https://sonarcloud.io/component_measures?id=phpcfdi_cfdi-to-json&metric=Reliability +[maintainability]: https://sonarcloud.io/component_measures?id=phpcfdi_cfdi-to-json&metric=Maintainability +[coverage]: https://sonarcloud.io/component_measures?id=phpcfdi_cfdi-to-json&metric=Coverage +[violations]: https://sonarcloud.io/project/issues?id=phpcfdi_cfdi-to-json&resolved=false [downloads]: https://packagist.org/packages/phpcfdi/cfdi-to-json -[badge-source]: http://img.shields.io/badge/source-phpcfdi/cfdi--to--json-blue?style=flat-square -[badge-release]: https://img.shields.io/github/release/phpcfdi/cfdi-to-json?style=flat-square -[badge-license]: https://img.shields.io/github/license/phpcfdi/cfdi-to-json?style=flat-square -[badge-build]: https://img.shields.io/github/workflow/status/phpcfdi/cfdi-to-json/build/main?style=flat-square -[badge-quality]: https://img.shields.io/scrutinizer/g/phpcfdi/cfdi-to-json/main?style=flat-square -[badge-coverage]: https://img.shields.io/scrutinizer/coverage/g/phpcfdi/cfdi-to-json/main?style=flat-square -[badge-downloads]: https://img.shields.io/packagist/dt/phpcfdi/cfdi-to-json?style=flat-square +[badge-source]: https://img.shields.io/badge/source-phpcfdi/cfdi--to--json-blue?logo=github +[badge-discord]: https://img.shields.io/discord/459860554090283019?logo=discord +[badge-php-version]: https://img.shields.io/packagist/php-v/phpcfdi/cfdi-to-json?logo=php +[badge-release]: https://img.shields.io/github/release/phpcfdi/cfdi-to-json?logo=git +[badge-license]: https://img.shields.io/github/license/phpcfdi/cfdi-to-json?logo=open-source-initiative +[badge-build]: https://img.shields.io/github/workflow/status/phpcfdi/cfdi-to-json/build/main?logo=github-actions +[badge-reliability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_cfdi-to-json&metric=reliability_rating +[badge-maintainability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_cfdi-to-json&metric=sqale_rating +[badge-coverage]: https://img.shields.io/sonar/coverage/phpcfdi_cfdi-to-json/main?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io +[badge-violations]: https://img.shields.io/sonar/violations/phpcfdi_cfdi-to-json/main?format=long&logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io +[badge-downloads]: https://img.shields.io/packagist/dt/phpcfdi/cfdi-to-json?logo=packagist From ea6a088cc47a1c43f84abb644cfa9e8f56709a55 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Sat, 1 Oct 2022 21:10:57 -0500 Subject: [PATCH 3/3] Remove Scrutinizer-CI --- .gitattributes | 1 - .scrutinizer.yml | 21 --------------------- docs/CHANGELOG.md | 4 ++-- 3 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 .scrutinizer.yml diff --git a/.gitattributes b/.gitattributes index bcff36f..89a9af7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,7 +14,6 @@ /.gitattributes export-ignore /.gitignore export-ignore /.php-cs-fixer.dist.php export-ignore -/.scrutinizer.yml export-ignore /phpcs.xml.dist export-ignore /phpstan.neon.dist export-ignore /phpunit.xml.dist export-ignore diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index b3e5dde..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,21 +0,0 @@ -filter: - excluded_paths: - - 'tests/' - dependency_paths: - - 'tools/' - - 'vendor/' - -build: - dependencies: - override: - - composer upgrade --no-interaction --prefer-dist - nodes: - analysis: # see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/ - project_setup: {override: true} - tests: - override: - - php-scrutinizer-run --enable-security-analysis - - command: vendor/bin/phpunit --verbose --testdox --coverage-clover=coverage.clover - coverage: - file: coverage.clover - format: clover diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 46a8bc7..17e0c81 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -9,8 +9,6 @@ versión aunque sí su incorporación en la rama principal de trabajo, generalme ## Cambios no liberados en una versión -No hay cambios no liberados. - ## Listado de cambios ### Versión 0.3.2 2022-10-01 @@ -29,6 +27,8 @@ Gracias `@gam04` por tu contribución. - Se elimina la dependencia de `composer` donde no se usa. - Se actualiza el archivo de configuración de `php-cs-fixer`. - Se agrega la configuración en Git para que los finales de línea solo sean `LF`. +- Se integra el proyecto a [SonarCloud](https://sonarcloud.io/code?id=phpcfdi_cfdi-to-json). +- Se elimina la integración con Scrutinizer CI a favor de SonarCloud. ¡Gracias Scrutinizer CI!. ### Versión 0.3.1 2022-04-04