Closed (fixed)
Project:
Cloud
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
4 Dec 2018 at 08:46 UTC
Updated:
21 Dec 2018 at 12:39 UTC
Jump to comment: Most recent, Most recent file
Changing from abc_xyz() to getAbcXyz()
We focus on only "ERROR | Public method name abc_xyz is not in lowerCamel format" in this issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 3017877-21.patch | 202.61 KB | shidat |
Comments
Comment #2
shidat commentedAdd a big patch.
I changed owner() in entity classes such as Image to getFieldOwner(). The reason I didn’t changed it to getOwner() is that the method getOwner() has already existed in the interface EntityOwnerInterface which the class Image’s parent class CloudContentEntityBase implemented.
Comment #3
xiaohua guan commentedComment #4
deepanker_bhalla commented@shidat: Good work. I can confirm the patch #2 is applying cleanly. Here is the output:
❯ cloud/ 8.x-1.x* git apply -v 3017877-2.patch
Checking patch cloud.module...
Checking patch modules/cloud_server_template/cloud_server_template.module...
Checking patch modules/cloud_server_template/src/Controller/CloudServerTemplateAccessControlHandler.php...
Checking patch modules/cloud_server_template/src/Controller/CloudServerTemplateController.php...
...and more....
Applied patch cloud.module cleanly.
Applied patch modules/cloud_server_template/cloud_server_template.module cleanly.
Applied patch modules/cloud_server_template/src/Controller/CloudServerTemplateAccessControlHandler.php cleanly.
Applied patch modules/cloud_server_template/src/Controller/CloudServerTemplateController.php cleanly.
..and more...
_________________________________________________________________________________________________________
But after checking with phpcs --standard=Drupal cloud/....... I am getting some more issues i.e.
and many more............
Comment #5
yas@deepanker_bhalla
Thank you for your comment. Our team is fixing the coding standard error one by one, this issue makes lots of code changes, other than coding standard, therefore we decided to separate this refactoring task from the other coding standard errors. We focused on only "ERROR | Public method name "abc_xyz" is not in lowerCamel format" in this issue. I updated the description in this issue, too.
FYI, we won't fix *.css.
Comment #6
yas@shidat
I reviewed the patch. You refactored
getFieldOwner()however the method is used the only following code:ImageDeleteForm.phpImageEditForm.phpImageListBuilder.phpIn this case,
getFieldOwner()is not used in the other class other thanDrupal\aws_cloud\Form\Ec2\Image*class. Therefore can we removegetFieldOwner()EXCEPTDrupal\aws_cloud\Form\Ec2\Image*class?Image*class, can we changefield_user_idtoaws_user_id? (field〜is a prefix for Fields in Drupal web application framework? If not, can we change it to toaws_user_id?Comment #7
yas@shidat
Here is a typo in
Instance.phpComment #8
yasI prefer a combination of setSomething and isSomething as the naming convention. e.g.
Comment #9
yasComment #10
baldwinlouie commentedFor the owner field, I think we can following AWS convention. In the AwsEc2Service.php file, when an Image is imported, we are actually looking for an "OwnerId" field. See this url: https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html
Can we change it to getOwnerId(), setOwnerId($owner_id)?
Comment #11
shidat commented@yas-san @baldwinlouie @deepanker_bhalla
Thanks for your reviews.
> I prefer a combination of setSomething and isSomething as the naming convention. e.g.
I changed code as you said.
> Therefore can we remove getFieldOwner() EXCEPT Drupal\aws_cloud\Form\Ec2\Image* class?
I removed the getFieldOwner() except Image* class.
> In Image* class, can we change field_user_id to aws_user_id?
Yes, I can changed the field name. But if I changed it, I think the existing drupal sites using cloud module can’t work. Do you have any idea about it?
And in the new patch file, I didn’t change the field name.
Please take a look at the new patch.
Comment #12
yas@baldwinlouie
How about changing to
getImageOwnerId()andsetImageOwnerId($owner_id)to avoid the confusion sincegetOwnerId()andsetOwnerId($owner_id)are already existing in Drupal APIs? Or can it be overlapped (merge) in between AWS Image owner-id and Drupal API owner id?Comment #13
shidat commentedyas-san
> How about changing to getImageOwnerId() and setImageOwnerId($owner_id)
I changed method name from getFieldOwner and setFieldOwner to getImageOwnerId and setImageOwnerId.
Please take a look at the new patch file. Thanks.
Comment #14
xiaohua guan commentedComment #15
xiaohua guan commentedComment #17
shidat commentedDue to the other commit, the old patch file couldn’t be applied. Therefore I provide a new one. Please take a look, thanks.
Comment #18
xiaohua guan commentedComment #19
xiaohua guan commentedComment #20
yas@shidat
As I mentioned at comment #7, here is a typo in
Instance.phpComment #21
shidat commentedOops, sorry for my miss.
Comment #22
xiaohua guan commentedComment #23
xiaohua guan commentedComment #25
yas@shidat
Thank you for fixing it. I merged the patch and closed this issue.