-
-
Notifications
You must be signed in to change notification settings - Fork 663
Add mago formatter recipe #1811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR 😍 How to test these changes in your application
Diff between recipe versionsIn order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
The pipeline is failling because it doesn't support installing composer plugins 🤔 In theory mago could in fact setup it's own config by itself upon installation but I still think using flex here could help to maintain a config with sensible defaults and continue providing upgrades as the configuration's schema changes. |
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@azjezz Hi, could you please review if this recipe aligns with https://github.com/carthage-software/mago generic configuration for symfony project.
Personally, I would like for format
section to be removed, symfony
plugin enabled, bin
path removed and php_version
somehow resolved at runtime and specified dynamically.
The format section is exactly the default generated by the command |
|
||
# [linter] | ||
# default_plugins = true | ||
# plugins = ["symfony"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a symfony recipe, i think it makes sense to enable symfony
plugin here, maybe php-unit
one as well? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I m realizing now that the linter is still enabled, i thought it would be disabled until specifically configured.
Will fix and enable symfony plugin by default. I guess the phpunit one could also be enabled without any runtime performance penalty right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phpunit plugin is actually super small, there is no performance losse.
What is the reason the default skeleton fails with the symfony
plugin? maybe its something we can change in mago?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default config with symfony and php unit plugins, skeleton app with phpunit installed
config/bundles.php:1:1: warning[strictness/require-strict-types]: Missing `declare(strict_types=1);` statement at the beginning of the file
config/preload.php:1:1: warning[strictness/require-strict-types]: Missing `declare(strict_types=1);` statement at the beginning of the file
public/index.php:7:8: warning[strictness/require-return-type]: Closure is missing a return type hint
public/index.php:1:1: warning[strictness/require-strict-types]: Missing `declare(strict_types=1);` statement at the beginning of the file
tests/bootstrap.php:7:34: warning[best-practices/literal-named-argument]: Literal argument `'bootEnv'` should be passed as a named argument for clarity.
tests/bootstrap.php:12:11: warning[best-practices/literal-named-argument]: Literal argument `0000` should be passed as a named argument for clarity.
tests/bootstrap.php:12:11: warning[migration/explicit-octal-notation]: Use explicit octal numeral notation.
tests/bootstrap.php:1:1: warning[strictness/require-strict-types]: Missing `declare(strict_types=1);` statement at the beginning of the file
src/Kernel.php:1:1: warning[strictness/require-strict-types]: Missing `declare(strict_types=1);` statement at the beginning of the file
This is the tests/bootstrap.php
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}
if ($_SERVER['APP_DEBUG']) {
umask(0000);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think about it I think it could make sense to not report best-practices/literal-named-argument
when the function call has only a single argument 🤔 Or maybe it could be configured on the rule level, but maybe it would be a better default ? wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to disable those rules in the recipe? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk honestly, I'd say it's best to keep them and to let the choice to the user of either fixing the files or tweaking their linter config to match their preferences
[format] | ||
print_width = 120 | ||
tab_width = 4 | ||
use_tabs = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are indeed the defaults, mago init
generates this just to make it obvious where formatting settings go, it could be removed, or commented out with a link to the formatter docs? ref: https://docs.rs/mago-formatter/latest/mago_formatter/settings/struct.FormatSettings.html
Head branch was pushed to by a user without write access
Uh oh!
There was an error while loading. Please reload this page.