Skip to content

Commit d727044

Browse files
committed
Adds initial Rust preset
1 parent bc84560 commit d727044

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
77

88
## [Unreleased]
99

10+
## [v4.5.0] - 2025-08-27
11+
12+
### Added
13+
- New initial [Rust](https://www.rust-lang.org/) preset.
14+
1015
## [v4.4.6] - 2025-08-26
1116

1217
### Fixed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ lean-package-validator init [<directory>]
201201
The `--overwrite|-o` option overwrites an existing `.lpv` file.
202202

203203
The `--preset` option allows to choose from a predefined set of glob pattern.
204-
Available presets are `PHP`, `Python`, and `Go`. With `PHP` being the default.
204+
Available presets are `PHP`, `Python`, `Rust`, and `Go`. With `PHP` being the default.
205205

206206
#### Tree command
207207

src/Presets/RustPreset.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Stolt\LeanPackage\Presets;
6+
7+
use Stolt\LeanPackage\Preset;
8+
9+
final class RustPreset extends CommonPreset implements Preset
10+
{
11+
public function getPresetGlob(): array
12+
{
13+
return \array_unique(\array_merge($this->getCommonGlob(), [
14+
'benches/**',
15+
'.rustfmt.toml',
16+
'.clippy.toml',
17+
]));
18+
}
19+
}

tests/Commands/InitCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function existingDefaultLpvFileIsNotOverwritten(): void
170170
public function usingANonAvailablePresetShowsWarning(): void
171171
{
172172
$expectedDisplay = <<<CONTENT
173-
Warning: Chosen preset rust is not available. Maybe contribute it?.
173+
Warning: Chosen preset javascript is not available. Maybe contribute it?.
174174
175175
CONTENT;
176176

@@ -179,7 +179,7 @@ public function usingANonAvailablePresetShowsWarning(): void
179179
$commandTester->execute(
180180
['command' => $command->getName(),
181181
'directory' => WORKING_DIRECTORY,
182-
'--preset' => 'rust'],
182+
'--preset' => 'javascript'],
183183
);
184184

185185
$this->assertSame($expectedDisplay, $commandTester->getDisplay());

tests/Presets/FinderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function findsExpectedPresets(): void
1919
$finder = new Finder(new PhpPreset());
2020

2121
$actualPresets = $finder->getAvailablePresets();
22-
$expectedPresets = ['Php', 'Go', 'Python'];
22+
$expectedPresets = ['Php', 'Go', 'Python', 'Rust'];
2323

2424
\sort($actualPresets);
2525
\sort($expectedPresets);

0 commit comments

Comments
 (0)