Thank you for helping. This file explains how a change gets into this extension: which branch, how to test it, how to write the commit and what a pull request needs to be merged.
- Issues and security
- Branches
- Getting started
- Tests and checks
- Code rules
- The bundled library for classic mode
- Documentation and changelog
- Commit messages
- Pull requests
- Other DeepL extensions
- Bugs and feature requests are GitHub issues, with the templates offered when you open one. Include the TYPO3 version, the version of this extension and the steps to reproduce.
- Security issues are never reported publicly. See SECURITY.md.
- The maintainers track their work in an internal tracker, project
DPL. That is why commits and pull requests refer toDPL-123. You do not need access to it.
| Branch | Version | TYPO3 | PHP | State |
|---|---|---|---|---|
main |
2.x | 13.4, 14.3 | 8.2 to 8.5 | development of the next 2.x |
1 |
1.x | 12.4, 13.4 | 8.1 to 8.5 | bug fixes and security fixes |
- Open a pull request against
main. A fix that is needed in 1.x as well is a second pull request against1, made after the first one, from a branch with the suffix-1(bugfix/my-fix-mainandbugfix/my-fix-1). Both carry the same title. The maintainers can do that second one for you. - The branch
1has its ownCONTRIBUTING.md. Read that one for a change there: the supported versions and some code rules differ.
You need git, bash and docker or podman. Everything else runs in containers
through Build/Scripts/runTests.sh, the same script the CI uses.
git clone git@github.com:web-vision/deepl-write.git
cd deepl-write
Build/Scripts/runTests.sh -h # all options and suites
Build/Scripts/runTests.sh -t 13 -s composerUpdate # install for TYPO3 v13
Build/Scripts/runTests.sh -t 13 -s unit-tselects the TYPO3 version (13, default, or14). The installation in.Build/exists once: run-s composerUpdatewith the same-tbefore the suites of that version, and never two versions at the same time.-b dockeror-b podmanselects the container binary. Without it, podman is used when it is installed.-pselects the PHP version (default 8.2).
A pull request is merged when these are green for TYPO3 v13 and v14. Run them locally before you push:
| Check | Command |
|---|---|
| Coding style (check only) | Build/Scripts/runTests.sh -t 13 -s cgl -n |
| Coding style (fix) | Build/Scripts/runTests.sh -t 13 -s cgl |
| PHPStan | Build/Scripts/runTests.sh -t 13 -s phpstan |
| PHP lint | Build/Scripts/runTests.sh -t 13 -s lintPhp |
| TypoScript lint | Build/Scripts/runTests.sh -t 13 -s lintTypoScript |
| Unit tests | Build/Scripts/runTests.sh -t 13 -s unit |
| Functional tests | Build/Scripts/runTests.sh -t 13 -s functional |
| Functional tests, other DBMS | ... -s functional -d mariadb (also mysql, postgres) |
| Bundled library in sync | Build/Scripts/runTests.sh -t 13 -s checkContribComposer |
| Exception codes unique | Build/Scripts/runTests.sh -s checkExceptionCodes |
| Test method names | Build/Scripts/runTests.sh -s checkTestMethodsPrefix |
| UTF-8 without BOM | Build/Scripts/runTests.sh -s checkBom |
| Documentation renders | Build/Scripts/runTests.sh -s renderDocumentation |
The same with -t 14 after -s composerUpdate -t 14. CI runs
checkContribComposer with TYPO3 v13 only.
- The functional tests talk to a DeepL mock server container, not to DeepL. They need no API key and cost nothing.
- A bug fix comes with a test that fails without it. A new feature comes with tests.
declare(strict_types=1);in every PHP file, classesfinalunless they are meant to be extended, dependencies asreadonlypromoted constructor properties.- Services are stateless. They carry no data from one call to the next.
- Dependency injection through Symfony attributes (
#[AsEventListener],#[Autoconfigure], ...).Services.yamlkeeps the defaults and the resource.Services.phponly loads the directory of the running TYPO3 version. - No TYPO3 version checks inside classes. Code that differs between v13
and v14 lives in
Core13/andCore14/(namespacesWebVision\DeeplWrite\Core13\andWebVision\DeeplWrite\Core14\).Configuration/Services.phploads only the directory of the running version. A new difference goes there, not into aTypo3Versioncheck. - Every exception gets a unique code, the Unix timestamp of the moment you write it.
- Test methods use the
#[Test]attribute and do not start withtest. - Coding style is PSR-2 with the PHP 7.4 migration rules
(
Build/php-cs-fixer/php-cs-rules.php). PHPStan runs on level 8 with a baseline per TYPO3 version inBuild/phpstan/. A change does not add to the baselines.
The readability score uses org_heigl/hyphenator. Composer installations get
it from composer.json. For classic mode (TER) installations the release
workflow installs it into contrib/Libraries/ from contrib/composer.json
and contrib/composer.lock. contrib/Libraries/ is not committed.
- The constraint of
org_heigl/hyphenatorincomposer.jsonandcontrib/composer.jsonmust be identical. contrib/composer.lockis resolved with--prefer-lowest, so the lowest supported version is the one shipped. After a change tocontrib/composer.json, regenerate it withcomposer update --prefer-lowest -d contrib.-s checkContribComposerchecks both.
- The documentation is reStructuredText in
Documentation/, rendered with-s renderDocumentation. The rendered result is not committed. - A feature, a breaking change, a deprecation or a fix an editor or
integrator notices gets a changelog entry in
Documentation/Changelog/<major.minor>/, named like the TYPO3 Core changelog:Feature-<Topic>.rst,Breaking-...,Deprecation-...,Important-.... It is part of the same commit.
The TYPO3 Core commit message rules:
[BUGFIX] DPL-237: Correct the branch alias
Explain why the change is needed and what it does, not how the diff
looks. Wrap the body at 72 characters.
- Subject: a tag (
[FEATURE],[BUGFIX],[TASK],[DOCS],[SECURITY],[!!!]in front for a breaking change), the internal issue if there is one, imperative mood, at most 52 characters where possible. - A GitHub issue goes into the footer (
Resolves: #12) or at the end of the subject ((#12)).
- One pull request carries one commit. The title of the pull request is the subject of the commit. Review changes are amended into the commit and force pushed, not added as new commits.
- Rebase onto the current
maininstead of merging it in. The branch is merged with "rebase and merge", the only method allowed. - Required: one approving review and the checks
code quality with core v13 (8.2),all tests with core v13 (8.2),all tests with core v13 (8.5), the same for v14, andrender documentation. - Name the branch
<type>/<topic>, for examplebugfix/dpl-237-branch-alias-mainortask/security-policy.
deepl-write builds on web-vision/deepl-base and web-vision/deeplcom-deepl-php
(the DeepL PHP SDK). It does not need web-vision/deepltranslate-core, but
works together with it when both are installed:
- Without an API key of its own, deepl-write uses the key of deepltranslate-core.
- In the site configuration, the DeepL Write language and the target language and formality of deepltranslate-core exclude each other.
- On TYPO3 v13 its entry in the translation dropdown of the page module is ordered after the one of deepltranslate-core.
A change to these places, or to the events of deepl-base it listens to, is checked with deepltranslate-core installed as well. Say in your pull request when you know a change affects another DeepL extension.