|
| 1 | +--- |
| 2 | +title: For developers |
| 3 | +layout: default |
| 4 | +nav_order: 900 |
| 5 | +has_children: false |
| 6 | +--- |
| 7 | + |
| 8 | +# OS2Forms |
| 9 | + |
| 10 | +## Table of contents |
| 11 | + |
| 12 | +* [Description](#description) |
| 13 | +* [License](#license) |
| 14 | +* [Testing and CI](#testing-and-ci) |
| 15 | +* [Git guideline](#git-guideline) |
| 16 | +* [Code review](#code-review) |
| 17 | +* [Patching principles](#patching-principles) |
| 18 | +* [Code of Conduct](#coc) |
| 19 | +* [Links](#links) |
| 20 | + |
| 21 | +## Table of files |
| 22 | + |
| 23 | +* [List of modules to maintain](https://github.com/OS2Forms/os2forms_docs/raw/refs/heads/master/files/OS2forms%20-%20moduloversigt%20(sammenligning).xlsx) |
| 24 | + |
| 25 | +<a name="description"></a> |
| 26 | +## Description |
| 27 | + |
| 28 | +__OS2Forms__ is a drupal based solution for creating advanced webform functionality for Danish Municipalities. |
| 29 | + |
| 30 | +Solution main repositories: |
| 31 | +* Drupal core incl. installatioj profile: https://github.com/OS2Forms/os2forms8 |
| 32 | +* OS2Forms forløb profile: https://github.com/OS2Forms/os2forms_forloeb_profile |
| 33 | +* OS2Forms main Drupal module https://github.com/OS2Forms/os2forms |
| 34 | + |
| 35 | +<a name="license"></a> |
| 36 | +## License |
| 37 | +All OS2Forms projects are using [EUPL v1.2 License](https://opensource.org/licenses/EUPL-1.2). |
| 38 | + |
| 39 | +<a name="testing-and-ci"></a> |
| 40 | +## Testing and CI |
| 41 | +Every OS2Forms drupal project should have continuous integration builds are performing by [Travis CI](https://travis-ci.org). |
| 42 | +To improve code quality and integration possibilities there are using set of following tools: |
| 43 | + * [PHP_CodeSniffer]() with [Drupal coding standards](https://www.drupal.org/docs/develop/standards/coding-standards) and best practices defined in [Coder module](https://www.drupal.org/project/coder). |
| 44 | + * [ESLint](https://eslint.org/) with [Drupal ESLint rules set](https://www.drupal.org/node/1955232). |
| 45 | + * [Stylelint](https://stylelint.io/) with rules set defined for Drupal core. |
| 46 | + * [Twigcs](https://github.com/friendsoftwig/twigcs) with standard set of rules |
| 47 | + for twig templates. |
| 48 | + * [Drupal-check](https://github.com/mglaman/drupal-check) to check project |
| 49 | + readiness to Drupal 9 via checking of deprecated code usage. |
| 50 | + * @TODO [PHPUnit](https://phpunit.de/) test to check key contrib modules tests. |
| 51 | + |
| 52 | +For more details about travis-ci continuous integration builds |
| 53 | +see `.travis-ci.yml` file in project git repository. |
| 54 | + |
| 55 | +NOTE: Some projects couldn't have its own PHPUnit test. This is a part of future |
| 56 | +development scope. |
| 57 | + |
| 58 | +<a name="git-guideline"></a> |
| 59 | +## Git guideline |
| 60 | +Project use default approach for branch naming. |
| 61 | + |
| 62 | +### Bracnhes |
| 63 | +* `develop` - general development branch (Default). |
| 64 | +* `develop-2.x` - development branch for version 2.x. (if requires) |
| 65 | +* `master` - stable version of code. |
| 66 | + |
| 67 | +There are no specific rules for feature branch names. However we recommend |
| 68 | +use [OS2Forms JIRA](https://os2web.atlassian.net/browse/OS2FORMS) or |
| 69 | +[github issue](https://github.com/OS2Forms/os2forms/issues) ticket number |
| 70 | +as prefix for your branch name. |
| 71 | + |
| 72 | +### Tags |
| 73 | +Release tags should be created from related branches. Tag name space should |
| 74 | + follow [Semantic Versioning](https://semver.org/) rules. |
| 75 | +Given a version number MAJOR.MINOR.PATCH, increment the: |
| 76 | + |
| 77 | +* MAJOR version when you make incompatible API changes, |
| 78 | +* MINOR version when you add functionality in a backwards compatible manner, and |
| 79 | +* PATCH version when you make backwards compatible bug fixes. |
| 80 | + |
| 81 | +#### Outdated approach |
| 82 | +Since OS2Forms projects are Drupal friendly, there was used drupal-friendly |
| 83 | +git branch/tag names like 8.x, 8.x-2.x. Please keep use it or ask about changes |
| 84 | +in case this names are not compatible with changes you have. |
| 85 | + |
| 86 | +For new repositories it was decided to switch back to github, |
| 87 | +composer way to for branch names. |
| 88 | + |
| 89 | +<a name="code-review"></a> |
| 90 | +## Code review |
| 91 | +New changes or bugfixes in existing codebase have to be added to repository |
| 92 | +through general [code review process](https://github.com/features/code-review/). |
| 93 | +To request a code review, use the following process: |
| 94 | +1. Add Github pull request from the feature/bugfix branch to 8.x or other related dev branch. |
| 95 | +2. Request code review from internal department |
| 96 | +3. Test features with customer on test setting |
| 97 | +4. Fix bugs or get approval from customer |
| 98 | +5. Request code review from one of project contributor (other department/company). |
| 99 | +6. Reviewer approves, requests changes or rejects pull request. |
| 100 | +7. Discuss/Add requested changes or merge approved pull request. |
| 101 | + |
| 102 | +NOTE: There are preconditions that have to be met before accepting a pull request: |
| 103 | +- All requested changes have to be done |
| 104 | +- All discussion have to be resolved |
| 105 | +- Pull request should have green Travis CI build status. |
| 106 | + |
| 107 | +<a name="patching-principles"></a> |
| 108 | +## Patching principles |
| 109 | +To patch a drupal composer project see: |
| 110 | +https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupal/working-with-patches/applying-a-patch-in-a-feature-branch#s-composer |
| 111 | + |
| 112 | +- Composer based projects in os2forms should always use [cweagans/composer-patches](https://github.com/cweagans/composer-patches) package to patch extensions. |
| 113 | +- To allow patching of project dependencies add "enable-patching" to your composer file configuration: |
| 114 | +``` |
| 115 | + "extra": { |
| 116 | + "enable-patching": true |
| 117 | + } |
| 118 | +``` |
| 119 | +- Patching should only be used for drupal contributed modules, drupal core and other packages maintained outside os2forms organisation. |
| 120 | +- Patching should be handled by the os2forms project that introduces the externally maintained code. |
| 121 | +- Patches should include a link reference to the issue it addresses, if any exist. |
| 122 | +- If an external package(1) introduces another external package(2) the patch should be handled by the project that introduced package 1. |
| 123 | + |
| 124 | +Example: |
| 125 | + |
| 126 | +Given the following dependency tree: |
| 127 | +``` |
| 128 | +composer why drupal/dynamic_entity_reference -r |
| 129 | +
|
| 130 | +drupal/recommended-project - requires os2forms/os2forms_forloeb_profile (dev-composer_cleanup) |
| 131 | +drupal/recommended-project - requires os2forms/os2forms_forloeb (dev-composer_cleanup as 2.5.0) |
| 132 | +os2forms/os2forms_forloeb_profile dev-composer_cleanup requires os2forms/os2forms_forloeb (^2.5) |
| 133 | +os2forms/os2forms_forloeb dev-composer_cleanup requires drupal/workflow_participants (^2.4) |
| 134 | +drupal/workflow_participants 2.6.0 requires drupal/dynamic_entity_reference (^2.0) |
| 135 | +``` |
| 136 | +...the os2forms/os2forms_forloeb project is responsible for patching drupal/dynamic_entity_reference contributed module. |
| 137 | +Leave a comment about why the patch belongs here. |
| 138 | +``` |
| 139 | +"patches": { |
| 140 | + "//": "Note: drupal/dynamic_entity_reference is required by drupal/workflow_participants", |
| 141 | + "drupal/dynamic_entity_reference": { |
| 142 | + "entityQuery reference JOINs should specify target_type (https://www.drupal.org/project/dynamic_entity_reference/issues/3120952#comment-14141038)": "https://www.drupal.org/files/issues/2021-06-22/entityquery-reference-joins-should-specify-target_type-3120952-24.patch" |
| 143 | + } |
| 144 | +``` |
| 145 | + |
| 146 | + |
| 147 | +<a name="coc"></a> |
| 148 | +## Code of Conduct |
| 149 | +See [Drupal community code of Conduct](https://www.drupal.org/dcoc) |
| 150 | + |
| 151 | +<a name="links"></a> |
| 152 | +## Links |
| 153 | +* [Drupal code standards](https://www.drupal.org/docs/develop/standards) |
0 commit comments