react-native-colo-loco icon indicating copy to clipboard operation
react-native-colo-loco copied to clipboard

Sweep: extract functionality into new ruby method

Open jamonholmgren opened this issue 2 years ago • 1 comments

In the ios.rb script, the functionality under this comment:

# Remove files from the existing colocated file_group that are not present in the colocated_files array

...extract that to its own function to be more modular.

jamonholmgren avatar Jul 07 '23 00:07 jamonholmgren

Here's the PR! https://github.com/jamonholmgren/react-native-colo-loco/pull/27


Step 1: 🔍 Code Search

I found the following snippets in your repository. I will now analyze this snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description.

https://github.com/jamonholmgren/react-native-colo-loco/blob/aba5f7b065bbba53d1e1383615e42845f53c6a9a/scripts/ios.rb#L1-L92

https://github.com/jamonholmgren/react-native-colo-loco/blob/aba5f7b065bbba53d1e1383615e42845f53c6a9a/scripts/android.groovy#L1-L136

https://github.com/jamonholmgren/react-native-colo-loco/blob/aba5f7b065bbba53d1e1383615e42845f53c6a9a/README.md#L1-L298

https://github.com/jamonholmgren/react-native-colo-loco/blob/aba5f7b065bbba53d1e1383615e42845f53c6a9a/scripts/install-colo-loco#L1-L190

https://github.com/jamonholmgren/react-native-colo-loco/blob/aba5f7b065bbba53d1e1383615e42845f53c6a9a/test/TestApp/src/views/FooViewManager.m#L1-L29


Step 2: 🧐 Snippet Analysis

From looking through the relevant snippets, I decided to make the following modifications:

File Path Proposed Changes
scripts/ios.rb Extract the functionality under the comment "# Remove files from the existing colocated file_group that are not present in the colocated_files array" into a new method called remove_nonexistent_files. This method should take two parameters: existing_group and colocated_files. Replace the existing code in the link_colocated_native_files method with a call to the new remove_nonexistent_files method.

Step 3: 📝 Planning

I have created a plan for writing the pull request. I am now working on executing my plan and coding the required changes to address this issue. Here is the planned pull request:

Extract File Removal Functionality into New Method sweep/feature/extract-file-removal

This PR addresses issue #26 by making the ios.rb script more modular. Specifically, it extracts the functionality that removes files from the existing colocated file group that are not present in the colocated_files array into a new method called remove_nonexistent_files.

The remove_nonexistent_files method takes two parameters: existing_group and colocated_files. This change makes the code easier to read and maintain, as each method now has a single, clear responsibility.

Please review and let me know if any changes are needed.


Step 4: ⌨️ Coding

I have finished coding the issue. I am now reviewing it for completeness.


Step 5: 🔁 Code Review

Success! 🚀


I'm a bot that handles simple bugs and feature requests but I might make mistakes. Please be kind! Join Our Discord