Skip to content
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

introduce phpcs and conform to psr12 #6600

Merged
merged 17 commits into from
Nov 1, 2023
Merged

Conversation

DAcodedBEAT
Copy link
Contributor

What does PR do? Any background context you want to provide?

code style was all over the place so I added phpcs for code linting - I will add more rules later but this change was already getting massive.

What Issues does it Close? Any the relevant tickets?

Screenshots (if appropriate)

Where should the reviewer start?

this might be hard to review...

How should this be manually tested?

regression test

Questions:

  • Is there a related website / article to substantiate / explain this change?

  • Does the development wiki need an update?

    • Yes - Link:
    • No
    • MAYBE - I'm leaning on adding this after we add more phpcs rules
  • Does the user documentation wiki need an update?

    • Yes - Link:
    • No
  • Does this add new dependencies?

    • Yes, but only in development
    • No
  • Does this need to add new data to the demo database

    • Yes
    • No

@brianteeman
Copy link
Contributor

(and yes, I know this is deprecated in favor of psr12 but I wanted to get through these changes iteratively)

Should be fine (and easier) to go directly to psr12

@brianteeman
Copy link
Contributor

Couple of observations from my experience at Joomla when we moved from an internal coding standard to psr-12

We did this in two different pull requests. The first was to set up the tooling and the second was to use the tooling to make the change.

If you want to take a look you can see that in the Joomla build folder there are the conversion scripts /~https://github.com/joomla/joomla-cms/tree/5.0-dev/build/psr12

The second part is to ensure that future code is compliant and that developers can run the checks locally and not have to rely on a github action. For this we have a ruleset.xml in the root and have phpcs installed with composer as a dev dependency

@DAcodedBEAT DAcodedBEAT changed the title introduce phpcs and conform to psr2 introduce phpcs and conform to psr12 Oct 31, 2023
@DAcodedBEAT
Copy link
Contributor Author

Couple of observations from my experience at Joomla when we moved from an internal coding standard to psr-12

We did this in two different pull requests. The first was to set up the tooling and the second was to use the tooling to make the change.

If you want to take a look you can see that in the Joomla build folder there are the conversion scripts /~https://github.com/joomla/joomla-cms/tree/5.0-dev/build/psr12

The second part is to ensure that future code is compliant and that developers can run the checks locally and not have to rely on a github action. For this we have a ruleset.xml in the root and have phpcs installed with composer as a dev dependency

I chose to do it in one PR because it doesn't really make sense to separate out these efforts when one depends on another.
Regarding the second part, this PR currently only has the local check. Once all of our rules are in place, I figured we can create a github action to make sure all future code is compliant.

@DawoudIO
Copy link
Contributor

Thank you again for doing this. This PR is so big I'm unable to process it all. Also there are changes to the backup which seems to be not part of this cleanup

I think I'll see if I can create smaller PRs for my ability to understand and test

@DawoudIO
Copy link
Contributor

Good news I can use the commits to cherry pick into master

@DAcodedBEAT
Copy link
Contributor Author

Thank you again for doing this. This PR is so big I'm unable to process it all. Also there are changes to the backup which seems to be not part of this cleanup

I think I'll see if I can create smaller PRs for my ability to understand and test

BackupManager splitting into file-per-class is part of the same cleanup effort.
The intent of this PR is to resolve the errors raised by the phpcs linter

@brianteeman
Copy link
Contributor

Regarding the second part, this PR currently only has the local check. Once all of our rules are in place, I figured we can create a github action to make sure all future code is compliant

I didnt see the local part

@DAcodedBEAT
Copy link
Contributor Author

Regarding the second part, this PR currently only has the local check. Once all of our rules are in place, I figured we can create a github action to make sure all future code is compliant

I didnt see the local part

Yup, this was added to composer.json and a phpcs.xml.dist file was introduced as well for rules

@brianteeman
Copy link
Contributor

I was looking for something more explicit and obvious

@DawoudIO DawoudIO added this to the 5.1.0 milestone Oct 31, 2023
@DawoudIO DawoudIO self-assigned this Oct 31, 2023
@DawoudIO DawoudIO self-requested a review October 31, 2023 20:30
@DawoudIO DawoudIO added the build label Oct 31, 2023
@DawoudIO DawoudIO merged commit 75535d6 into ChurchCRM:master Nov 1, 2023
@DAcodedBEAT DAcodedBEAT deleted the phpcs branch December 7, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants