Pimcore: [DX] Optimize Pimcore-managed code files for merges with fewest conflicts possible

Created on 16 Oct 2018  路  3Comments  路  Source: pimcore/pimcore

Feature Request

  • [x] There is no existing issue regarding the same topic

Feature description

Code files managed by Pimcore which are expected to be checked in by VCS like Git should be optimized for easier merges (which might come from different branches doing different things with them).

The idea is to minimize the possibility of different actions changing the code at the same place in the same file, making merging much more difficult. It also makes diffs minimal since the changes are predictable.

Making these quite small changes makes for quite a difference in the long term.

For example:

  1. always add trailing commas where possible:
return [
    "bundle" => [
        "OutputDataConfigToolkitBundle\\OutputDataConfigToolkitBundle" => TRUE,
    ]
];
  1. where the order is unimportant, sort by name, key, etc:
return [
    "bundle" => [
        // even though this bundle is installed last, it comes first in the list
        "ImportDefinitionsBundle\\ImportDefinitionsBundle" => TRUE,
        "OutputDataConfigToolkitBundle\\OutputDataConfigToolkitBundle" => TRUE,
    ]
];
  1. in fluent invocations, hang the semicolon (this might not be applicable currently):
$listing
    ->setLimit(10)
    ->setOffset(20)
; // if this is on the last line, it is never touched as new calles in the fluent chain are added / removed / updated

Most helpful comment

It will be really nice.
Also not recording the date timestamps on the definition files or other values that change just by saving the class (on GUI).

All 3 comments

It will be really nice.
Also not recording the date timestamps on the definition files or other values that change just by saving the class (on GUI).

Symfony actually did something similar. Re compiling the container without changing anything gives the same sha1. Pimcore should do the same.

PRs are welcome 馃槉

Was this page helpful?
0 / 5 - 0 ratings