Closed Mefisto04 closed 1 month ago
The pull request introduces significant modifications to the PythonManipulator
class in src/core/file/fileManipulate.ts
. Key changes include a simplification of the removeHashComments
method and a refactor of the rtrimLines
function for improved readability. A new function, getOrCreateManipulator
, has been added to handle the instantiation of manipulators based on file extensions, while the existing getFileManipulator
function has been updated to utilize this new method. The CompositeManipulator
class remains unchanged.
File Path | Change Summary |
---|---|
src/core/file/fileManipulate.ts | - Simplified removeDocStrings method logic. |
- Simplified removeHashComments method by replacing binary search with a more concise approach. |
|
- Refactored rtrimLines function to use string manipulation instead of regex. |
|
- Added getOrCreateManipulator function for instantiating manipulators based on file extensions. |
|
- Updated getFileManipulator to utilize getOrCreateManipulator while maintaining its signature. |
removeDocStrings
and removeHashComments
methods in the PythonManipulator
class within the same file, src/core/file/fileManipulator.ts
, indicating a strong connection to the changes made in the main PR.@Mefisto04 Thank you for your quick implements!
However, it seems that the lint checks and tests are currently failing. Could you please take a look and address the following:
npm run lint
npm run test
Thanks again for your contributions to improving Repopack's performance.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 76.40%. Comparing base (
6a0b2c4
) to head (713cde3
). Report is 11 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I see that secretlint is throwing an error. Are you perhaps using Windows? It might be an issue with path separators.
@yamadashy yes, i am using windows. so what will be the approach to solve this ? Coz there is no issue in test when i run that
I've committed the lint fixes to your branch. Additionally, I've merged a fix into the main branch that addresses the issue with secretlint not running properly on Windows.
Let me know if you encounter any further issues.
Hi, @Mefisto04
The implementation is perfect, thank you so much! Your changes have significantly improved the code's readability and efficiency.
I'll merge this. Thank you for your contribution!
This pull request includes the following changes:
Refactored
searchInPairs
:hashIndex
falls within string literal pairs. This enhances code readability and maintainability.Enhanced
rtrimLines
Function:String.prototype.trimEnd()
for trimming trailing whitespace from each line, improving performance and efficiency.These changes aim to streamline the code while maintaining the existing functionality and ensuring that all tests pass successfully.
Summary by CodeRabbit
New Features
Refactor
CompositeManipulator
class while restructuring manipulator instantiation and access.