better_translate 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CLAUDE.md +12 -7
- data/CONTRIBUTING.md +432 -0
- data/README.md +7 -1
- data/Rakefile +14 -1
- data/SECURITY.md +160 -0
- data/Steepfile +0 -1
- data/brakeman.yml +37 -0
- data/codecov.yml +34 -0
- data/lib/better_translate/analyzer/code_scanner.rb +0 -2
- data/lib/better_translate/analyzer/orphan_detector.rb +6 -3
- data/lib/better_translate/analyzer/reporter.rb +1 -1
- data/lib/better_translate/cli.rb +2 -2
- data/lib/better_translate/configuration.rb +28 -1
- data/lib/better_translate/json_handler.rb +2 -2
- data/lib/better_translate/translator.rb +3 -2
- data/lib/better_translate/version.rb +1 -1
- data/lib/better_translate.rb +2 -0
- data/lib/generators/better_translate/install/install_generator.rb +2 -2
- data/lib/generators/better_translate/install/templates/initializer.rb.tt +22 -34
- data/lib/generators/better_translate/translate/translate_generator.rb +65 -46
- data/lib/tasks/better_translate.rake +62 -45
- data/sig/better_translate/analyzer/code_scanner.rbs +59 -0
- data/sig/better_translate/analyzer/key_scanner.rbs +40 -0
- data/sig/better_translate/analyzer/orphan_detector.rbs +43 -0
- data/sig/better_translate/analyzer/reporter.rbs +70 -0
- data/sig/better_translate/cli.rbs +2 -0
- data/sig/better_translate/json_handler.rbs +65 -0
- data/sig/better_translate/progress_tracker.rbs +1 -1
- data/sig/better_translate.rbs +4 -0
- data/sig/csv.rbs +16 -0
- metadata +26 -3
- data/regenerate_vcr.rb +0 -47
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 602a159b9ba2217e813a2d2b2f5b121e2fcc33006b18f12de64a99eb83ba3b16
         | 
| 4 | 
            +
              data.tar.gz: 9c4db4fb12302620492af42d6db5e369f2d00fac3c62d288d6d11e872bb5acf1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a67b31f8cc1aa48775baddae6982f2bcc0e18a9a3966981b40a6b122e976ebd93922f17cbfc7ae8eeddd8741668006eafcedec13dcdf63cfdd209ed2695f4de3
         | 
| 7 | 
            +
              data.tar.gz: a5f455c8a676a0899bab3e03bf71ed51c6d4a5b16e81cb1bfb6ef90e560352758319a6616e1f269039a47decf14e72070bdfe39be5ebec6457c83cbd9b79a47e
         | 
    
        data/CLAUDE.md
    CHANGED
    
    | @@ -75,10 +75,21 @@ bundle exec rake steep | |
| 75 75 | 
             
            # or
         | 
| 76 76 | 
             
            bundle exec steep check
         | 
| 77 77 |  | 
| 78 | 
            -
            # Run default rake task (runs spec, rubocop, and  | 
| 78 | 
            +
            # Run default rake task (runs spec, rubocop, steep, and brakeman)
         | 
| 79 79 | 
             
            bundle exec rake
         | 
| 80 80 | 
             
            ```
         | 
| 81 81 |  | 
| 82 | 
            +
            ### Security
         | 
| 83 | 
            +
            ```bash
         | 
| 84 | 
            +
            # Run Brakeman security scanner
         | 
| 85 | 
            +
            bundle exec rake brakeman
         | 
| 86 | 
            +
            # or
         | 
| 87 | 
            +
            bundle exec brakeman --force --no-pager
         | 
| 88 | 
            +
             | 
| 89 | 
            +
            # Check for security vulnerabilities in dependencies
         | 
| 90 | 
            +
            bundle exec bundler-audit check --update
         | 
| 91 | 
            +
            ```
         | 
| 92 | 
            +
             | 
| 82 93 | 
             
            ### Documentation
         | 
| 83 94 | 
             
            ```bash
         | 
| 84 95 | 
             
            # Generate YARD documentation
         | 
| @@ -91,12 +102,6 @@ bundle exec yard server | |
| 91 102 | 
             
            bundle exec yard stats
         | 
| 92 103 | 
             
            ```
         | 
| 93 104 |  | 
| 94 | 
            -
            ### Security
         | 
| 95 | 
            -
            ```bash
         | 
| 96 | 
            -
            # Check for security vulnerabilities in dependencies
         | 
| 97 | 
            -
            bundle exec bundler-audit check --update
         | 
| 98 | 
            -
            ```
         | 
| 99 | 
            -
             | 
| 100 105 | 
             
            ### Type Checking (RBS/Steep)
         | 
| 101 106 | 
             
            ```bash
         | 
| 102 107 | 
             
            # Run type checking
         | 
    
        data/CONTRIBUTING.md
    ADDED
    
    | @@ -0,0 +1,432 @@ | |
| 1 | 
            +
            # Contributing to BetterTranslate
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            First off, thank you for considering contributing to BetterTranslate! 🎉
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            It's people like you that make BetterTranslate such a great tool. We welcome contributions from everyone, whether you're fixing a typo or implementing a major feature.
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ## Table of Contents
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            - [Code of Conduct](#code-of-conduct)
         | 
| 10 | 
            +
            - [Getting Started](#getting-started)
         | 
| 11 | 
            +
            - [Development Workflow](#development-workflow)
         | 
| 12 | 
            +
            - [Testing](#testing)
         | 
| 13 | 
            +
            - [Code Style](#code-style)
         | 
| 14 | 
            +
            - [Commit Messages](#commit-messages)
         | 
| 15 | 
            +
            - [Pull Requests](#pull-requests)
         | 
| 16 | 
            +
            - [Reporting Bugs](#reporting-bugs)
         | 
| 17 | 
            +
            - [Suggesting Features](#suggesting-features)
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            ## Code of Conduct
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            This project and everyone participating in it is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            ## Getting Started
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            ### Prerequisites
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            - Ruby >= 3.0.0
         | 
| 28 | 
            +
            - Bundler
         | 
| 29 | 
            +
            - Git
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            ### Fork and Clone
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            1. Fork the repository on GitHub
         | 
| 34 | 
            +
            2. Clone your fork locally:
         | 
| 35 | 
            +
               ```bash
         | 
| 36 | 
            +
               git clone https://github.com/YOUR_USERNAME/better_translate.git
         | 
| 37 | 
            +
               cd better_translate
         | 
| 38 | 
            +
               ```
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            3. Add the upstream repository:
         | 
| 41 | 
            +
               ```bash
         | 
| 42 | 
            +
               git remote add upstream https://github.com/alessiobussolari/better_translate.git
         | 
| 43 | 
            +
               ```
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            ### Install Dependencies
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            ```bash
         | 
| 48 | 
            +
            bundle install
         | 
| 49 | 
            +
            ```
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            ### Set Up Environment
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            1. Copy the example environment file:
         | 
| 54 | 
            +
               ```bash
         | 
| 55 | 
            +
               cp .env.example .env
         | 
| 56 | 
            +
               ```
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            2. Add your API keys (optional, only needed for integration tests):
         | 
| 59 | 
            +
               ```env
         | 
| 60 | 
            +
               OPENAI_API_KEY=sk-...
         | 
| 61 | 
            +
               GEMINI_API_KEY=...
         | 
| 62 | 
            +
               ANTHROPIC_API_KEY=sk-ant-...
         | 
| 63 | 
            +
               ```
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            ## Development Workflow
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            ### 1. Create a Branch
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            Always create a new branch for your work:
         | 
| 70 | 
            +
             | 
| 71 | 
            +
            ```bash
         | 
| 72 | 
            +
            git checkout -b feature/your-feature-name
         | 
| 73 | 
            +
            # or
         | 
| 74 | 
            +
            git checkout -b fix/your-bug-fix
         | 
| 75 | 
            +
            ```
         | 
| 76 | 
            +
             | 
| 77 | 
            +
            ### 2. Make Your Changes
         | 
| 78 | 
            +
             | 
| 79 | 
            +
            - Write clean, readable code
         | 
| 80 | 
            +
            - Follow the existing code style
         | 
| 81 | 
            +
            - Add tests for new features
         | 
| 82 | 
            +
            - Update documentation as needed
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            ### 3. Run Tests
         | 
| 85 | 
            +
             | 
| 86 | 
            +
            Before committing, make sure all tests pass:
         | 
| 87 | 
            +
             | 
| 88 | 
            +
            ```bash
         | 
| 89 | 
            +
            # Run all tests
         | 
| 90 | 
            +
            bundle exec rake
         | 
| 91 | 
            +
             | 
| 92 | 
            +
            # Or run individual checks:
         | 
| 93 | 
            +
            bundle exec rake spec          # Tests
         | 
| 94 | 
            +
            bundle exec rake rubocop       # Linting
         | 
| 95 | 
            +
            bundle exec rake steep         # Type checking
         | 
| 96 | 
            +
            bundle exec rake brakeman      # Security scan
         | 
| 97 | 
            +
            ```
         | 
| 98 | 
            +
             | 
| 99 | 
            +
            ### 4. Commit Your Changes
         | 
| 100 | 
            +
             | 
| 101 | 
            +
            ```bash
         | 
| 102 | 
            +
            git add .
         | 
| 103 | 
            +
            git commit -m "feat: Add awesome feature"
         | 
| 104 | 
            +
            ```
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            See [Commit Messages](#commit-messages) for guidelines.
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            ### 5. Push and Create PR
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            ```bash
         | 
| 111 | 
            +
            git push origin feature/your-feature-name
         | 
| 112 | 
            +
            ```
         | 
| 113 | 
            +
             | 
| 114 | 
            +
            Then create a Pull Request on GitHub.
         | 
| 115 | 
            +
             | 
| 116 | 
            +
            ## Testing
         | 
| 117 | 
            +
             | 
| 118 | 
            +
            ### Test Structure
         | 
| 119 | 
            +
             | 
| 120 | 
            +
            - **Unit Tests**: `spec/better_translate/`
         | 
| 121 | 
            +
              - Fast, no API calls
         | 
| 122 | 
            +
              - Use WebMock for HTTP stubs
         | 
| 123 | 
            +
             | 
| 124 | 
            +
            - **Integration Tests**: `spec/integration/`
         | 
| 125 | 
            +
              - Real API interactions via VCR
         | 
| 126 | 
            +
              - Require API keys for first run
         | 
| 127 | 
            +
              - Subsequent runs use recorded cassettes
         | 
| 128 | 
            +
             | 
| 129 | 
            +
            ### Running Tests
         | 
| 130 | 
            +
             | 
| 131 | 
            +
            ```bash
         | 
| 132 | 
            +
            # All tests
         | 
| 133 | 
            +
            bundle exec rspec
         | 
| 134 | 
            +
             | 
| 135 | 
            +
            # Only unit tests (fast)
         | 
| 136 | 
            +
            bundle exec rspec spec/better_translate/
         | 
| 137 | 
            +
             | 
| 138 | 
            +
            # Only integration tests
         | 
| 139 | 
            +
            bundle exec rspec spec/integration/ --tag integration
         | 
| 140 | 
            +
             | 
| 141 | 
            +
            # Specific file
         | 
| 142 | 
            +
            bundle exec rspec spec/better_translate/translator_spec.rb
         | 
| 143 | 
            +
             | 
| 144 | 
            +
            # Specific line
         | 
| 145 | 
            +
            bundle exec rspec spec/better_translate/translator_spec.rb:42
         | 
| 146 | 
            +
            ```
         | 
| 147 | 
            +
             | 
| 148 | 
            +
            ### Writing Tests
         | 
| 149 | 
            +
             | 
| 150 | 
            +
            **We follow Test-Driven Development (TDD)**:
         | 
| 151 | 
            +
             | 
| 152 | 
            +
            1. **RED**: Write a failing test
         | 
| 153 | 
            +
            2. **GREEN**: Write minimum code to pass
         | 
| 154 | 
            +
            3. **REFACTOR**: Clean up code
         | 
| 155 | 
            +
             | 
| 156 | 
            +
            Example:
         | 
| 157 | 
            +
             | 
| 158 | 
            +
            ```ruby
         | 
| 159 | 
            +
            RSpec.describe MyNewFeature do
         | 
| 160 | 
            +
              describe "#awesome_method" do
         | 
| 161 | 
            +
                it "does something awesome" do
         | 
| 162 | 
            +
                  feature = MyNewFeature.new
         | 
| 163 | 
            +
                  result = feature.awesome_method
         | 
| 164 | 
            +
             | 
| 165 | 
            +
                  expect(result).to eq("awesome")
         | 
| 166 | 
            +
                end
         | 
| 167 | 
            +
              end
         | 
| 168 | 
            +
            end
         | 
| 169 | 
            +
            ```
         | 
| 170 | 
            +
             | 
| 171 | 
            +
            ### Test Coverage
         | 
| 172 | 
            +
             | 
| 173 | 
            +
            We maintain **93%+ test coverage**. New code should include tests:
         | 
| 174 | 
            +
             | 
| 175 | 
            +
            ```bash
         | 
| 176 | 
            +
            # Check coverage
         | 
| 177 | 
            +
            bundle exec rspec
         | 
| 178 | 
            +
            # View coverage report: open coverage/index.html
         | 
| 179 | 
            +
            ```
         | 
| 180 | 
            +
             | 
| 181 | 
            +
            ## Code Style
         | 
| 182 | 
            +
             | 
| 183 | 
            +
            ### RuboCop
         | 
| 184 | 
            +
             | 
| 185 | 
            +
            We use RuboCop for code style enforcement:
         | 
| 186 | 
            +
             | 
| 187 | 
            +
            ```bash
         | 
| 188 | 
            +
            # Check style
         | 
| 189 | 
            +
            bundle exec rubocop
         | 
| 190 | 
            +
             | 
| 191 | 
            +
            # Auto-fix issues
         | 
| 192 | 
            +
            bundle exec rubocop -a
         | 
| 193 | 
            +
            ```
         | 
| 194 | 
            +
             | 
| 195 | 
            +
            ### Key Guidelines
         | 
| 196 | 
            +
             | 
| 197 | 
            +
            - Use double quotes for strings
         | 
| 198 | 
            +
            - 2 spaces for indentation (no tabs)
         | 
| 199 | 
            +
            - Maximum line length: 120 characters
         | 
| 200 | 
            +
            - Frozen string literals at top of files: `# frozen_string_literal: true`
         | 
| 201 | 
            +
            - YARD documentation for public methods
         | 
| 202 | 
            +
             | 
| 203 | 
            +
            ### YARD Documentation
         | 
| 204 | 
            +
             | 
| 205 | 
            +
            All public methods must have YARD documentation:
         | 
| 206 | 
            +
             | 
| 207 | 
            +
            ```ruby
         | 
| 208 | 
            +
            # Translates text to target language
         | 
| 209 | 
            +
            #
         | 
| 210 | 
            +
            # @param text [String] The text to translate
         | 
| 211 | 
            +
            # @param lang [String] Target language code (e.g., "it", "fr")
         | 
| 212 | 
            +
            # @return [String] Translated text
         | 
| 213 | 
            +
            # @raise [ValidationError] If input is invalid
         | 
| 214 | 
            +
            #
         | 
| 215 | 
            +
            # @example
         | 
| 216 | 
            +
            #   translate("Hello", "it") #=> "Ciao"
         | 
| 217 | 
            +
            #
         | 
| 218 | 
            +
            def translate(text, lang)
         | 
| 219 | 
            +
              # ...
         | 
| 220 | 
            +
            end
         | 
| 221 | 
            +
            ```
         | 
| 222 | 
            +
             | 
| 223 | 
            +
            ### Type Checking
         | 
| 224 | 
            +
             | 
| 225 | 
            +
            We use Steep for static type checking:
         | 
| 226 | 
            +
             | 
| 227 | 
            +
            ```bash
         | 
| 228 | 
            +
            # Run type checker
         | 
| 229 | 
            +
            bundle exec steep check
         | 
| 230 | 
            +
             | 
| 231 | 
            +
            # Check specific file
         | 
| 232 | 
            +
            bundle exec steep check lib/better_translate/translator.rb
         | 
| 233 | 
            +
            ```
         | 
| 234 | 
            +
             | 
| 235 | 
            +
            Type signatures go in `sig/` directory (RBS format).
         | 
| 236 | 
            +
             | 
| 237 | 
            +
            ## Commit Messages
         | 
| 238 | 
            +
             | 
| 239 | 
            +
            We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
         | 
| 240 | 
            +
             | 
| 241 | 
            +
            ### Format
         | 
| 242 | 
            +
             | 
| 243 | 
            +
            ```
         | 
| 244 | 
            +
            <type>(<scope>): <subject>
         | 
| 245 | 
            +
             | 
| 246 | 
            +
            <body>
         | 
| 247 | 
            +
             | 
| 248 | 
            +
            <footer>
         | 
| 249 | 
            +
            ```
         | 
| 250 | 
            +
             | 
| 251 | 
            +
            ### Types
         | 
| 252 | 
            +
             | 
| 253 | 
            +
            - `feat`: New feature
         | 
| 254 | 
            +
            - `fix`: Bug fix
         | 
| 255 | 
            +
            - `docs`: Documentation changes
         | 
| 256 | 
            +
            - `style`: Code style changes (formatting, no logic change)
         | 
| 257 | 
            +
            - `refactor`: Code refactoring
         | 
| 258 | 
            +
            - `test`: Adding or updating tests
         | 
| 259 | 
            +
            - `chore`: Maintenance tasks
         | 
| 260 | 
            +
             | 
| 261 | 
            +
            ### Examples
         | 
| 262 | 
            +
             | 
| 263 | 
            +
            ```bash
         | 
| 264 | 
            +
            # Good commits
         | 
| 265 | 
            +
            git commit -m "feat: Add support for JSON locale files"
         | 
| 266 | 
            +
            git commit -m "fix: Handle nil values in translations"
         | 
| 267 | 
            +
            git commit -m "docs: Update README with new examples"
         | 
| 268 | 
            +
            git commit -m "test: Add coverage for edge cases"
         | 
| 269 | 
            +
             | 
| 270 | 
            +
            # With scope
         | 
| 271 | 
            +
            git commit -m "feat(cli): Add --dry-run flag"
         | 
| 272 | 
            +
            git commit -m "fix(cache): Fix TTL expiration bug"
         | 
| 273 | 
            +
            ```
         | 
| 274 | 
            +
             | 
| 275 | 
            +
            ### Multi-line Commits
         | 
| 276 | 
            +
             | 
| 277 | 
            +
            For complex changes:
         | 
| 278 | 
            +
             | 
| 279 | 
            +
            ```
         | 
| 280 | 
            +
            feat: Add parallel translation support
         | 
| 281 | 
            +
             | 
| 282 | 
            +
            - Implement thread-based concurrent execution
         | 
| 283 | 
            +
            - Add max_concurrent_requests configuration
         | 
| 284 | 
            +
            - Include progress tracking for parallel operations
         | 
| 285 | 
            +
             | 
| 286 | 
            +
            Closes #42
         | 
| 287 | 
            +
            ```
         | 
| 288 | 
            +
             | 
| 289 | 
            +
            ## Pull Requests
         | 
| 290 | 
            +
             | 
| 291 | 
            +
            ### Before Submitting
         | 
| 292 | 
            +
             | 
| 293 | 
            +
            - [ ] Tests pass: `bundle exec rake`
         | 
| 294 | 
            +
            - [ ] Code follows style guide
         | 
| 295 | 
            +
            - [ ] YARD documentation added for public methods
         | 
| 296 | 
            +
            - [ ] CHANGELOG.md updated (for notable changes)
         | 
| 297 | 
            +
            - [ ] README.md updated (if needed)
         | 
| 298 | 
            +
             | 
| 299 | 
            +
            ### PR Title
         | 
| 300 | 
            +
             | 
| 301 | 
            +
            Use conventional commit format:
         | 
| 302 | 
            +
             | 
| 303 | 
            +
            ```
         | 
| 304 | 
            +
            feat: Add awesome feature
         | 
| 305 | 
            +
            fix: Resolve critical bug
         | 
| 306 | 
            +
            docs: Improve installation guide
         | 
| 307 | 
            +
            ```
         | 
| 308 | 
            +
             | 
| 309 | 
            +
            ### PR Description Template
         | 
| 310 | 
            +
             | 
| 311 | 
            +
            ```markdown
         | 
| 312 | 
            +
            ## Description
         | 
| 313 | 
            +
            Brief description of changes
         | 
| 314 | 
            +
             | 
| 315 | 
            +
            ## Type of Change
         | 
| 316 | 
            +
            - [ ] Bug fix
         | 
| 317 | 
            +
            - [ ] New feature
         | 
| 318 | 
            +
            - [ ] Breaking change
         | 
| 319 | 
            +
            - [ ] Documentation update
         | 
| 320 | 
            +
             | 
| 321 | 
            +
            ## Testing
         | 
| 322 | 
            +
            How has this been tested?
         | 
| 323 | 
            +
             | 
| 324 | 
            +
            ## Checklist
         | 
| 325 | 
            +
            - [ ] Tests pass locally
         | 
| 326 | 
            +
            - [ ] Tests added for new features
         | 
| 327 | 
            +
            - [ ] Documentation updated
         | 
| 328 | 
            +
            - [ ] No RuboCop offenses
         | 
| 329 | 
            +
            - [ ] No Brakeman warnings
         | 
| 330 | 
            +
            ```
         | 
| 331 | 
            +
             | 
| 332 | 
            +
            ### Review Process
         | 
| 333 | 
            +
             | 
| 334 | 
            +
            1. Automated checks run (CI/CD)
         | 
| 335 | 
            +
            2. Maintainer reviews code
         | 
| 336 | 
            +
            3. Address feedback if needed
         | 
| 337 | 
            +
            4. Maintainer merges PR
         | 
| 338 | 
            +
             | 
| 339 | 
            +
            ## Reporting Bugs
         | 
| 340 | 
            +
             | 
| 341 | 
            +
            ### Before Submitting
         | 
| 342 | 
            +
             | 
| 343 | 
            +
            - Check existing issues
         | 
| 344 | 
            +
            - Try latest version
         | 
| 345 | 
            +
            - Gather reproduction steps
         | 
| 346 | 
            +
             | 
| 347 | 
            +
            ### Bug Report Template
         | 
| 348 | 
            +
             | 
| 349 | 
            +
            ```markdown
         | 
| 350 | 
            +
            **Describe the bug**
         | 
| 351 | 
            +
            Clear description of the bug
         | 
| 352 | 
            +
             | 
| 353 | 
            +
            **To Reproduce**
         | 
| 354 | 
            +
            Steps to reproduce:
         | 
| 355 | 
            +
            1. ...
         | 
| 356 | 
            +
            2. ...
         | 
| 357 | 
            +
            3. ...
         | 
| 358 | 
            +
             | 
| 359 | 
            +
            **Expected behavior**
         | 
| 360 | 
            +
            What you expected to happen
         | 
| 361 | 
            +
             | 
| 362 | 
            +
            **Actual behavior**
         | 
| 363 | 
            +
            What actually happened
         | 
| 364 | 
            +
             | 
| 365 | 
            +
            **Environment**
         | 
| 366 | 
            +
            - Ruby version: [e.g., 3.3.4]
         | 
| 367 | 
            +
            - BetterTranslate version: [e.g., 1.1.0]
         | 
| 368 | 
            +
            - OS: [e.g., macOS, Ubuntu]
         | 
| 369 | 
            +
             | 
| 370 | 
            +
            **Additional context**
         | 
| 371 | 
            +
            Any other relevant information
         | 
| 372 | 
            +
            ```
         | 
| 373 | 
            +
             | 
| 374 | 
            +
            ## Suggesting Features
         | 
| 375 | 
            +
             | 
| 376 | 
            +
            We love feature suggestions! Open an issue with:
         | 
| 377 | 
            +
             | 
| 378 | 
            +
            ```markdown
         | 
| 379 | 
            +
            **Feature Description**
         | 
| 380 | 
            +
            Clear description of the feature
         | 
| 381 | 
            +
             | 
| 382 | 
            +
            **Use Case**
         | 
| 383 | 
            +
            Why is this feature needed?
         | 
| 384 | 
            +
             | 
| 385 | 
            +
            **Proposed Solution**
         | 
| 386 | 
            +
            How should it work?
         | 
| 387 | 
            +
             | 
| 388 | 
            +
            **Alternatives Considered**
         | 
| 389 | 
            +
            Other approaches you've thought about
         | 
| 390 | 
            +
             | 
| 391 | 
            +
            **Additional Context**
         | 
| 392 | 
            +
            Screenshots, mockups, examples, etc.
         | 
| 393 | 
            +
            ```
         | 
| 394 | 
            +
             | 
| 395 | 
            +
            ## Development Commands
         | 
| 396 | 
            +
             | 
| 397 | 
            +
            ```bash
         | 
| 398 | 
            +
            # Run all checks
         | 
| 399 | 
            +
            bundle exec rake
         | 
| 400 | 
            +
             | 
| 401 | 
            +
            # Individual checks
         | 
| 402 | 
            +
            bundle exec rake spec          # Tests (541 examples)
         | 
| 403 | 
            +
            bundle exec rake rubocop       # Linting
         | 
| 404 | 
            +
            bundle exec rake steep         # Type checking
         | 
| 405 | 
            +
            bundle exec rake brakeman      # Security scan
         | 
| 406 | 
            +
             | 
| 407 | 
            +
            # Code quality
         | 
| 408 | 
            +
            bundle exec rubocop -a         # Auto-fix style issues
         | 
| 409 | 
            +
            bundle exec yard doc           # Generate documentation
         | 
| 410 | 
            +
            bundle exec bundler-audit      # Check dependencies
         | 
| 411 | 
            +
             | 
| 412 | 
            +
            # Interactive console
         | 
| 413 | 
            +
            bin/console
         | 
| 414 | 
            +
             | 
| 415 | 
            +
            # Demo app
         | 
| 416 | 
            +
            ruby spec/dummy/demo_translation.rb
         | 
| 417 | 
            +
            ```
         | 
| 418 | 
            +
             | 
| 419 | 
            +
            ## Questions?
         | 
| 420 | 
            +
             | 
| 421 | 
            +
            Feel free to:
         | 
| 422 | 
            +
            - Open an issue
         | 
| 423 | 
            +
            - Start a discussion
         | 
| 424 | 
            +
            - Email: alessio.bussolari@pandev.it
         | 
| 425 | 
            +
             | 
| 426 | 
            +
            ## License
         | 
| 427 | 
            +
             | 
| 428 | 
            +
            By contributing, you agree that your contributions will be licensed under the MIT License.
         | 
| 429 | 
            +
             | 
| 430 | 
            +
            ---
         | 
| 431 | 
            +
             | 
| 432 | 
            +
            Thank you for contributing to BetterTranslate! 🚀
         | 
    
        data/README.md
    CHANGED
    
    | @@ -2,9 +2,15 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            > AI-powered YAML locale file translator for Rails and Ruby projects
         | 
| 4 4 |  | 
| 5 | 
            +
            [](https://github.com/alessiobussolari/better_translate/actions/workflows/main.yml)
         | 
| 6 | 
            +
            [](https://codecov.io/gh/alessiobussolari/better_translate)
         | 
| 7 | 
            +
            [](https://badge.fury.io/rb/better_translate)
         | 
| 8 | 
            +
            [](https://rubygems.org/gems/better_translate)
         | 
| 5 9 | 
             
            [](https://www.ruby-lang.org/en/)
         | 
| 6 10 | 
             
            [](LICENSE.txt)
         | 
| 7 | 
            -
            [](https://brakemanscanner.org/)
         | 
| 12 | 
            +
            [](https://github.com/soutaro/steep)
         | 
| 13 | 
            +
            [](https://github.com/alessiobussolari/better_translate/graphs/commit-activity)
         | 
| 8 14 |  | 
| 9 15 | 
             
            BetterTranslate automatically translates your YAML locale files using cutting-edge AI providers (ChatGPT, Google Gemini, and Anthropic Claude). It's designed for Rails applications but works with any Ruby project that uses YAML-based internationalization.
         | 
| 10 16 |  | 
    
        data/Rakefile
    CHANGED
    
    | @@ -15,4 +15,17 @@ task :steep do | |
| 15 15 | 
             
              sh "bundle exec steep check"
         | 
| 16 16 | 
             
            end
         | 
| 17 17 |  | 
| 18 | 
            -
             | 
| 18 | 
            +
            # Security scanning with Brakeman
         | 
| 19 | 
            +
            desc "Run security scanning with Brakeman"
         | 
| 20 | 
            +
            task :brakeman do
         | 
| 21 | 
            +
              require "brakeman"
         | 
| 22 | 
            +
              result = Brakeman.run(
         | 
| 23 | 
            +
                app_path: ".",
         | 
| 24 | 
            +
                print_report: true,
         | 
| 25 | 
            +
                pager: false,
         | 
| 26 | 
            +
                force_scan: true
         | 
| 27 | 
            +
              )
         | 
| 28 | 
            +
              exit Brakeman::Warnings_Found_Exit_Code unless result.filtered_warnings.empty?
         | 
| 29 | 
            +
            end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            task default: %i[spec rubocop steep brakeman]
         | 
    
        data/SECURITY.md
    ADDED
    
    | @@ -0,0 +1,160 @@ | |
| 1 | 
            +
            # Security Policy
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            ## Supported Versions
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            We release patches for security vulnerabilities. Currently supported versions:
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            | Version | Supported          |
         | 
| 8 | 
            +
            | ------- | ------------------ |
         | 
| 9 | 
            +
            | 1.1.x   | :white_check_mark: |
         | 
| 10 | 
            +
            | 1.0.x   | :white_check_mark: |
         | 
| 11 | 
            +
            | < 1.0   | :x:                |
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ## Security Measures
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            BetterTranslate implements multiple security measures to protect your data and application:
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            ### 🔒 Static Security Analysis
         | 
| 18 | 
            +
            - **Brakeman**: Automated security scanner running on every commit
         | 
| 19 | 
            +
            - Checks for 76+ security vulnerabilities including:
         | 
| 20 | 
            +
              - SQL Injection
         | 
| 21 | 
            +
              - Cross-Site Scripting (XSS)
         | 
| 22 | 
            +
              - Command Injection
         | 
| 23 | 
            +
              - File Access vulnerabilities
         | 
| 24 | 
            +
              - Unsafe Deserialization
         | 
| 25 | 
            +
              - Mass Assignment issues
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            ### 🛡️ Dependency Security
         | 
| 28 | 
            +
            - **Bundler Audit**: Regular checks for vulnerable dependencies
         | 
| 29 | 
            +
            - Automated dependency updates via Dependabot (if configured)
         | 
| 30 | 
            +
            - Minimal runtime dependencies (only Faraday)
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            ### 🔐 API Key Protection
         | 
| 33 | 
            +
            - API keys are never logged or stored in code
         | 
| 34 | 
            +
            - VCR cassettes automatically anonymize API keys
         | 
| 35 | 
            +
            - `.env` files are git-ignored by default
         | 
| 36 | 
            +
            - Comprehensive validation prevents key exposure
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            ### ✅ Code Quality
         | 
| 39 | 
            +
            - **RuboCop**: Style and security linting
         | 
| 40 | 
            +
            - **Steep**: Static type checking
         | 
| 41 | 
            +
            - 93%+ test coverage with comprehensive test suite
         | 
| 42 | 
            +
            - Type-safe configuration with validation
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            ## Reporting a Vulnerability
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            We take security seriously. If you discover a security vulnerability, please follow these steps:
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            ### 🚨 **DO NOT** disclose the vulnerability publicly
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            Please report security vulnerabilities privately to protect users.
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            ### 📧 How to Report
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            **Email**: alessio.bussolari@pandev.it
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            **Subject**: `[SECURITY] BetterTranslate Vulnerability Report`
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            **Include in your report**:
         | 
| 59 | 
            +
            1. **Description** of the vulnerability
         | 
| 60 | 
            +
            2. **Steps to reproduce** the issue
         | 
| 61 | 
            +
            3. **Potential impact** and attack scenarios
         | 
| 62 | 
            +
            4. **Suggested fix** (if you have one)
         | 
| 63 | 
            +
            5. **Your contact information** for follow-up
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            ### ⏱️ Response Timeline
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            - **Initial Response**: Within 48 hours
         | 
| 68 | 
            +
            - **Status Update**: Within 7 days
         | 
| 69 | 
            +
            - **Fix Timeline**: Depending on severity
         | 
| 70 | 
            +
              - Critical: 24-48 hours
         | 
| 71 | 
            +
              - High: 7 days
         | 
| 72 | 
            +
              - Medium: 30 days
         | 
| 73 | 
            +
              - Low: 90 days
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            ### 🎁 Recognition
         | 
| 76 | 
            +
             | 
| 77 | 
            +
            We appreciate security researchers who responsibly disclose vulnerabilities:
         | 
| 78 | 
            +
             | 
| 79 | 
            +
            - Your name will be credited in our CHANGELOG (unless you prefer to remain anonymous)
         | 
| 80 | 
            +
            - We may offer a "Hall of Fame" mention in this file
         | 
| 81 | 
            +
            - Significant findings may be eligible for acknowledgment in release notes
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            ## Security Best Practices
         | 
| 84 | 
            +
             | 
| 85 | 
            +
            When using BetterTranslate:
         | 
| 86 | 
            +
             | 
| 87 | 
            +
            ### ✅ Recommended Practices
         | 
| 88 | 
            +
             | 
| 89 | 
            +
            1. **API Keys**:
         | 
| 90 | 
            +
               - Store API keys in environment variables
         | 
| 91 | 
            +
               - Use `.env` files (never commit them)
         | 
| 92 | 
            +
               - Rotate keys regularly
         | 
| 93 | 
            +
               - Use separate keys for dev/staging/production
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            2. **Configuration**:
         | 
| 96 | 
            +
               - Validate all configuration before use
         | 
| 97 | 
            +
               - Use `config.validate!` explicitly
         | 
| 98 | 
            +
               - Review exclusion lists for sensitive data
         | 
| 99 | 
            +
               - Enable dry_run mode for testing
         | 
| 100 | 
            +
             | 
| 101 | 
            +
            3. **File Permissions**:
         | 
| 102 | 
            +
               - Restrict access to locale files
         | 
| 103 | 
            +
               - Review backup files (`.bak`) security
         | 
| 104 | 
            +
               - Use appropriate file permissions (644 for files, 755 for directories)
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            4. **Dependencies**:
         | 
| 107 | 
            +
               - Run `bundle audit` regularly
         | 
| 108 | 
            +
               - Keep gems updated
         | 
| 109 | 
            +
               - Review CHANGELOG for security updates
         | 
| 110 | 
            +
             | 
| 111 | 
            +
            ### ❌ Avoid These Mistakes
         | 
| 112 | 
            +
             | 
| 113 | 
            +
            1. **DO NOT** hardcode API keys in source code
         | 
| 114 | 
            +
            2. **DO NOT** commit `.env` files to version control
         | 
| 115 | 
            +
            3. **DO NOT** expose translation API keys in client-side code
         | 
| 116 | 
            +
            4. **DO NOT** disable SSL verification in production
         | 
| 117 | 
            +
            5. **DO NOT** ignore Brakeman or RuboCop security warnings
         | 
| 118 | 
            +
             | 
| 119 | 
            +
            ## Security Scanning
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            ### Run Security Checks Locally
         | 
| 122 | 
            +
             | 
| 123 | 
            +
            ```bash
         | 
| 124 | 
            +
            # Run Brakeman security scanner
         | 
| 125 | 
            +
            bundle exec rake brakeman
         | 
| 126 | 
            +
             | 
| 127 | 
            +
            # Check for vulnerable dependencies
         | 
| 128 | 
            +
            bundle exec bundler-audit check --update
         | 
| 129 | 
            +
             | 
| 130 | 
            +
            # Run full test suite with security checks
         | 
| 131 | 
            +
            bundle exec rake  # includes spec, rubocop, steep, brakeman
         | 
| 132 | 
            +
            ```
         | 
| 133 | 
            +
             | 
| 134 | 
            +
            ### Continuous Integration
         | 
| 135 | 
            +
             | 
| 136 | 
            +
            Our CI pipeline automatically runs:
         | 
| 137 | 
            +
            - Brakeman security scanner
         | 
| 138 | 
            +
            - RuboCop with security cops
         | 
| 139 | 
            +
            - Steep type checking
         | 
| 140 | 
            +
            - Comprehensive test suite (541 tests)
         | 
| 141 | 
            +
            - Code coverage analysis (93%+)
         | 
| 142 | 
            +
             | 
| 143 | 
            +
            ## Additional Resources
         | 
| 144 | 
            +
             | 
| 145 | 
            +
            - [OWASP Top 10](https://owasp.org/www-project-top-ten/)
         | 
| 146 | 
            +
            - [Ruby Security](https://ruby-lang.org/en/security/)
         | 
| 147 | 
            +
            - [Brakeman Documentation](https://brakemanscanner.org/docs/)
         | 
| 148 | 
            +
            - [Bundler Audit](https://github.com/rubysec/bundler-audit)
         | 
| 149 | 
            +
             | 
| 150 | 
            +
            ## Security Hall of Fame
         | 
| 151 | 
            +
             | 
| 152 | 
            +
            Thank you to these security researchers who helped improve BetterTranslate:
         | 
| 153 | 
            +
             | 
| 154 | 
            +
            <!-- Future contributors will be listed here -->
         | 
| 155 | 
            +
            _No vulnerabilities reported yet._
         | 
| 156 | 
            +
             | 
| 157 | 
            +
            ---
         | 
| 158 | 
            +
             | 
| 159 | 
            +
            **Last Updated**: 2025-10-23
         | 
| 160 | 
            +
            **Contact**: alessio.bussolari@pandev.it
         |