Vauxoo / pylint-odoo

1 stars 4 forks source link

[FIX] translation-required: Consider other valid cases and fix false negative #148

Closed moylop260 closed 6 years ago

moylop260 commented 6 years ago

Fix https://github.com/Vauxoo/pylint-odoo/issues/147

luisg123v commented 6 years ago

@moylop260 What do you think about this?

Please, if you agree with this approach, let me squash before merging, or at least use my commit's title & description.

moylop260 commented 6 years ago
luisg123v commented 6 years ago
  1. Checking...
  2. $ pylint -rn --load-plugins=pylint_odoo -d all -e translation-required ~/odoo/addons-vauxoo/
    No config file found, using default configuration
    $
luisg123v commented 6 years ago

@moylop260 Done, there were only a few flake8 issues. I also added more cases, I'd like to know if you agree with them.

moylop260 commented 6 years ago

Could you review what is wrong in your local pylint command... because my output for addons-vauxoo branch 10.0 was:

************* Module addons-vauxoo.product_extended_variants.wizard.wizard_price
product_extended_variants/wizard/wizard_price.py:38: [C8107(translation-required), WizardPrice._post_message] String parameter on "message_post" requires translation. Use subject=_('Automatically Computed Standard Price')
product_extended_variants/wizard/wizard_price.py:133: [C8107(translation-required), WizardPrice.execute_cron] String parameter on "message_post" requires translation. Use subject=_(('Updated at %s at %s') % ((IDENTIFIER, WHEN)))
product_extended_variants/wizard/wizard_price.py:139: [C8107(translation-required), WizardPrice.execute_cron] String parameter on "message_post" requires translation. Use subject=_(('Successfully updated at %s ') % (WHEN))
product_extended_variants/wizard/wizard_price.py:139: [C8107(translation-required), WizardPrice.execute_cron] String parameter on "message_post" requires translation. Use body=_(('File is on %s for errors and in %s for Ok Products.') % ((logfname, logfull)))
************* Module addons-vauxoo.purchase_third_validation.models.purchase_third_validation_installer
purchase_third_validation/models/purchase_third_validation_installer.py:66: [C8107(translation-required), PurchaseConfigSettings._check_amount_validations] String parameter on "Warning" requires translation. Use _('The limit amount to the second approbation must be less that amount to third validation')
************* Module addons-vauxoo.send_author_mail.tests.test_mail_author
send_author_mail/tests/test_mail_author.py:55: [C8107(translation-required), TestMailMailAuthor.test_receive_mail_author] String parameter on "message_post" requires translation. Use body=_('Message')
send_author_mail/tests/test_mail_author.py:85: [C8107(translation-required), TestMailMailAuthor.test_not_receive_mail_author] String parameter on "message_post" requires translation. Use body=_('Message')
send_author_mail/tests/test_mail_author.py:115: [C8107(translation-required), TestMailMailAuthor.test_not_receive_mail_author_2] String parameter on "message_post" requires translation. Use body=_('Message')
send_author_mail/tests/test_mail_author.py:145: [C8107(translation-required), TestMailMailAuthor.test_not_receive_mail_author3] String parameter on "message_post" requires translation. Use body=_('Message')

For the message: product_extended_variants/wizard/wizard_price.py:133: [C8107(translation-required), WizardPrice.execute_cron] String parameter on "message_post" requires translation. Use subject=_(('Updated at %s at %s') % ((IDENTIFIER, WHEN)))

Should be ... Use subject=_('Updated at %s at %s' % (IDENTIFIER, WHEN)) Notice that there is not extra ()

For the message Use body=_('Body not translatable {}'.format

Should be the format(...) <- complete sentence...

luisg123v commented 6 years ago

@moylop260 I'm getting the following output:

 ************* Module product_extended_variants.wizard.wizard_price
C: 38,15: String parameter on "message_post" requires translation. Use subject=_('Automatically Computed Standard Price') (translation-required)
C:133,12: String parameter on "message_post" requires translation. Use subject=_('Updated at %s at %s') (translation-required)
C:139, 8: String parameter on "message_post" requires translation. Use subject=_('Successfully updated at %s ') (translation-required)
C:139, 8: String parameter on "message_post" requires translation. Use body=_('File is on %s for errors and in %s for Ok Products.') (translation-required)
************* Module purchase_third_validation.models.purchase_third_validation_installer
C: 66,12: String parameter on "Warning" requires translation. Use _('The limit amount to the second approbation must be less that amount to third validation') (translation-required)
************* Module send_author_mail.tests.test_mail_author
C: 55,22: String parameter on "message_post" requires translation. Use body=_('Message') (translation-required)
C: 85,22: String parameter on "message_post" requires translation. Use body=_('Message') (translation-required)
C:115,22: String parameter on "message_post" requires translation. Use body=_('Message') (translation-required)
C:145,22: String parameter on "message_post" requires translation. Use body=_('Message') (translation-required)

Do you think that is find?

moylop260 commented 6 years ago

Thanks!