This module allow sending content to translate to Smartcat.
This module create translation for content by file with translation uploaded from Smartcat

Project link

https://www.drupal.org/project/smartcat_translation_manager

Git instructions

git clone -b 8.x-1.x https://git.drupalcode.org/project/smartcat_translation_manager.git

PAReview checklist

https://pareview.sh/pareview/https-git.drupal.org-project-smartcat_trans...

CommentFileSizeAuthor
#36 also-error-on-admin-uninstall.jpg359.21 KBvuil
#15 pareview.txt47.95 KBklausi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anton Lysak created an issue. See original summary.

saesa’s picture

Issue summary: View changes
Status: Active » Needs work

Thank you for your contribution! I added the PAReview checklist in the issue summary. You should review it.

saesa’s picture

Issue summary: View changes
saesa’s picture

Title: [D8] Smartcat translation manager » [D8] Smartcat Translation Manager
saesa’s picture

You should create the 8.x-1.x branch and replace the 8.x-1.x tag with 8.x-1.0

apaderno’s picture

Assigned: Smartcat Development » Unassigned
Issue summary: View changes

Thank you for applying! While the project was created by you, none of the commits are associated with your account. We need a project where the only commits are from you, until this application is not approved.

apaderno’s picture

Status: Needs work » Closed (won't fix)

I am closing this application due to lack of replies. Please see the previous comments for what needs to be fixed.

Smartcat Development’s picture

Hi! Thanks for review! I just work on issue. Sorry. So, I should reopen issue or create new?

apaderno’s picture

@Anton If those commits are from you, just set the status of this issue to Needs review. If those commits are not from you, edit the OP to provide another project and set the status of this issue to Needs review.
See also comment #5 for the branch to delete, and the one to use.

In the first case, check the Git settings for the project, as the email used for the commits is not one associated with your account. That is why the commits aren't associated to your account.

Smartcat Development’s picture

@kiamaluno Thanks! Just one more question: should i translate commits description to english?

apaderno’s picture

Yes, English is the language to use for those descriptions. Every user on drupal.org should be able to read the commit descriptions.

Smartcat Development’s picture

i pushed new master with right commits, but in project page nothing changed. Look page view commits https://www.drupal.org/node/3042050/commits . How fix it?

apaderno’s picture

master is not a correct branch, on drupal.org. The project page doesn't show any change because there aren't releases.

A correct branch for Drupal 8 is, for example, 8.x-1.x. With a branch like that, you can create a development snapshot.

Smartcat Development’s picture

Status: Closed (won't fix) » Needs review
klausi’s picture

Status: Needs review » Needs work
Issue tags: +PAreview: security
FileSize
47.95 KB

Thanks for your contribution!

Review:
* Project page is empty. Please describe what your module does. See https://www.drupal.org/node/997024
* Please fix all the coding standard errors, see attachment.
* There is a vendor folder in git, please remove that. composer.json is enough.
* smartcat_translation_manager_enable(): empty function, this is not needed? Please remove all empty function or add comments why you need them.
* "_permission: 'administer'" is not a valid permission name, so you module will not work for any user because nobody can have that permission. Please define correct permission names in your *.permissions.yml file.
* /admin/smartcat/project/delete/{id}: this path is vulnerable to CSRF exploits. You need to use a confirmation form before performing data changing operations or you need to validate a CSRF token. Please check all your routes if that happens somewhere else as well. Please also don't remove the security tag, we keep that for statistics and to show examples of security problems.

Smartcat Development’s picture

Hi, we fixed all review issues. Project ready for review again.

Smartcat Development’s picture

Status: Needs work » Needs review
klausi’s picture

Status: Needs review » Needs work

manual review:

* smartcat_translation_manager.permissions.yml: the permission names you are using already exist in Drupal core. If you are just reusing permissions then you don't need to define the permissions again.
* JS files: they still use 4 space indentation. Can you check the Drupal coding standards for Javascript and format them correctly? Please also document in code comments what they are doing.
* "Send your contact": all user facing text must run through Drupal.t() for translation. Same for the table headers in DocumentController.
* /admin/smartcat/document/refresh/{id} still looks vulnerable to CSRF exploits. Is it a problem if an attacker triggers a translation refresh? I'm not sure how destructive that operation is, maybe it does not matter if an attacker can trigger 1000 translation refreshes?
* ConfigForm: it looks like there is an API committed as code comment? What is 1e80d715-db82-43e8-b134-f54c2b64de28? Never put API keys are password into code. If this is a valid key please remove it and invalidate it now because it is publicly known now. Otherwise can you comment in code what it means?

Smartcat Development’s picture

Status: Needs work » Needs review

Thanks!
Module ready to review again.

vuil’s picture

Status: Needs review » Needs work

Thank you for the application submission.

Please, fix the issues related to your Git branches and tags, at first.

Git errors:

Some of the DrupalPractice issues with your code:

  • Global constants should not be used, move it to a class or interface
  • \Drupal calls should be avoided in classes, use dependency injection instead
  • Unused variables: $documents, $account, $i, etc.
  • t() calls should be avoided in classes, use dependency injection and $this->t() instead
Smartcat Development’s picture

Status: Needs work » Needs review

Branch "Prod" has long been removed.
Just now removed master branch.
Codesniffer DrupalPractice errors fixed.

vuil’s picture

Status: Needs review » Needs work

Thank you @Anton Lysak!

Please, it also needs to fix the issue mentioned on this PAReview page:

klausi’s picture

Status: Needs work » Needs review

Coding standard problems are not application blockers, any security issues that you found?

vuil’s picture

Status: Needs review » Needs work

1. Manual review:

* Remove all unused variables and classes from your code.
* JS files: Use let and const instead of var to avoid Reference errors.
* Please follow the Coding standards everywhere, incl. @annotations. There are many Arguments PHPDoc missing.
* ConfigForm: __construct is probably missing ConfigFormBase::__construct call.
* Please don't use $form = []; and the array is overridden immediately right after that.
* Revise the usage of all variables because many of them might have not been defined (before this usage).

2. Please fix this issue on PAReview page at first:

then you will see all issues that will need to be fixed.

3. And please check why after a clean install (and empty DB) on '/admin/smartcat' I receive the error:
PHP Error: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxx.smartcat_translation_manager_documents' doesn't exist: SELECT COUNT(*) AS expr

You did a great work! Just keep on moving.

Smartcat Development’s picture

Hi @i.vuchkov

By points:

* Remove all unused variables and classes from your code.

Unused variables is already removed, after fix issues given Drupal and DrupalPractice standards. But we removed unused "use namespace\class".

* JS files: Use let and const instead of var to avoid Reference errors.

Fixed.

* Please follow the Coding standards everywhere, incl. @annotations. There are many Arguments PHPDoc missing.

PHPdoc is already added with fixed DrupalPractice issues. @annotations added when it need, for example Plugin\Action\SendToTranslateToSmartcatAction.

* ConfigForm: __construct is probably missing ConfigFormBase::__construct call.

Fixed.

* Please don't use $form = []; and the array is overridden immediately right after that.

Fixed.

* Revise the usage of all variables because many of them might have not been defined

Not found.

* Please fix this issue on PAReview page at first:

Fixed.

3. And please check why after a clean install (and empty DB) on '/admin/smartcat' I receive the error:

Sorry, we can't play this error. Is it possible when hook smartcat_translation_manager_schema not execute. Can you write more about your environments for drupal.

Thanks!

Smartcat Development’s picture

Status: Needs work » Needs review
vuil’s picture

Status: Needs review » Needs work

Thank you for the contribution!

Could you enable some Automated tests here? (As an example)
I want to see what will be resulted there at first.

Please, be patience through the whole review process... Thank you.

vuil’s picture

klausi’s picture

Status: Needs work » Needs review

Tests are not application blockers, please do a security review.

vuil’s picture

Status: Needs review » Needs work

Thank you for the contribution!

Please, replace all deprecated functions in your code with the new ones. An example:
The deprecated function dirname(__FILE__) needs to be replaced with __DIR__ instead.

klausi’s picture

Status: Needs work » Needs review

Deprecated functions are not application blockers. Any security issue that you found or should this be RTBC?

apaderno’s picture

Drupal deprectated functions aren't a Drupal 8 issue, as they will be removed only on Drupal 9.
dirname() isn't a deprecated function, even if __DIR__ is probably preferable.

vuil’s picture

Status: Needs review » Needs work

There is an error on module enable & disable?
Please, see #24 point 3.
The error still persists.

Are you sure for the functionality? Could you provide me the API sandbox link?
I post the similar error on module enable/disable also via drush and empty database:

$ ../vendor/bin/drush en smartcat_translation_manager
The following module(s) will be enabled: smartcat_translation_manager, content_translation, language

 Do you want to continue? (yes/no) [yes]:
 >

 [warning] require_once(/var/www/xxx_xxx/web/modules/smartcat_translation_manager/vendor/autoload.php): failed to open stream: No such file or directory smartcat_translation_manager.module:11

Fatal error: require_once(): Failed opening required '/var/www/xxx_xxx/web/modules/smartcat_translation_manager/vendor/autoload.php' (include_path='/var/www/xxx_xxx/vendor/pear/archive_tar;/var/www/xxx_xxx/vendor/pear/console_getopt;/var/www/xxx_xxx/vendor/pear/pear-core-minimal/src;/var/www/xxx_xxx/vendor/pear/pear_exception;.;C:\php\pear') in /var/www/xxx_xxx/web/modules/smartcat_translation_manager/smartcat_translation_manager.module on line 11
 [warning] Drush command terminated abnormally. Check for an exit() in your Drupal site.
apaderno’s picture

Status: Needs work » Needs review

We don't aim to fix every error in the code. We need to verify what the user understands of correctly using the available APIs, following the coding standards, and writing secure code.

vuil’s picture

It was be good to have a working module, but OK. I have objections only in my previous comments.
Thanks.

vuil’s picture

Please, regular check your module's issues page... This is a friend advise.
Thank you.

Smartcat Development’s picture

Hi @ilchovuchkov
We removed vendor folder by issue from review #15 . For fix it error you can execute `composer install` in module folder.

vuil’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for the contribution!

I have not additional security issues found. Thank you again.

apaderno’s picture

Assigned: Unassigned » apaderno
Status: Reviewed & tested by the community » Fixed

Thank you for your contribution! I am going to update your account.

These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank all the dedicated reviewers as well.

Smartcat Development’s picture

It's wonderful!! Thank you very match!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

vuil’s picture