Project description

Calculation fields is a module that allows users/devs to create form calculation elements to process math expressions.
Like the code below:
( :field_1 * :field_2 ) + 100
The calculation element listener to the fields involved in the expression and calculates the result after the user changes all those fields.
Enabling the sub-module Webform calculation fields users can create these elements using the webform ui.

Project link

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

Comments

joaopauloc.dev created an issue. See original summary.

vishal.kadam’s picture

Thank you for applying!

Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.

The important notes are the following.

  • If you have not done it yet, you should run phpcs --standard=Drupal,DrupalPractice on the project, which alone fixes most of what reviewers would report.
  • For the time this application is open, only your commits are allowed.
  • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status will not be changed by this application; once this application is closed, you will be able to change the project status from Not covered to Opt into security advisory coverage. This is possible only 14 days after the project is created.
    Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
  • Only the person who created the application will get the permission to opt projects into security advisory coverage. No other person will get the same permission from the same application; that applies also to co-maintainers/maintainers of the project used for the application.
  • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

To the reviewers

Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.

The important notes are the following.

  • It is preferable to wait for a project moderator before posting the first comment on newly created applications. Project moderators will do some preliminary checks that are necessary before any change on the project files is suggested.
  • Reviewers should show the output of a CLI tool only once per application.
  • It may be best to have the applicant fix things before further review.

For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.

vishal.kadam’s picture

Issue summary: View changes
vishal.kadam’s picture

Remember to change status, when the project is ready to be reviewed. In this queue, projects are only reviewed when the status is Needs review.

joaopauloc.dev’s picture

Status: Active » Needs review
rushikesh raval’s picture

Status: Needs review » Needs work

Fix phpcs issues

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml calculation_fields/

FILE: calculation_fields/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 10 WARNINGS AFFECTING 10 LINES
----------------------------------------------------------------------
4 | WARNING | Line exceeds 80 characters; contains 403 characters
9 | WARNING | Line exceeds 80 characters; contains 141 characters
16 | WARNING | Line exceeds 80 characters; contains 86 characters
21 | WARNING | Line exceeds 80 characters; contains 118 characters
24 | WARNING | Line exceeds 80 characters; contains 512 characters
31 | WARNING | Line exceeds 80 characters; contains 178 characters
50 | WARNING | Line exceeds 80 characters; contains 109 characters
53 | WARNING | Line exceeds 80 characters; contains 199 characters
72 | WARNING | Line exceeds 80 characters; contains 118 characters
74 | WARNING | Line exceeds 80 characters; contains 164 characters
----------------------------------------------------------------------

FILE: calculation_fields/calculation_fields.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
--------------------------------------------------------------------------------

FILE: calculation_fields/modules/calculation_fields_example/calculation_fields_example.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
--------------------------------------------------------------------------------

FILE: calculation_fields/modules/webform_calculation_fields/README.md
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
--------------------------------------------------------------------------------
4 | WARNING | Line exceeds 80 characters; contains 395 characters
9 | WARNING | Line exceeds 80 characters; contains 178 characters
18 | WARNING | Line exceeds 80 characters; contains 111 characters
21 | WARNING | Line exceeds 80 characters; contains 118 characters
24 | WARNING | Line exceeds 80 characters; contains 325 characters
25 | WARNING | Line exceeds 80 characters; contains 81 characters
28 | WARNING | Line exceeds 80 characters; contains 213 characters
31 | WARNING | Line exceeds 80 characters; contains 216 characters
34 | WARNING | Line exceeds 80 characters; contains 177 characters
40 | WARNING | Line exceeds 80 characters; contains 223 characters
43 | WARNING | Line exceeds 80 characters; contains 223 characters
46 | WARNING | Line exceeds 80 characters; contains 134 characters
49 | WARNING | Line exceeds 80 characters; contains 271 characters
51 | WARNING | Line exceeds 80 characters; contains 161 characters
--------------------------------------------------------------------------------

FILE: calculation_fields/modules/webform_calculation_fields/webform_calculation_fields.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
--------------------------------------------------------------------------------

FILE: calculation_fields/modules/calculation_fields_example/webform_calculation_fields_examples.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
--------------------------------------------------------------------------------

Time: 165ms; Memory: 10MB

vishal.kadam’s picture

1. FILE: README.md

The module uses a README.md file instead of a README.txt file. While the Drupal coding standards have not been yet updated about that, the Drupal.org community consider that positive.
Since there is a README.md file, that should follow the content and formatting described in README.md template.

2. FILE: calculation_fields.module

/**
 * @file
 * Contains hooks implemented by the calculation fields module.
 */

