Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Libraries] Remove unused functions from Utility and update cleanup comments #2913

Merged
merged 1 commit into from
Feb 26, 2018
Merged

[Libraries] Remove unused functions from Utility and update cleanup comments #2913

merged 1 commit into from
Feb 26, 2018

Conversation

johnsaigle
Copy link
Contributor

  • Delete functions marked as unused in the function comments (and confirmed by a Github search).

  • Update function comments to reflect some locations where they are used

@johnsaigle johnsaigle added Release: Breaking changes PR that contains changes that might impact the code or accepted practices of active projects Cleanup PR or issue introducing/requiring at least one clean-up operation labels Jun 28, 2017
@johnsaigle johnsaigle added this to the 17.2 milestone Jun 28, 2017
@driusan
Copy link
Collaborator

driusan commented Jun 28, 2017

This needs to go to 18.0. There's no way to determine that they're unused by any project overrides or instruments in the wild.

@johnsaigle johnsaigle modified the milestones: 18.0, 17.2 Jun 28, 2017
@johnsaigle johnsaigle changed the title [Utility] Remove unused functions and update cleanup comments [Libraries] Remove unused functions from Utility and update cleanup comments Jul 3, 2017
@johnsaigle
Copy link
Contributor Author

Note: changes made by @AnyhowStep in #2889 have now been merged into this PR. The other PR will be closed.

@johnsaigle
Copy link
Contributor Author

johnsaigle commented Jul 4, 2017

@ridz1208 This PR is an update of #2889 which was opened by @AnyhowStep. You said his PR should go to 17.2.

Do you think this should be in 17.2 or 18.0? My vote is 17.2 but @driusan said 18.0. Do you have a preference?

@johnsaigle johnsaigle added the State: Discussion required PR or issue that requires the resolution of a discussion with the relevant parties to proceed label Jul 4, 2017
@driusan driusan removed this from the 19.0 milestone Oct 2, 2017
@ridz1208 ridz1208 modified the milestones: 19.1, 20.0 Oct 20, 2017
@ridz1208 ridz1208 changed the base branch from 17.1-dev to major October 21, 2017 17:40
@driusan driusan self-requested a review November 22, 2017 21:44
* @note This is no longer used and should be removed
* @cleanup
*/
static function getListOfSubjectEthnicities()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed not being used

* by NDB_Form_candidate_parameters and if so, should be moved there.
* @cleanup
*/
static function explodeEncapsulated($seperator, $delimiter, $string)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used in candidate_parameters on IBIS

@sruthymathew123 if you can get rid of it or move it to the class it is used in, then when you confirm we'll be able to remove safely

* @note Function comment written by Dave, not the author of this function.
* @note This function does not appear to be used anymore.
* @cleanup
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed not used

* @return The name from the given array row.
* @note Function should be removed and code using it cleaned up.
* @cleanup
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed not used

* @return The name from the given array row.
* @note Function should be removed and code using it cleaned up.
* @cleanup
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed not used

*
* @cleanup
*/
static function getColumnThresholdCount()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed not used

* module uses it. (Data team helper?)
* @note Function comment written by Dave, not the author of this function.
* @cleanup
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IBIS redefines this function in its ProjectUtility class but neither functions are used anywhere in the code

@sruthymathew123 potential clean-up for you !

* module uses it. (Data team helper?)
* @note Function comment written by Dave, not the author of this function.
* @cleanup
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same...
IBIS redefines this function in its ProjectUtility class but neither functions are used anywhere in the code

@sruthymathew123 potential clean-up for you !

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was used by the really old "quat table" DQT. It's unused, and IBIS ProjectUtility probably just copied the Utility to start with.

Copy link
Collaborator

@ridz1208 ridz1208 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the changes are fine, some of the comments are not constructive and should be removed

@@ -660,6 +574,10 @@ class Utility
* to null.
*
* @return array The same array passed in, after modifications.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note should be removed

@@ -565,6 +544,8 @@ class Utility
* @return array If $var is an array, var, otherwise an array containing $var
* @cleanup This should be removed and all uses converted to toArray
* (or vice versa, but toArray seems to be more common in the code)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note should be removed

@@ -546,6 +523,8 @@ class Utility
* @param mixed $var The variable to be converted to an array.
*
* @return array If $var is an array, var, otherwise an array containing $var
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note should be removed

@ridz1208 ridz1208 removed the State: Discussion required PR or issue that requires the resolution of a discussion with the relevant parties to proceed label Nov 23, 2017
@ridz1208
Copy link
Collaborator

@zaliqarosli let's talk about this one

@zaliqarosli zaliqarosli self-assigned this Dec 26, 2017
/**
* Checks to see if a table contains a specified column
*
* @param string $table_name The table to check for a column.
* @param string $column The column name to check the table for.
*
* @return boolean true if the table has at least one NULL in the column
* @note This should really be in the Database.class.inc file... -anyhowstep
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this note in .. @ridz1208 should it be moved to Database?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably, but not as part of this PR, and the note is still pointless to have. If anything, there should be a redmine ticket for it (or just a PR that does it and deprecates this)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against the notes, i tend to look at code more then redmine myself

@zaliqarosli
Copy link
Contributor

zaliqarosli commented Dec 27, 2017

This branch seems to be well out of sync, it doesn't generate a front-end for me. Need rebasing? @driusan @ridz1208 looks like its the Database class

* The return value format seems weird. Should possibly be refactored.
* @note Used in:
* - data_team_helper/php/NDB_Form_data_team_helper.class.inc
* - data_team_helper/ajax/GetInstruments.php
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A redmine ticket saying to move this to the data_team_helper and verify that that's the only place that it's used is better than a comment saying where it's used (which would need to be maintained, and may become outdated..)

@ridz1208
Copy link
Collaborator

ridz1208 commented Jan 3, 2018

@zaliqarosli I will let you attempt a rebase on your local repo. if you encounter any problems let me know

cleaned up and added some notes

gitignore

Removed Utility::lookupBattery, There is already a NDB_BVL_Battery::lookupBattery and Utility version is not being used in core

Restored Utility::lookupBattery(), tools/fix_timepoint_date_problems uses it

Remove unused functions; update cleanup comments

Phpcs and formatting

update PHP version from 5 to 7

Remove note to self

Remove invalid notes

Remove notes
@zaliqarosli
Copy link
Contributor

@ridz1208 please re-review. thanks!

@ridz1208
Copy link
Collaborator

@driusan I think this should be merge early if you agree

@driusan driusan merged commit 31dacf4 into aces:major Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleanup PR or issue introducing/requiring at least one clean-up operation Release: Breaking changes PR that contains changes that might impact the code or accepted practices of active projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants