-
Notifications
You must be signed in to change notification settings - Fork 101
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
#476 crud improvements #477
Conversation
…aces, fix empty lines missing/unnecessary
…ma in _init argument list
…mplate + line > 120 characters install / upgrade methods + phpdocs for repository interface methods
@sallaberry FYI -- I just opened a branch/pr where I'm going to try and get phpcs to do it's thing in our CI/CD build: #479 Once I get that running, we can incorporate that over here and ensure whatever files you intend to have pass the phpcs sniffs pass before checking stuff in. I'll update this PR when I've got #479 working |
Ok thank you. Also after reading more in the already opened similar issues like #273 I realise some of the modifications I submitted might not be to your liking: I agree with the noise problem, but that would be a nice feature to have maybe with an optional argument like --with-phpdocs for all commands ? |
@sallaberry Re:
That may have been true then, but this is now. I'm not doing active, on the ground, Magento work these days (I mean, if someone threw a big giant pile of money or incentive at me I would, but that's another story for another time). I maintain pestle for the benefit of the community, and because I enjoy the privilege of having an open source project that has active users, but not so many active users that it drives me crazy :) At this point, when it comes to the sort of code pestle generates for Magento, I'd rather leave it to someone like yourself and others who are actively engaged in working with the platform. Re: Next steps. I just merged a PR that adds a Could you
Does that sound OK/reasonable? |
Sounds OK.
|
In .travis.yml :
Shouldn't it build pestle.phar from current branch instead of downloading from your site? I'm sorry I'm not familiar with Travis that much... |
You're right. I'd forgotten where that pestle.phar came from and assumed it was the current branch/version. Give me 10/15 minutes and I'll have a "pestle_dev" command available for use in travis. |
Going to need to adjust that 10 - 15 minutes to "later tonight or tomorrow", but I've got a dirty version working here: https://github.com/astorm/pestle/pull/480/files if you want to give it a try This will build and install a pestle.phar from the current branch -- not that pestle_dev approach I started with. |
Ok thanks I'll have a look. |
OK, |
@sallaberry How are you feeling about this? Ready for me to take a look and merge? Or are you still working on stuff? |
Yes I think it's ready if you take a look at what I've done so far. Please check I didn't break anything... I didn't modify the generated php too much so I think It's all good. |
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.
@sallaberry Thanks again for taking this on. I think we're almost there. I just submitted a review with a few comments/questions. If you can answer those and bring the branch up to date with master I think we'll be all set to merge this.
@@ -11,4 +11,6 @@ | |||
mkdir -p app/code/Pulsestorm/Travis | |||
printf "<?php\nnamespace Pulsestorm\\Travis;\n\nclass Foo\n{\n}\n" > app/code/Pulsestorm/Travis/Test.php | |||
|
|||
# pestle.phar magento2:generate:crud-model Pulsestorm_Travis Thing | |||
## test generate:crud-model, rm InstallSchema backup file | |||
pestle.phar magento2:generate:crud-model Pulsestorm_Travis Thing |
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 looking at this line -- am I correct that this PR is only concerned with the formatting on the following files?
app/code/Pulsestorm/Travis/Model/Thing.php
app/code/Pulsestorm/Travis/Model/ThingRepository.php
app/code/Pulsestorm/Travis/Model/ResourceModel/Thing.php
app/code/Pulsestorm/Travis/Model/ResourceModel/Thing/Collection.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.
9 files are generated, 8 if you remove the .bak file
app/code/Pulsestorm/Travis/Model/Thing.php
app/code/Pulsestorm/Travis/Model/ThingRepository.php
app/code/Pulsestorm/Travis/Model/ResourceModel/Thing.php
app/code/Pulsestorm/Travis/Model/ResourceModel/Thing/Collection.php
app/code/Pulsestorm/Travis/Api/ThingRepositoryInterface.php
app/code/Pulsestorm/Travis/Api/Data/ThingInterface.php
app/code/Pulsestorm/Travis/Setup/InstallSchema.php
app/code/Pulsestorm/Travis/Setup/InstallData.php
They all pass phpcs checks now.
In InstallData.php I disabled phpcs for the ->install() method (empty function)
I tried disabling just the specific rule ( // phpcs:disable Magento2.CodeAnalysis.EmptyBlock.DetectedFUNCTION ) it works locally but fails in Travis build.
travis/for-lint.sh
Outdated
# pestle.phar magento2:generate:crud-model Pulsestorm_Travis Thing | ||
## test generate:crud-model, rm InstallSchema backup file | ||
pestle.phar magento2:generate:crud-model Pulsestorm_Travis Thing | ||
rm app/code/Pulsestorm/Travis/Setup/InstallSchema.php.*.bak.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.
+1 for getting rid of the backup files -- what do you think about making this a bit more generic. Something like ...
find app/code/Pulsestorm/Travis -type f -name '*.bak*' -exec rm '{}' \;
That'll get rid of any/all .bak
files now and in the future.
Sorry for the delay, I made the requested changes. |
Great work @sallaberry! And re:
You're offering your free time to improve this software project -- so you get to decide how long you take :) Merging the changes now. I've added this soon-to-be-closed-PR to the "current undated sprint" milestone, and it will go out in the next release of pestle -- which should be soonish (probably when I finish up the remaining documentation items for pestle/internals over on https://pestle.readthedocs.io) Also, semi related, this work led me to open a new issue: #491 -- I think I'd like to get those backup files out of the module folder itself and put somewhere else. |
#476
Trying to make generated code compatible with Magento type hint checks