Skip to content

Replace StringLineReader w/ StringScanner#98

Merged
kevmoo merged 2 commits intomasterfrom
cleanup
Mar 10, 2026
Merged

Replace StringLineReader w/ StringScanner#98
kevmoo merged 2 commits intomasterfrom
cleanup

Conversation

@kevmoo
Copy link
Copy Markdown
Owner

@kevmoo kevmoo commented Mar 10, 2026

No description provided.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the internal string parsing mechanism by replacing a custom StringLineReader implementation with the more robust and standard string_scanner package. This change improves code maintainability and leverages an established library for string manipulation, affecting how commit and tag data are parsed.

Highlights

  • Replaced custom StringLineReader: The custom StringLineReader class, previously marked with a TODO to refactor, has been entirely removed from lib/src/bot.dart.
  • Adopted string_scanner package: The string_scanner package is now used for efficient string parsing, replacing the custom implementation across lib/src/commit.dart and lib/src/tag.dart.
  • StringScanner extension for line reading: An extension StringScannerX was added in lib/src/util.dart to provide a readNextLine() method, mimicking the functionality of the removed custom reader.
  • Dependency update: The pubspec.yaml file has been updated to include the string_scanner package as a new dependency.
Changelog
  • lib/src/bot.dart
    • Removed the custom StringLineReader class.
  • lib/src/commit.dart
    • Replaced import 'bot.dart' with import 'package:string_scanner/string_scanner.dart'.
    • Modified parse, parseRawRevList, and _parse methods to utilize StringScanner for content processing.
    • Adjusted logic for reading lines and the remainder of the string to align with the StringScanner API.
  • lib/src/tag.dart
    • Added import 'package:string_scanner/string_scanner.dart'.
    • Updated the parseCatFile method to use StringScanner for parsing tag content.
  • lib/src/util.dart
    • Added import 'package:string_scanner/string_scanner.dart'.
    • Introduced StringScannerX extension to StringScanner providing a readNextLine() method.
    • Defined a private _lineRegexp for use within the readNextLine() extension.
  • pubspec.yaml
    • Added string_scanner: ^1.4.1 to the dependencies section.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a great improvement, replacing the custom StringLineReader with the standard string_scanner package. This enhances maintainability. I have one suggestion to make the implementation even cleaner by using LineScanner instead of creating a custom extension on StringScanner, which would simplify the code and leverage the library more effectively.

Comment thread lib/src/util.dart
@kevmoo kevmoo merged commit d798865 into master Mar 10, 2026
10 checks passed
@kevmoo kevmoo deleted the cleanup branch March 10, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant