RSS embed field is a module that allows you to consume RSS feeds from any Link field. It's a more light-weight approach to the problem then using Feeds or Migrate API to write a full import process for the feed.

Project link

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

Git instructions

git clone --branch '8.x-1.x' https://git.drupalcode.org/project/rss_embed_field.git

Comments

jacobbell84 created an issue. See original summary.

gurjinder_pabla’s picture

Status: Needs review » Needs work

There are few place where code is wrong, Have to use dependency injection instead of \Drupal. And instead of t(), need to use $this->t() with use \Drupal\Core\StringTranslation\StringTranslationTrait;
FILE: /rss_embed_field/src/Tests/RssEmbedTest.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------
36 | ERROR | Do not disable strict config schema checking in tests. Instead ensure your module properly declares its schema for configurations.
135 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
136 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
144 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
----------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /rss_embed_field/src/Plugin/Field/FieldFormatter/Rss.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
108 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------

FILE: /rss_embed_field/src/RssFeedFetcher.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
130 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------

jacobbell84’s picture

Status: Needs work » Needs review

Hi gurjinder_pabla,
Thank you for taking the time to review the module code. I believe I've addressed your feedback and committed it back into the 8.x-1.x branch for review.

andrei.vesterli’s picture

Hello @jacobbell84

After the codebase investigation, I've found some moments to look at:

1.
file: web/modules/contrib/rss_embed_field/src/Plugin/Field/FieldFormatter/Rss.php
context: method viewElements()
issue: The use Reader::setExtensionManager($this->reader); may throw an issue due to the following log:
Expected type 'Laminas\Feed\Reader\ExtensionManagerInterface'. Found 'Laminas\Feed\Reader\Reader'

2.
file: web/modules/contrib/rss_embed_field/src/Plugin/Field/FieldFormatter/Rss.php
context: method sanitizeInput()
issue: @param string $allowed_tags. The param must not be described as a string because the web/core/lib/Drupal/Component/Utility/Xss.php has this definition public static function filter($string, array $html_tags = NULL), so, array or NULL. I think, if you'll use @param mixed $allowed_tags will be better.

3.
file: web/modules/contrib/rss_embed_field/src/RssFeedFetcher.php
suggestion: I do usually prefer to write an interface for a service. Your is a 100+ lines file and has several methods inside. I may have the potential to grow (in the future), so, It's just a suggestion/idea to provide a proper interface for it.

4.
file: web/modules/contrib/rss_embed_field/src/RssFeedFetcher.php
suggestion: It's better to provide the variable types for the method arguments like an example: public function fetch($source_url) > public function fetch(string $source_url) etc.

5.
file: composer.json
suggestion:

{
  "name": "drupal/rss_embed_field",
  "type": "drupal-module",
  "minimum-stability": "dev"
  "homepage": "https://www.drupal.org/project/rss_embed_field",
  "license": "GPL-2.0-or-later",
  "require": {
    "php": ">=7.1"
  }
}

The rest seems to be pretty ok for me and you did a really good job!

Regards,
Andrei

jacobbell84’s picture

Thank you @andrei.vesterli! I've implemented the changes into the development branch.

andrei.vesterli’s picture

Nice!

Also, there is a missing LICENTE.txt file (at least GPL - GNU GENERAL PUBLIC LICENSE). See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

Sorry that didn't mention that before.

andrei.vesterli’s picture

Status: Needs review » Needs work
jacobbell84’s picture

Status: Needs work » Needs review

Hi @andrei.vesterli,
It's my understanding that the LICENSE.TXT file is added by the system and isn't needed in the repository, since everything hosted in Drupal falls under the same license. Another entry had been flagged because they included it in their repository, for example: https://www.drupal.org/project/projectapplications/issues/3271971#commen...

andrei.vesterli’s picture

Ah...i got an issue on my module on this exact issue. Anyway, this is good to know! Thx for your input. Then, i have no issues. Who else can review it?

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs review » 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 Slack #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.

Status: Fixed » Closed (fixed)

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