Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@uuf6429
Copy link
Contributor

@uuf6429 uuf6429 commented Dec 7, 2024

Based on #275.

I tried to find the best-matching set of rules for the project and in the end went with PER-CS + Symfony + minor-adjustments.

In my opinion, there are still some silly/redundant things, such as aligning PHPDoc contents or the file header, but at least this PR fixes any inconsistencies. Let me know if we should actually revise any existing code style.

@uuf6429 uuf6429 marked this pull request as draft December 8, 2024 15:59
@uuf6429 uuf6429 force-pushed the chore/phpcsfixer-setup branch from e6e2a6e to 4e3ddcf Compare December 10, 2024 08:15
@uuf6429 uuf6429 marked this pull request as ready for review December 10, 2024 08:21
@uuf6429 uuf6429 force-pushed the chore/phpcsfixer-setup branch from 136afcf to 8ee3e6f Compare December 11, 2024 23:05
@uuf6429 uuf6429 requested review from acoulton and stof December 11, 2024 23:10
Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @uuf6429 mostly I think the tool setup and changes are OK, with a couple of comments / questions.

There are also some places where the automated fix highlights an opportunity to make a further manual improvement - I would suggest we do those in this branch (but committed separately either at the start or end of the branch) while we can see them?


namespace Behat\Gherkin\Exception;

use RuntimeException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What rule/ruleset does this come from? Personally, I prefer to have use statements for all classes including built-ins.

Copy link
Contributor Author

@uuf6429 uuf6429 Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's the global_namespace_import rule, from the Symfony ruleset.

I don't mind it either way - but it would be good to hear other opinions, perhaps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is indeed this rule.
I'm fine with either configuration for this rule (either always importing or never importing for the global namespace), but the project should be consistent (and currently, I think a lot more code follows the Symfony rule, so changing that should probably be done in a separate PR)

Copy link
Contributor

@acoulton acoulton Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine we'll eventually want Behat/Behat to be consistent with this decision too - @carlos-granados @ttomdewit do you have a preference?

If we do decide to configure it to import everything, I guess we should just disable the rule in this PR rather than change these ones and then change them back.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal preference is to import everything, it makes the code less cluttered

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uuf6429 I make that 2 in favour of import everything, 2 fine either way. I suggest disabling the rule in this PR and reverting the changes it produced, then adding a separate PR to add it (and @ttomdewit can feed into that if he feels strongly about it)?

Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uuf6429 this is looking good, thanks, apart from the changes from the single-line-exceptions rule if you could please fix those?

@acoulton
Copy link
Contributor

@uuf6429 I think it should work if you do an interactive rebase, stop to edit the commit with the automatic changes and disable the rule/re-run it there, then continue the rebase?

There may be a small number of conflicts with manual changes added subsequently to resolve as the rebase continues but probably quicker/safer than reverting them manually (and better for code history)?

@uuf6429

This comment was marked as resolved.

@uuf6429 uuf6429 force-pushed the chore/phpcsfixer-setup branch from 287c946 to 8f204ff Compare December 21, 2024 15:47
@uuf6429
Copy link
Contributor Author

uuf6429 commented Dec 21, 2024

Tests look good. Commits should be even clearer now.

@carlos-granados
Copy link
Contributor

@uuf6429 when we discussed about adding a CS tool in the main Behat repo, we said that we should probably include a .git-blame-ignore-revs file so that all these changes do not alter the blame history. Do you think you might add that in this PR? Thanks!

@uuf6429
Copy link
Contributor Author

uuf6429 commented Dec 21, 2024

Done. Please keep in mind that this PR can no longer be squashed and a rebase will require updating the newly added ignore file.

Copy link
Contributor

@carlos-granados carlos-granados left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good to me now

Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant, thanks @uuf6429

@acoulton acoulton merged commit 51ddede into Behat:master Dec 22, 2024
7 checks passed
@uuf6429 uuf6429 deleted the chore/phpcsfixer-setup branch December 26, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants