Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"flutter": "stable"
}
11 changes: 9 additions & 2 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: google/dart:2.12.0-133.2.beta
image: dart:stable

steps:
- uses: actions/checkout@v2
Expand All @@ -29,7 +29,14 @@ jobs:
# package:test for this step to succeed. Note that Flutter projects will
# want to change this to 'flutter test'.
- name: Run tests
run: dart run test_coverage #test --coverage=coverage
run: dart test --coverage=coverage

- name: Install coverage tool
run: dart pub global activate coverage

- name: Convert coverage to lcov
run: dart pub global run coverage:format_coverage --lcov -i coverage -o coverage/lcov.info --report-on=lib

- uses: codecov/codecov-action@v1.0.2
with:
token: ${{secrets.CODECOV_TOKEN}} #required
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ build/
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3

# FVM Version Cache
.fvm/
10 changes: 0 additions & 10 deletions .metadata

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dart.flutterSdkPath": ".fvm/versions/stable"
}
61 changes: 61 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Stringr is a comprehensive string manipulation library for Dart/Flutter inspired by VocaJS. It provides powerful string operations that work with Latin, non-Latin, and grapheme cluster strings using complex regular expressions rather than simple whitespace splitting.

**Current Status**: Updated to Dart 3.0+ with modern SDK constraints and comprehensive linting rules.

## Development Commands

### Testing
- `dart test` - Run all tests
- `dart run test_coverage` - Run tests with coverage (used in CI)
- `dart test test/specific_test.dart` - Run specific test file

### Dependencies
- `dart pub get` - Install dependencies
- `dart pub upgrade` - Upgrade dependencies

### Analysis
- `dart analyze` - Static analysis with comprehensive modern Dart linting rules

## Architecture Overview

The library follows a **modular extension-based architecture** with functionality organized into domain-specific modules:

### Core Modules
- **`lib/src/case/`** - Case transformations (camelCase, kebabCase, snakeCase, titleCase)
- **`lib/src/chop/`** - String truncation operations (truncate, slice, prune, first, last)
- **`lib/src/count/`** - Counting operations (characters, graphemes, occurrences, words)
- **`lib/src/escape/`** - String escaping/unescaping (HTML, RegExp)
- **`lib/src/manipulate/`** - String manipulation (insert, reverse, slugify, translate, splice)
- **`lib/src/split/`** - String splitting operations (words, chars, codePoints, graphemes)

### Utility Infrastructure
- **`lib/src/util/object/`** - Generic utility extensions (ExtendedIterable)
- **`lib/src/util/regex/`** - Pre-compiled regex patterns and constants for Unicode handling
- **`lib/src/util/strings/`** - String utility functions, diacritics mapping, and surrogate pair handling

### Key Patterns
- Each module implements a Dart extension on `String` class
- Heavy use of pre-compiled regex patterns for Unicode-aware text processing
- Consistent method signatures with optional parameters and sensible defaults
- Support for complex Unicode scenarios including surrogate pairs and grapheme clusters

## Dependencies
- **`characters`** ^1.3.0 - Used for grapheme cluster support and Unicode handling (Flutter-compatible version)
- **`test`** ^1.26.3 - Modern testing framework (dev dependency)

## Important Notes
- Project uses dependency overrides for `file` and `watcher` packages to ensure Dart 3.0+ compatibility
- The codebase has comprehensive linting rules enforced through `analysis_options.yaml`
- All tests pass on Dart 3.0+ but there are linting warnings that can be addressed incrementally

## CI/CD
- GitHub Actions workflow runs on push/PR to master branch
- Uses latest stable Dart container (`dart:stable`)
- Runs tests with coverage and uploads to Codecov
- Coverage reports stored in `coverage/lcov.info`
125 changes: 121 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,124 @@
analyzer:
enable-experiment:
- non-nullable

language:
strict-casts: true
strict-inference: true
strict-raw-types: true

linter:
rules:
- public_member_api_docs
# Error rules
- always_use_package_imports
- avoid_dynamic_calls
- avoid_empty_else
- avoid_slow_async_io
- cancel_subscriptions
- close_sinks
- comment_references
- control_flow_in_finally
- empty_statements
- hash_and_equals
- no_adjacent_strings_in_list
- no_duplicate_case_values
- no_logic_in_create_state
- prefer_void_to_null
- test_types_in_equals
- throw_in_finally
- unrelated_type_equality_checks
- use_build_context_synchronously
- use_key_in_widget_constructors
- valid_regexps

# Style rules
- always_declare_return_types
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- annotate_overrides
- avoid_bool_literals_in_conditional_expressions
- avoid_catches_without_on_clauses
- avoid_catching_errors
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_print
- avoid_redundant_argument_values
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null_for_void
- avoid_single_cascade_in_expression_statements
- avoid_types_as_parameter_names
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- avoid_void_async
- camel_case_extensions
- camel_case_types
- cascade_invocations
- constant_identifier_names
- curly_braces_in_flow_control_structures
- directives_ordering
- empty_catches
- empty_constructor_bodies
- file_names
- library_names
- library_prefixes
- non_constant_identifier_names
- null_closures
- omit_local_variable_types
- one_member_abstracts
- only_throw_errors
- overridden_fields
- package_names
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
- prefer_null_aware_operators
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- provide_deprecation_message
- public_member_api_docs
- recursive_getters
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
- sort_pub_dependencies
- sort_unnamed_constructors_first
- type_annotate_public_apis
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible
- void_checks
Loading