Skip to content
スニペット グループ プロジェクト
検証済み コミット c737ebd9 作成者 作成者 hajime's avatar hajime
ファイルを参照

created

ブランチ
タグ 1.0.0
関連するマージリクエストが見つかりませんでした
変更されたファイル の表示 480 件の追加0 件の削除
DOCKER_UID=15000
DOCKER_GID=15000
# https://php.watch/articles/composer-gitattributes
# Exclude build/test files from archive
/tests export-ignore
/vendor-bin export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/codecov.yml export-ignore
/phpcs.xml export-ignore
/phpmd.xml export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
# Configure diff output for .php and .phar files.
*.php diff=php
*.phar -diff
/vendor/
/vendor-bin/*/vendor/
/build/
/composer.lock
/phpunit.xml
/.phpunit.result.cache
/.phpcs-cache
/.env
workflow:
rules:
# マージリクエストが承認された時のみ実行する
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_APPROVED == "true"
when: always
# デフォルトブランチへの変更時に実行する
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always
- when: never
stages:
- test
- coverage
cache:
- key:
files:
- composer.json
paths:
- vendor
phpunit:
image: registry.avaper.day/nora/docker-image/php/php-dev:cli-bullseye
stage: coverage
before_script:
- composer install
script:
- |
php \
-dzend_extension=xdebug.so \
-dxdebug.mode=coverage \
./vendor/bin/phpunit \
--coverage-cobertura phpunit-coverage.xml \
--coverage-text \
--colors=never \
--log-junit report.xml
artifacts:
when: always
paths:
- report.xml
- phpunit-coverage.xml
reports:
junit: report.xml
coverage_report:
coverage_format: cobertura
path: phpunit-coverage.xml
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_APPROVED == "true"
changes:
- src/**/*.php
- tests/**/*.php
- composer.json
when: always
Copyright (c) 2023 Hajime MATSUMOTO
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# nora/gitlab-sdk
## 目的
- [https://github.com/GitLabPHP/Client](https://github.com/GitLabPHP/Client)のラッパー
codecov:
notify:
require_ci_to_pass: yes
coverage:
status:
project:
default:
target: 100%
patch:
default:
target: 100%
comment: false
{
"name": "nora/gitlab-sdk",
"type": "library",
"license": "MIT",
"description": "",
"minimum-stability": "stable",
"authors": [
{
"name": "Hajime",
"email": "hajime.matsumoto@avap.co.jp"
}
],
"require": {
"php": "^8.2.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"NORA\\GitlabSdk\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"NORA\\GitlabSdk\\": [
"tests/",
"tests/Fake"
]
}
},
"scripts": {
"nora-install": "NORA\\Skeleton\\Installer::install",
"post-update-cmd": "@composer bin all update --ansi",
"setup": "php bin/setup.php",
"test": "./vendor/bin/phpunit",
"coverage": "php -dzend_extension=xdebug.so -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage",
"phpdbg": "phpdbg -qrr ./vendor/bin/phpunit --coverage-text --coverage-html ./build/coverage --coverage-clover=coverage.xml",
"pcov": "php -dextension=pcov.so -d pcov.enabled=1 ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage --coverage-clover=coverage.xml",
"cs": "./vendor/bin/phpcs",
"cs-fix": "./vendor/bin/phpcbf src tests",
"metrics": "./vendor/bin/phpmetrics --report-html=build/metrics --exclude=Exception src",
"clean": [
"./vendor/bin/phpstan clear-result-cache",
"./vendor/bin/psalm --clear-cache"
],
"sa": [
"./vendor/bin/phpstan analyse -c phpstan.neon",
"./vendor/bin/psalm --show-info=true"
],
"tests": [
"@cs",
"@sa",
"@test"
],
"build": [
"@clean",
"@cs",
"@sa",
"@pcov",
"@metrics"
],
"post-install-cmd": "@composer bin all install --ansi"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
},
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
}
}
}
services:
php:
build:
context: ./docker.d/php
target: dev
args:
- DOCKER_UID=${DOCKER_UID:-1000}
- DOCKER_GID=${DOCKER_GID:-1000}
entrypoint: /entrypoint
working_dir: /app
volumes:
- "./:/app"
# blackfire:
# image: blackfire/blackfire
# ports:
# - 8707
# environment:
# BLACKFIRE_SERVER_ID: ${BLACKFIRE_SERVER_ID}
# BLACKFIRE_SERVER_TOKEN: ${BLACKFIRE_SERVER_TOKEN}
# BLACKFIRE_CLIENT_ID: ${BLACKFIRE_CLIENT_ID}
# BLACKFIRE_CLIENT_TOKEN: ${BLACKFIRE_CLIENT_TOKEN}
FROM registry.avaper.day/nora/docker-image/php/php-dev:cli-bullseye as base
FROM base as dev
COPY --from=composer /usr/bin/composer /usr/bin/composer
ARG DOCKER_GID=1000
ARG DOCKER_UID=1000
USER root
RUN groupmod peopld --gid ${DOCKER_GID}
RUN usermod avapren --uid ${DOCKER_UID} --gid ${DOCKER_GID}
USER avapren
{
"vendor": "NORA",
"package": "GitlabSdk",
"author": {
"name": "Hajime",
"email": "hajime.matsumoto@avap.co.jp"
}
}
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
<arg name="basepath" value="."/>
<arg name="colors" />
<arg name="parallel" value="80"/>
<!-- Compatibility with PHP 8.0 -->
<config name="php_version" value="80000"/>
<!-- Ignore warnings, show progress of the run and show sniff names -->
<arg value="nps"/>
<!-- Directories to be checked -->
<file>src</file>
<exclude-pattern>*/OpenApi/*</exclude-pattern>
<arg name="tab-width" value="4"/>
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
<!-- PSR1 //-->
<!-- クラスは単独でファイル内になければならない //-->
<rule ref="PSR1.Classes.ClassDeclaration" />
<!-- サイド・エフェクトを伴うファイルを不許可//-->
<rule ref="PSR1.Files.SideEffects" />
<!-- PSR2 //-->
<!-- 関数の中括弧は改行されて宣言すること //-->
<rule ref="PSR2.Methods.FunctionClosingBrace" />
<!-- ネームスペース宣言のあとは改行すること //-->
<rule ref="PSR2.Namespaces.NamespaceDeclaration" />
<!-- PSR12 //-->
<!-- 匿名関数も適切にパディングされていること //-->
<rule ref="PSR12.Classes.AnonClassDeclaration" />
<!-- 閉じ中括弧は行の最後であること //-->
<rule ref="PSR12.Classes.ClosingBrace" />
<!-- 長くなるifのブール演算が可読性よく記述されること //-->
<rule ref="PSR12.ControlStructures.BooleanOperatorPlacement" />
<rule ref="PSR12.ControlStructures.ControlStructureSpacing" />
<!-- strict mode を強制 //-->
<rule ref="PSR12.Files.DeclareStatement" />
<!-- FileHeaderと本文は改行を入れる //-->
<rule ref="PSR12.Files.FileHeader" />
<!-- Use宣言のあとは改行すること //-->
<rule ref="PSR12.Files.ImportStatement" />
<!-- PHPの開始タグは単独で存在すること //-->
<rule ref="PSR12.Files.OpenTag" />
<!-- Nullable演算子の正規化 //-->
<rule ref="PSR12.Functions.NullableTypeDeclaration" />
<!-- 戻り値の型宣言の正規化 //-->
<rule ref="PSR12.Functions.ReturnTypeDeclaration" />
<!-- 演算子の後はスペースをあけること //-->
<rule ref="PSR12.Operators.OperatorSpacing" />
<!-- Squiz //-->
<!-- 角カッコの周囲にスペースをあけない //-->
<rule ref="Squiz.Arrays.ArrayBracketSpacing" />
<!-- コメントブロックのスタイルを統一 //-->
<rule ref="Squiz.Commenting.DocCommentAlignment" />
<!-- 複数行になる関数定義のインデント //-->
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.Indent" />
<!-- Generic //-->
<!-- 配列内の改行はインデントされること //-->
<rule ref="Generic.Arrays.ArrayIndent" />
<!-- インラインで中括弧を省略した制御構造の不許可 //-->
<rule ref="Generic.ControlStructures.InlineControlStructure" />
<!-- インデントにタブを使用することを禁止 //-->
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<!-- スペースでインデントされること //-->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
</properties>
</rule>
<!-- Docblock //-->
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
<!-- 解決漏れコンフリクトを検出 /-->
<rule ref="Generic.VersionControl.GitMergeConflict" />
<rule ref="PEAR.Functions.ValidDefaultValue" />
<!-- SlevomatCodingStandard //-->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTypeFormat" />
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace" />
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias" />
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
</ruleset>
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="PHPMD rule set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<!--codesize-->
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
<properties>
<property name="reportLevel" value="20"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/NPathComplexity">
<properties>
<property name="minimum" value="200"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity">
<properties>
<property name="maximum" value="100"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>
<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>
<rule ref="rulesets/codesize.xml/TooManyFields"/>
<rule ref="rulesets/codesize.xml/TooManyMethods"/>
<!--design-->
<rule ref="rulesets/design.xml/EvalExpression"/>
<rule ref="rulesets/design.xml/ExitExpression"/>
<rule ref="rulesets/design.xml/GotoStatement" />
<rule ref="rulesets/design.xml/NumberOfChildren"/>
<rule ref="rulesets/design.xml/DepthOfInheritance"/>
<!-- <rule ref="rulesets/design.xml/CouplingBetweenObjects" /> -->
<!--naming-->
<rule ref="rulesets/naming.xml/ConstantNamingConventions"/>
<rule ref="rulesets/naming.xml/BooleanGetMethodName"/>
<!--unusedcode-->
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
<!--controversial-->
<rule ref="rulesets/controversial.xml/CamelCaseClassName"/>
<rule ref="rulesets/controversial.xml/CamelCasePropertyName"/>
<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>
<!--cleancode-->
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag"/>
<rule ref="rulesets/cleancode.xml/ElseExpression" />
</ruleset>
parameters:
level: max
paths:
- src
- tests
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="NORA.GitlabSdk test suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
</php>
</phpunit>
<?xml version="1.0"?>
<psalm
errorLevel="7"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="true"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<PossiblyUnusedMethod errorLevel="suppress"/>
</issueHandlers>
</psalm>
<?php
declare(strict_types=1);
namespace NORA\GitlabSdk;
final class GitlabSdk
{
}
<?php
declare(strict_types=1);
namespace NORA\GitlabSdk;
use PHPUnit\Framework\TestCase;
class GitlabSdkTest extends TestCase
{
protected GitlabSdk $gitlabSdk;
protected function setUp(): void
{
$this->gitlabSdk = new GitlabSdk();
}
public function testIsInstanceOfGitlabSdk(): void
{
$actual = $this->gitlabSdk;
$this->assertInstanceOf(GitlabSdk::class, $actual);
}
}
{
"require-dev": {
"doctrine/coding-standard": "^11.0",
"phpmd/phpmd": "^2.13",
"phpmetrics/phpmetrics": "^2.8",
"phpstan/phpstan": "^1.9",
"psalm/plugin-phpunit": "^0.18.4",
"squizlabs/php_codesniffer": "^3.7",
"vimeo/psalm": "^5.4"
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
0% 読み込み中 または .
You are about to add 0 people to the discussion. Proceed with caution.
コメントするには登録またはをしてください