FILE: modules/calculation_fields_example/calculation_fields_example.module

/**
 * @file
 * Contains custom feature for the module.
 */

The usual description for a .module file is Hook implementations for the [module name] module. where [module name] is the module name given in the .info.yml file.

vishal.kadam’s picture

Priority: Normal » Minor

I am changing priority as per Issue priorities.

vishal.kadam’s picture

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

This thread has been idle, in the Needs work state with no activity for several months. Therefore, I am assuming that you are no longer pursuing this application, and I marked it as Closed (won't fix).

If this is incorrect, and you are still pursuing this application, then please feel free to re-open it and set the issue status to Needs work or Needs review, depending on the current status of your code.

avpaderno’s picture

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

We close as Closed (won't fix) applications created the previous year, whose status has been Needs work for more than eight months.
Let's keep this application open a month more.

joaopauloc.dev’s picture

Status: Needs work » Needs review

Hey folks.
Sorry for the late response.
All PHP-CodeSniffer issues fixed and README file updated.

vishal.kadam’s picture

Priority: Minor » Normal
avpaderno’s picture

Priority: Normal » Minor
vishal.kadam’s picture

Status: Needs review » Needs work

FILE: calculation_fields.info.yml

# project: 'drupal/calculation_fields'

# Information added by Drupal.org packaging script on 2023-11-22
version: "1.0.0-alpha11"
project: "calculation_fields"
datestamp: 1700659783

FILE: modules/calculation_fields_example/calculation_fields_example.info.yml

# Information added by Drupal.org packaging script on 2023-11-22
version: "1.0.0-alpha11"
project: "calculation_fields"
datestamp: 1700659783

FILE: modules/webform_calculation_fields/webform_calculation_fields.info.yml

# Information added by Drupal.org packaging script on 2023-11-22
version: "1.0.0-alpha11"
project: "calculation_fields"
datestamp: 1700659783

FILE: modules/webform_calculation_fields/modules/webform_calculation_fields_examples/webform_calculation_fields_examples.info.yml

# Information added by Drupal.org packaging script on 2023-11-22
version: "1.0.0-alpha11"
project: "calculation_fields"
datestamp: 1700659783

Remove "project", "version" and "datestamp" from the info file, it will be added by drupal.org packaging automatically.

joaopauloc.dev’s picture

Status: Needs work » Needs review

Thanks @vishal.kadam for the feedback.
I remove all the mentioned information from the info modules.

vishal.kadam’s picture

Status: Needs review » Reviewed & tested by the community

Rest looks fine to me.

Let’s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.

avpaderno’s picture

Status: Reviewed & tested by the community » Needs work
  • The following points are just a start and don't necessarily encompass all of the changes that may be necessary
  • A specific point may just be an example and may apply in other places
  • A review is about code that does not follow the coding standards, contains possible security issue, or does not correctly use the Drupal API
  • The single review points are not ordered, not even by importance

src/Element/FormCalculationElement.php

    catch (InvalidExpressionException $invalidExpressionException) {
      $form_state->setError($element, $invalidExpressionException->getMessage());
      return;
    }

The second argument passed to ::setError() must be a translatable string, not a dynamic string.

src/CalculationFieldsTrait.php

  public static function calculationFieldsHandlerService(): CalculationFieldsHandlerExpressionInterface {
    return new CalculationFieldsHandlerExpression();
  }

Drupal has an API to create instances of service classes; they should not be created with new.

In some methods, there are @todo improve this validation. comments. Either those @todo's should be already implemented, or there should be an issue to change the code.

joaopauloc.dev’s picture

Status: Needs work » Needs review

Thank you for reviewing this issue and the feedback @avpaderno
Both comments above regarding getting the service and error message translatable were fixed.

Some of the TODO comments were outdated.
For those that still make sense, I create a new task to address these improvements in the next release.

joaopauloc.dev’s picture

Hey guys, any update on this? I would appreciate that.
Thanks in advance.

bbu23’s picture

Priority: Minor » Critical

Updating priority according to issue priorities.

avpaderno’s picture

Priority: Critical » Normal
Status: Needs review » Reviewed & tested by the community

Thank you for your contribution and for your patience with the review process!

I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.

These are some recommended readings to help you with maintainership:

You can find more contributors chatting on Slack or IRC in #drupal-contribute. So, come hang out and stay involved!
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 also all the reviewers for helping with these applications.

avpaderno’s picture

Status: Reviewed & tested by the community » Fixed
joaopauloc.dev’s picture

Thank you so much guys!

orkutmuratyilmaz’s picture

congratulations:)

Status: Fixed » Closed (fixed)

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