Commit 82ea305b authored by Guillaume Perréal's avatar Guillaume Perréal

Passage en LGPL-3.0 + mise à niveau de la config du bundle.

parent f8fbdf4c
This file is part of "%package%".
Copyright (C) %yearRange% IRSTEA
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License and the GNU
Lesser General Public License along with this program. If not, see
<https://www.gnu.org/licenses/>.
devtools/editorconfig
\ No newline at end of file
# editorconfig.org
root=true
[*]
charset=utf-8
end_of_line=lf
indent_size=4
indent_style=space
insert_final_newline=true
tab_width=4
trim_trailing_whitespace=true
[*.{js,yml,json,ts}]
indent_size=2
tab_width=2
[Makefile]
indent_style=tab
[*.md]
max_line_length = off
trim_trailing_whitespace = false
/vendor/
/components/
/apigen
.php_cs.commit-cache
/.php_cs*cache*
stage:
- vendor
- test
.defaults: &defaults
.php: &php
tags: [ docker ]
image: isdevtools.irstea.fr/poleis/php-analysis:7.1
phploc:
<<: *defaults
script: phploc src
variables:
DEBIAN_FRONTEND: noninteractive
COMPOSER_CACHE_DIR: "$CI_PROJECT_DIR/.composer-cache"
PHP_VERSION: "7.1"
image: gitlab-registry.irstea.fr/pole-is/docker/php:7.1
before_script:
- php -v
- composer -V
lint:
<<: *defaults
vendor:
<<: *php
stage: vendor
dependencies: []
script:
- parallel-lint -j $(nproc) src
- twig-lint lint src
- yaml-lint src
php-cs-fixer:
<<: *defaults
script: php-cs-fixer fix --dry-run --verbose
phpcpd:
<<: *defaults
script: phpcpd --fuzzy src
.with-vendors: &with-vendors
<<: *defaults
before_script:
- composer install --prefer-dist --no-progress --no-suggest
- composer install --no-suggest --no-progress
artifacts:
name: "$CI_JOB_NAME"
paths:
- vendor
expire_in: 4 hours
cache:
key: "$CI_COMMIT_REF_NAME"
key: "$CI_BUILD_REF_NAME-composer"
paths:
- /composer/cache
- "$COMPOSER_CACHE_DIR"
.php-test: &php-test
<<: *php
stage: test
dependencies: [ vendor ]
script: composer ${CI_JOB_NAME}
phploc: { <<: *php-test }
composer-require-checker:
<<: *with-vendors
script: composer-require-checker
test:lint: { <<: *php-test }
test:php-cs-fixer: { <<: *php-test }
test:phpcpd: { <<: *php-test }
test:phpmd: { <<: *php-test }
test:phpstan: { <<: *php-test }
test:composer-require-checker: { <<: *php-test }
phpmd:
<<: *with-vendors
script: phpmd src text ./phpmd-ruleset.xml --suffixes=php
devtools/php/php_cs.dist
\ No newline at end of file
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->exclude('var')
->files()
->name('*.php')
->in('.');
return Irstea\CS\Config::create()
->setIndent(' ')
->setLineEnding("\n")
->setFinder($finder);
This diff is collapsed.
### GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the
terms and conditions of version 3 of the GNU General Public License,
supplemented by the additional permissions listed below.
#### 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the
GNU General Public License.
"The Library" refers to a covered work governed by this License, other
than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
#### 1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
#### 2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
- a) under this License, provided that you make a good faith effort
to ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
- b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
#### 3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a
header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
- a) Give prominent notice with each copy of the object code that
the Library is used in it and that the Library and its use are
covered by this License.
- b) Accompany the object code with a copy of the GNU GPL and this
license document.
#### 4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken
together, effectively do not restrict modification of the portions of
the Library contained in the Combined Work and reverse engineering for
debugging such modifications, if you also do each of the following:
- a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
- b) Accompany the Combined Work with a copy of the GNU GPL and this
license document.
- c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
- d) Do one of the following:
- 0) Convey the Minimal Corresponding Source under the terms of
this License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
- 1) Use a suitable shared library mechanism for linking with
the Library. A suitable mechanism is one that (a) uses at run
time a copy of the Library already present on the user's
computer system, and (b) will operate properly with a modified
version of the Library that is interface-compatible with the
Linked Version.
- e) Provide Installation Information, but only if you would
otherwise be required to provide such information under section 6
of the GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the Application
with a modified version of the Linked Version. (If you use option
4d0, the Installation Information must accompany the Minimal
Corresponding Source and Corresponding Application Code. If you
use option 4d1, you must provide the Installation Information in
the manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.)
#### 5. Combined Libraries.
You may place library facilities that are a work based on the Library
side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
- a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities, conveyed under the terms of this License.
- b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
#### 6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
as you received it specifies that a certain numbered version of the
GNU Lesser General Public License "or any later version" applies to
it, you have the option of following the terms and conditions either
of that published version or of any later version published by the
Free Software Foundation. If the Library as you received it does not
specify a version number of the GNU Lesser General Public License, you
may choose any version of the GNU Lesser General Public License ever
published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
{
"name": "irstea/plantuml-bundle",
"description": "Un bundle pour génerer des schémas UML à partir du code.",
"type": "symfony-bundle",
"license": "proprietary",
"authors": [
{ "name": "Pôle Informatique Scientifique - Direction des Systèmes d'Information", "email": "dsi.poleis@lists.irstea.fr" },
{ "name": "Guillaume Perréal" }
],
"homepage": "https://gitlab.irstea.fr/pole-is/bundles/plantuml-bundle",
"support": {
"email": "dsi.poleis@lists.irsta.fr",
"issues": "https://gitlab.irstea.fr/pole-is/bundles/plantuml-bundle/issues",
"wiki": "https://gitlab.irstea.fr/pole-is/bundles/plantuml-bundle/wiki",
"source": "https://gitlab.irstea.fr/pole-is/bundles/plantuml-bundle/tree/master"
},
"autoload": {
"psr-4": { "Irstea\\PlantUmlBundle\\": "src/" },
"files": ["src/functions.php"]
},
"minimum-stability": "stable",
"repositories": [
{ "type": "composer", "url": "https://isdevtools.irstea.fr/satis" }
],
"require": {
"php": "^7.1",
"ext-json": "*",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"symfony/config": "^3.0 | ^4.0",
"symfony/console": "^3.0 | ^4.0",
"symfony/dependency-injection": "^3.0 | ^4.0",
"symfony/filesystem": "^3.0 | ^4.0",
"symfony/finder": "^3.0 | ^4.0",
"symfony/framework-bundle": "^3.0 | ^4.0",
"symfony/http-kernel": "^3.0 | ^4.0",
"symfony/security": "^3.0 | ^4.0"
"name": "irstea/plantuml-bundle",
"description": "Un bundle pour génerer des schémas UML à partir du code.",
"type": "symfony-bundle",
"license": "LGPL-3.0",
"authors": [
{
"name": "Pôle Informatique Scientifique - Direction des Systèmes d'Information",
"email": "dsi.poleis@lists.irstea.fr"
},
"bin": ["bin/plantuml.jar"],
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"archive": {
"exclude": [
"vendor",
".git*",
".idea"
]
{
"name": "Guillaume Perréal"
}
],
"homepage": "https://gitlab.irstea.fr/pole-is/bundles/plantuml-bundle",
"support": {
"email": "dsi.poleis@lists.irsta.fr",
"issues": "https://gitlab.irstea.fr/pole-is/bundles/plantuml-bundle/issues",
"wiki": "https://gitlab.irstea.fr/pole-is/bundles/plantuml-bundle/wiki",
"source": "https://gitlab.irstea.fr/pole-is/bundles/plantuml-bundle/tree/master"
},
"autoload": {
"psr-4": {
"Irstea\\PlantUmlBundle\\": "src/"
},
"require-dev": {
"vimeo/psalm": "^3.0"
"files": [
"src/functions.php"
]
},
"minimum-stability": "stable",
"require": {
"php": "^7.1",
"ext-json": "*",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"symfony/config": "^3.0 | ^4.0",
"symfony/console": "^3.0 | ^4.0",
"symfony/dependency-injection": "^3.0 | ^4.0",
"symfony/filesystem": "^3.0 | ^4.0",
"symfony/finder": "^3.0 | ^4.0",
"symfony/framework-bundle": "^3.0 | ^4.0",
"symfony/http-kernel": "^3.0 | ^4.0",
"symfony/security": "^3.0 | ^4.0"
},
"bin": [
"bin/plantuml.jar"
],
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"archive": {
"exclude": [
"vendor",
".git*",
".idea"
]
},
"require-dev": {
"irstea/php-cs-fixer-config": "^1.0",
"irstea/phpmd-config": "^1.0",
"irstea/phpstan-config": "^1.0",
"jakub-onderka/php-parallel-lint": "^1.0",
"maglnet/composer-require-checker": "^2.0",
"phploc/phploc": "^5.0",
"roave/security-advisories": "dev-master",
"sebastian/phpcpd": "^4.1"
},
"scripts": {
"fix-cs": "@php vendor/bin/php-cs-fixer fix --verbose",
"phploc": "@php vendor/bin/phploc src",
"test": [
"@test:lint",
"@test:php-cs-fixer",
"@test:phpcpd",
"@test:phpmd",
"@test:phpstan",
"@test:composer-require-checker"
],
"test:lint": "@php vendor/bin/parallel-lint -j $(nproc) src",
"test:php-cs-fixer": "@php vendor/bin/php-cs-fixer fix --dry-run --verbose",
"test:phpcpd": "@php vendor/bin/phpcpd --fuzzy src",
"test:phpmd": "@php vendor/bin/phpmd src text phpmd-ruleset.xml",
"test:phpstan": "@php vendor/bin/phpstan analyse",
"test:composer-require-checker": "@php vendor/bin/composer-require-checker"
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
editorconfig
\ No newline at end of file
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
remote = git@gitlab-ssh.irstea.fr:pole-is/devtools-config.git
branch = master
commit = 0c931beb09149c83b9defadd3f96284e7c91ba44
parent = 9ef29341326f987b7df2ccd9fd2c6a8d544ee582
cmdver = 0.3.1
Ce dépôt contient la configuration par défaut de quelques outils utiles pendant le développement.
Installation
============
Cloner le dossier dans $HOME/.config/devtools.
```bash
git clone git@gitlab-ssh.irstea.fr:pole-is/devtools-config.git $HOME/.config/devtools
```
Utilisation
Globale
-------
Créer des liens symboliques dans $HOME pour .editorconf et phpcs.xml.dist:
```bash
ln -snf $HOME/.config/devtools/php/phpcs.xml.dist $HOME/phpcs.xml.dist
ln -snf $HOME/.config/devtools/.editorconfig $HOME/.editorconfig
```
Enfin, configurer PHPStorm pour utiliser les fichiers $HOME/.config/devtools/php/phpcs.xml.dist et $HOME/.config/devtools/php/phpmd-ruleset.xml pour phpcs et phpmd respectivement.
Par projet
----------
php-cs-fixer nécessite de copier le fichier directement dans le projet :
```bash
cp $HOME/.config/devtools/php/.php_cs.dist chemin/vers/mon/projet
```
Pour phpcs et phpmd, c'est également nécessaire pour l'intégration continue.
Outils
======
* [editorconfig](): permet de configurer globalement l'encodage, l'indentation et la gestion des espaces.
* [phpcs](https://github.com/squizlabs/PHP_CodeSniffer): vérification du style de codage.
* [php-cs-fixer](https://github.com/FriendsOfPhp/PHP-CS-Fixer): cousin de phpcs, mais qui permet de corriger les fichiers et inclut également des aide pour migrer d'une version de PHP à une autre.
* [phpmd](https://phpmd.org/): détection de bugs potentielles, de fonctions/classes trop complexes, ...
# editorconfig.org
root=true
[*]
charset=utf-8
end_of_line=lf
indent_size=4
indent_style=space
insert_final_newline=true
tab_width=4
trim_trailing_whitespace=true
[*.{js,yml,json,ts}]
indent_size=2
tab_width=2
[Makefile]
indent_style=tab
[*.md]
max_line_length = off
trim_trailing_whitespace = false
.defaults: &defaults
tags: [ docker ]
image: isdevtools.irstea.fr/poleis/php-analysis:7.1
phploc:
<<: *defaults
script: phploc src
lint:
<<: *defaults
script:
- parallel-lint -j $(nproc) src
- twig-lint lint src
- yaml-lint src
php-cs-fixer:
<<: *defaults
script: php-cs-fixer fix --dry-run --verbose
phpcpd:
<<: *defaults
script: phpcpd --fuzzy src
.with-vendors: &with-vendors
<<: *defaults
before_script:
- composer install --prefer-dist --no-progress --no-suggest
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- /composer/cache
composer-require-checker:
<<: *with-vendors
script: composer-require-checker
phpmd:
<<: *with-vendors
script: phpmd src text ./phpmd-ruleset.xml --suffixes=php
php_cs.dist
\ No newline at end of file
<?php
define('COMMIT_CACHE', '.php_cs.commit-cache');
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->exclude('node_modules')
->exclude('cache')
->files()
->name('*.php')
->in('.');
$yearRange = getGitCommitYears();
$ruleSets = ['@PSR2' => true, '@Symfony' => true];
$rules = [
// Configuration && overrides
'binary_operator_spaces' => ['align_double_arrow' => true],
'blank_line_after_opening_tag' => false,
'concat_space' => ['spacing' => 'one'],
'method_argument_space' => ['ensure_fully_multiline' => true],
// Risky
'is_null' => ['use_yoda_style' => false],
'non_printable_character' => ['use_escape_sequences_in_strings' => true],
// Safe
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'general_phpdoc_annotation_remove' => ['annotations' => ['author', 'package']],
'no_multiline_whitespace_before_semicolons' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'yoda_style' => false,
'header_comment' => [
'commentType' => 'comment',
'location' => 'after_declare_strict',
'separate' => 'bottom',
'header' => <<<HEADER
Copyright (C) $yearRange IRSTEA
All rights reserved.
HEADER
,
],
];
$phpVersion = findComposerPhpReq();
if ($phpVersion >= 5.6) {
$ruleSets['@PHP56Migration'] = true;
}
if ($phpVersion >= 7.0) {
$ruleSets['@PHP70Migration'] = true;
$rules['declare_strict_types'] = true;
}
if ($phpVersion >= 7.1) {
$ruleSets['@PHP71Migration'] = true;
}
echo "Rulesets: " . implode(', ', array_keys($ruleSets)) . ".\n";
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setUsingCache(false)
->setIndent(' ')
->setLineEnding("\n")
->setRules(array_merge($ruleSets, $rules))
->setFinder($finder);
/**
* @return string