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
Prettify codebase #1079
Prettify codebase #1079
Conversation
When the review process comes to the conclusion that this change is just adding noise to |
I'm happy to merge this . I don't think it will add too much noise when using |
Just please keep this until the other PRs are merged first. Also do note that I have a WIP branch with proper linting for JS not just formatting. |
@@ -10,7 +10,11 @@ | |||
<div class="panel panel-default"> | |||
<div class="panel-heading"> | |||
<div class="text-center"> | |||
<img src="img/logo.svg" alt="" style="width: <?php if ($boxedlayout) { ?>50%<?php } else { ?>30%<?php } ?>;"> | |||
<img src="img/logo.svg" alt="" style="width: <?php if ($boxedlayout) { | |||
?>50%<?php |
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.
IMHO these kind of changes shouldn't be made. It's quite handy to use one-liners here
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.
This was made by PHP CodeSniffer, I have not manually modified a single line in this PR.
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.
Yeah, we need to tweak the config for sure. The defaults don't cover everything.
I can't find a project I was using to make the config generation easy... I'll try to find it because the defaults clearly cannot cover every case.
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.
Mind that any non-standard configuration will make the entire thing harder. Right now, it is just an still fairly easily to memorize call phpcs --standard=PSR12 ...
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.
Well, the idea is that we don't remember anything. Instead we have scripts that we run. For the JS part this is easily done, but we could also add the phpcs script in the package.json file later.
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.
As long as something will be fairly easily doable in the end, this will be fine with me. I'd prefer to be still able to develop from machines not having a web browser and/or php installed locally, but nothing is forbidden from the beginning here, everything is open for discussion.
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.
We can just have it to run on CI, that's OK too. As long as the patches are kept squashed, this is viable too.
@DL6ER can you apply this only for PHP files and also please post the instructions so that I can see if we can just add a script. |
Everything is already in the pull request description. |
Alright, so unless there's a clear way to automate this, it shouldn't land IMHO. Everything should be automated, and right now it isn't. |
I disagree. It brings everything in a certain shape. It's better to have 99% rather than 0% matching the preferred style. We can easily run there steps I mentioned manually to ensure our code looks good. Furthermore, this could easily be automated on the CI, but if we don't do this, it still makes sense to do it manually. |
Well, I'm not going to do manual steps and neither should any contributor have to do something manually. |
Reran |
This could be done automatically using composer scripts (but that isn't used) and IMO I agree with the author of this PR. Linting code improves maintainability and code quality It should be enforced by the CI. Just because you don't want to do it, it doesn't mean that you shouldn't have to do it. |
Signed-off-by: DL6ER <dl6er@dl6er.de>
Resolved merge conflicts |
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: |
Closing to reduce the reviewing workload |
By submitting this pull request, I confirm the following:
git rebase
)git commit --signoff
)What does this PR aim to accomplish?:
Apply PSR-12 standard to all Pi-hole PHP files
How does this PR accomplish the above?:
Run
There are no functional changes in this PR
I did extensive testing and couldn't find anything that broke with these changes.