Skip to content

Commit e652061

Browse files
committed
Removes the deprecated create and overwrite options
1 parent ac4249e commit e652061

7 files changed

Lines changed: 64 additions & 683 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1010
## [v6.0.0] - 2026-06-XX
1111

1212
### Added
13-
- Expanded the `validation` to also validate __negated__ export-ignore directives. Closes [#70](https://github.com/raphaelstolt/lean-package-validator/issues/70).
13+
- Expanded the `validation` to also validate _negated_ export-ignore directives. Closes [#70](https://github.com/raphaelstolt/lean-package-validator/issues/70).
1414
- New `--flavour` option for the `create` command which influences the `.gitattributes` file generation. Closes [#71](https://github.com/raphaelstolt/lean-package-validator/issues/71).
15-
- Expanded the `reformatting` to also reformat __negated__ export-ignore directives. Closes [#72](https://github.com/raphaelstolt/lean-package-validator/issues/72).
15+
- Expanded the `reformatting` to also reformat _negated_ export-ignore directives. Closes [#72](https://github.com/raphaelstolt/lean-package-validator/issues/72).
1616

1717
### Removed
1818
- Removed the explicit `--agentic-run` option as agent detection is now done automatically per default.
19+
- Removed the `--create` and `--overwrite` options of the validate command. Closes [#68](https://github.com/raphaelstolt/lean-package-validator/issues/68).
1920

2021
## [v5.9.1] - 2026-05-17
2122

README.md

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Run the lean package validator CLI within or against a project/micro-package
7575
directory, and it will validate the [export-ignore](https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#Exporting-Your-Repository) entries present in
7676
a `.gitattributes` file against a set of common repository artefacts.
7777

78-
It can handle __"normal"__ export-ignore directives as well as __negated__ export-ignore directives.
78+
It can handle _classic_ export-ignore directives as well as _negated_ export-ignore directives.
7979

8080
If no `.gitattributes` file is present it will suggest creating one.
8181

@@ -92,23 +92,6 @@ file and fail validation if the order differs. Per __default__ the order compari
9292
lean-package-validator validate --enforce-strict-order [<directory>]
9393
```
9494

95-
The `--create|-c` option creates an `.gitattributes` file if nonexistent.
96-
97-
``` bash
98-
lean-package-validator validate --create [<directory>]
99-
```
100-
101-
The `--overwrite|-o` option overwrites an existing `.gitattributes` file when
102-
there are any `export-ignore` entries missing. Using this option on a directory
103-
with a nonexistent `.gitattributes` file implicates the `--create` option.
104-
105-
``` bash
106-
lean-package-validator validate --overwrite [<directory>]
107-
```
108-
> [!WARNING]
109-
> As of release `v5.0` the `--create` and `--overwrite` options are deprecated and will be removed in the next major
110-
> release. Please migrate to the dedicated commands `create` and `update`.
111-
11295
The `--glob-pattern` option allows you to overwrite the default pattern used to match common repository artefacts. The
11396
number of patterns in the grouping braces is expected to be `>1`. As shown next, this utility could thereby also be used
11497
for projects (i.e. Python) outside the PHP ecosystem.
@@ -148,24 +131,18 @@ The `--keep-glob-pattern` option allows keeping matching files in the release/di
148131
lean-package-validator validate --keep-glob-pattern '{LICENSE.*,README.*,docs*}' [<directory>]
149132
```
150133

151-
The `--align-export-ignores|-a` option will align the created or overwritten export-ignores for better readability.
152-
153-
``` bash
154-
lean-package-validator validate --align-export-ignores --create [<directory>]
155-
```
156-
157134
The `--sort-from-directories-to-files|-s` option will order the export-ignores from directories to files for better readability.
158135

159136
``` bash
160-
lean-package-validator validate --sort-from-directories-to-files --create [<directory>]
137+
lean-package-validator validate --sort-from-directories-to-files [<directory>]
161138
```
162139

163140
The `--enforce-alignment` option will enforce a strict alignment of export-ignores
164141
in the `.gitattributes` file and fail validation if they aren't aligned. Per __default__,
165142
no alignment is enforced.
166143

167-
The `--preset=[<preset>]` option will use a predefined set of glob pattern.
168-
Available presets are `PHP`, `Python`, `Rust`, `JavaScript`, and `Go`. With `PHP` being the default.
144+
The `--preset=[<preset>]` option will use a predefined set of glob pattern. Available presets are `PHP`, `Python`,
145+
`Rust`, `JavaScript`, and `Go`. With `PHP` being the default.
169146

170147
The `--validate-git-archive` option will validate that no common repository artefacts slip
171148
into the release/dist archive file. It will do so by creating a `temporary archive` from the
@@ -198,8 +175,8 @@ Would expect the following .gitattributes file content:
198175
bin/release-version export-ignore
199176
```
200177

201-
The `--report-stale-export-ignores` option extends the validation to look for export-ignore statements referencing non-existent
202-
repository artefacts. In combination with the `--diff` option these will be shown in the output.
178+
The `--report-stale-export-ignores` option extends the validation to look for export-ignore statements referencing
179+
non-existent repository artefacts. In combination with the `--diff` option these will be shown in the output.
203180

204181
The `--stdin-input` option allows the validate command to read from `STDIN`, so that the following piped output
205182
can be used for validation. It currently only does a strict comparison.
@@ -212,14 +189,12 @@ cat .gitattributes | lean-package-validator validate --stdin-input
212189

213190
#### Create command
214191

215-
The `create` command will create a `.gitattributes` file in the given directory. This command replaces the `--create`
216-
option of the `validate` command. Please migrate to the dedicated commands.
192+
The `create` command will create a `.gitattributes` file in the given directory.
217193

218194
#### Update command
219195

220-
The `update` command will update a present `.gitattributes` file in the given directory. This command replaces the `--overwrite`
221-
option of the `validate` command. Please migrate to the dedicated commands. Like the above-mentioned `create` command it
222-
provides a `--dry-run` option to see what the `.gitattributes` content would look like.
196+
The `update` command will update a present `.gitattributes` file in the given directory. Like the above-mentioned `create`
197+
command it provides a `--dry-run` option to see what the `.gitattributes` content would look like.
223198

224199
#### Reformat command
225200

src/Commands/Concerns/GeneratesGitattributesOptions.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function addGenerationOptions(callable $addOption): void
4646
/**
4747
* Apply generation-related options to the analyser.
4848
*/
49-
protected function applyGenerationOptions(InputInterface $input, OutputInterface $output, AbstractExportIgnoreAnalyser $analyser): bool
49+
protected function applyGenerationOptions(InputInterface $input, OutputInterface $output, AbstractExportIgnoreAnalyser $analyser, string $commandName): bool
5050
{
5151
$globPattern = $input->getOption('glob-pattern');
5252
$globPatternFile = (string) $input->getOption('glob-pattern-file');
@@ -56,7 +56,12 @@ protected function applyGenerationOptions(InputInterface $input, OutputInterface
5656
$keepReadme = (bool) $input->getOption('keep-readme');
5757
$keepGlobPattern = (string) ($input->getOption('keep-glob-pattern') ?? '');
5858

59-
$alignExportIgnores = (bool) $input->getOption('align-export-ignores');
59+
$alignExportIgnores = false;
60+
61+
if ($commandName !== 'validate') {
62+
$alignExportIgnores = (bool) $input->getOption('align-export-ignores');
63+
}
64+
6065
$sortFromDirectoriesToFiles = (bool) $input->getOption('sort-from-directories-to-files');
6166
$enforceStrictOrderComparison = (bool) $input->getOption('enforce-strict-order');
6267

src/Commands/CreateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7777
}
7878

7979
// Apply options that influence generation
80-
if (!$this->applyGenerationOptions($input, $output, $this->analyser->getActualExportIgnoreAnalyser())) {
80+
if (!$this->applyGenerationOptions($input, $output, $this->analyser->getActualExportIgnoreAnalyser(), $this->getName())) {
8181
return self::FAILURE;
8282
}
8383

src/Commands/UpdateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8282
}
8383

8484
// Apply options that influence generation
85-
if (!$this->applyGenerationOptions($input, $output, $this->exportIgnoreAnalyser)) {
85+
if (!$this->applyGenerationOptions($input, $output, $this->exportIgnoreAnalyser, $this->getName())) {
8686
return self::FAILURE;
8787
}
8888

0 commit comments

Comments
 (0)