deepl-rb 3.3.0 → 3.5.0

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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -2
  3. data/README.md +72 -0
  4. metadata +2 -95
  5. data/.circleci/config.yml +0 -27
  6. data/.github/workflows/add_issues_to_kanban.yml +0 -16
  7. data/.gitlab-ci.yml +0 -172
  8. data/.rubocop.yml +0 -51
  9. data/CODE_OF_CONDUCT.md +0 -132
  10. data/CONTRIBUTING.md +0 -37
  11. data/Gemfile +0 -24
  12. data/Rakefile +0 -54
  13. data/SECURITY.md +0 -58
  14. data/VERSION +0 -1
  15. data/deepl-rb.gemspec +0 -133
  16. data/lib/deepl/api.rb +0 -22
  17. data/lib/deepl/configuration.rb +0 -59
  18. data/lib/deepl/constants/base_constant.rb +0 -18
  19. data/lib/deepl/constants/formality.rb +0 -16
  20. data/lib/deepl/constants/model_type.rb +0 -14
  21. data/lib/deepl/constants/split_sentences.rb +0 -14
  22. data/lib/deepl/constants/tag_handling.rb +0 -13
  23. data/lib/deepl/constants/tone.rb +0 -20
  24. data/lib/deepl/constants/writing_style.rb +0 -20
  25. data/lib/deepl/document_api.rb +0 -121
  26. data/lib/deepl/exceptions/authorization_failed.rb +0 -14
  27. data/lib/deepl/exceptions/bad_request.rb +0 -16
  28. data/lib/deepl/exceptions/document_translation_error.rb +0 -15
  29. data/lib/deepl/exceptions/error.rb +0 -14
  30. data/lib/deepl/exceptions/limit_exceeded.rb +0 -18
  31. data/lib/deepl/exceptions/not_found.rb +0 -16
  32. data/lib/deepl/exceptions/not_supported.rb +0 -14
  33. data/lib/deepl/exceptions/quota_exceeded.rb +0 -14
  34. data/lib/deepl/exceptions/request_entity_too_large.rb +0 -15
  35. data/lib/deepl/exceptions/request_error.rb +0 -21
  36. data/lib/deepl/exceptions/server_error.rb +0 -18
  37. data/lib/deepl/glossary_api.rb +0 -38
  38. data/lib/deepl/requests/base.rb +0 -196
  39. data/lib/deepl/requests/document/download.rb +0 -44
  40. data/lib/deepl/requests/document/get_status.rb +0 -44
  41. data/lib/deepl/requests/document/upload.rb +0 -74
  42. data/lib/deepl/requests/glossary/create.rb +0 -59
  43. data/lib/deepl/requests/glossary/destroy.rb +0 -37
  44. data/lib/deepl/requests/glossary/entries.rb +0 -37
  45. data/lib/deepl/requests/glossary/find.rb +0 -38
  46. data/lib/deepl/requests/glossary/language_pairs.rb +0 -38
  47. data/lib/deepl/requests/glossary/list.rb +0 -37
  48. data/lib/deepl/requests/languages.rb +0 -37
  49. data/lib/deepl/requests/rephrase.rb +0 -55
  50. data/lib/deepl/requests/translate.rb +0 -82
  51. data/lib/deepl/requests/usage.rb +0 -33
  52. data/lib/deepl/resources/base.rb +0 -17
  53. data/lib/deepl/resources/document_handle.rb +0 -57
  54. data/lib/deepl/resources/document_translation_status.rb +0 -54
  55. data/lib/deepl/resources/glossary.rb +0 -28
  56. data/lib/deepl/resources/language.rb +0 -30
  57. data/lib/deepl/resources/language_pair.rb +0 -23
  58. data/lib/deepl/resources/text.rb +0 -24
  59. data/lib/deepl/resources/usage.rb +0 -27
  60. data/lib/deepl/utils/backoff_timer.rb +0 -46
  61. data/lib/deepl/utils/exception_builder.rb +0 -34
  62. data/lib/deepl.rb +0 -147
  63. data/lib/http_client_options.rb +0 -22
  64. data/spec/api/api_spec.rb +0 -20
  65. data/spec/api/configuration_spec.rb +0 -122
  66. data/spec/api/deepl_spec.rb +0 -460
  67. data/spec/constants/constants_spec.rb +0 -158
  68. data/spec/fixtures/vcr_cassettes/deepl_document.yml +0 -95
  69. data/spec/fixtures/vcr_cassettes/deepl_document_download.yml +0 -1214
  70. data/spec/fixtures/vcr_cassettes/deepl_glossaries.yml +0 -1163
  71. data/spec/fixtures/vcr_cassettes/deepl_languages.yml +0 -54
  72. data/spec/fixtures/vcr_cassettes/deepl_rephrase.yml +0 -87
  73. data/spec/fixtures/vcr_cassettes/deepl_translate.yml +0 -358
  74. data/spec/fixtures/vcr_cassettes/deepl_usage.yml +0 -129
  75. data/spec/fixtures/vcr_cassettes/glossaries.yml +0 -1702
  76. data/spec/fixtures/vcr_cassettes/languages.yml +0 -229
  77. data/spec/fixtures/vcr_cassettes/rephrase_texts.yml +0 -401
  78. data/spec/fixtures/vcr_cassettes/translate_texts.yml +0 -10415
  79. data/spec/fixtures/vcr_cassettes/usage.yml +0 -171
  80. data/spec/integration_tests/document_api_spec.rb +0 -177
  81. data/spec/integration_tests/integration_test_utils.rb +0 -170
  82. data/spec/requests/glossary/create_spec.rb +0 -65
  83. data/spec/requests/glossary/destroy_spec.rb +0 -66
  84. data/spec/requests/glossary/entries_spec.rb +0 -62
  85. data/spec/requests/glossary/find_spec.rb +0 -68
  86. data/spec/requests/glossary/language_pairs_spec.rb +0 -40
  87. data/spec/requests/glossary/list_spec.rb +0 -54
  88. data/spec/requests/languages_spec.rb +0 -68
  89. data/spec/requests/rephrase_spec.rb +0 -172
  90. data/spec/requests/translate_spec.rb +0 -422
  91. data/spec/requests/usage_spec.rb +0 -43
  92. data/spec/resources/glossary_spec.rb +0 -38
  93. data/spec/resources/language_pair_spec.rb +0 -23
  94. data/spec/resources/language_spec.rb +0 -45
  95. data/spec/resources/text_spec.rb +0 -23
  96. data/spec/resources/usage_spec.rb +0 -35
  97. data/spec/spec_helper.rb +0 -92
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce04c17b4585b9813713f61db8fe35e3a61b777c48ec22011f81b7febe106527
4
- data.tar.gz: 3c4432516a14b2fb0e8886f2ff3e6d31c5ba5c88590d4e28a9631fc0a233f724
3
+ metadata.gz: eac62f1d4905c35c5e4555195f6a913dec6eb9ac3c739f4086ad39b127995843
4
+ data.tar.gz: d9cfb63f11fc42bc7301f0316ec8f2707b06ce8d073e28c012ef5042119ff34b
5
5
  SHA512:
6
- metadata.gz: 8a736f2b2cc257c26cd47e67bdbdcbc89afbb6de444176f0dab5b0a470fe2c713e3c32396391a05c007ddfbfbbc80953b0f6c6afb1fdf9b138c0eca97ae02a52
7
- data.tar.gz: 1828bdede7c38bec246302645e39ec7f01950096f3c52fb1b119766bbdf11b6c2b6d3ab881ebdf2875f736ab8f47778e87abcb5f107ca2ef6f4848c66d11d680
6
+ metadata.gz: 27f36601632c94c1acab90683eaa44a60f21545095438e0c67e609092accf5265eb6c23200f0056a1085d09e443e4bf9a2ca759a1673c3ea347f727518ea402b
7
+ data.tar.gz: 4508f77f501fa9789a73c86aba21414f73b4664c4baff9c46e5e4e2207f80865147269aaf59f83d42b538423577a3324a64c8cb95c667dfda87b7213a2b38bf3
data/CHANGELOG.md CHANGED
@@ -4,7 +4,25 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [Unreleased]
7
+ ## [3.5.0] - 2025-12-03
8
+ ### Added
9
+ - Added `custom_instructions` parameter to `translate()` to customize translation
10
+ behavior with up to 10 instructions (max 300 characters each). Only supported for
11
+ target languages: `de`, `en`, `es`, `fr`, `it`, `ja`, `ko`, `zh` and their variants.
12
+ Note: using the `custom_instructions` parameter will use the `quality_optimized`
13
+ model type as the default. Requests combining `custom_instructions` and the
14
+ `latency_optimized` model type will be rejected.
15
+
16
+ ## [3.4.0] - 2025-11-17
17
+ ### Added
18
+ - Added support for the `GET /v3/style_rules` endpoint in the client library, the
19
+ implementation can be found in the `StyleRuleApi` class. Please refer to the
20
+ README for usage instructions
21
+ - Added `style_id` option to `translate()` which allows text translation with
22
+ style rules.
23
+
24
+ ### Fixed
25
+ - Send correct library version in user-agent. Expose library version in the module as a variable.
8
26
 
9
27
  ## [3.3.0] - 2025-11-04
10
28
  ### Added
@@ -62,7 +80,8 @@ The change in major version is only due to the change in maintainership, there i
62
80
  ### Fixed
63
81
  - Make RequestEntityTooLarge error message more clear
64
82
 
65
- [Unreleased]: https://github.com/DeepLcom/deepl-rb/compare/v3.3.0...HEAD
83
+ [3.5.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.4.0...v3.5.0
84
+ [3.4.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.3.0...v3.4.0
66
85
  [3.3.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.2.0...v3.3.0
67
86
  [3.2.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.1.0...v3.2.0
68
87
  [3.1.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.0.2...v3.1.0
data/README.md CHANGED
@@ -153,6 +153,19 @@ This would use next-gen translation models for the translation. The available va
153
153
  - `'latency_optimized'`: use a translation model that minimizes response time, at the cost
154
154
  of translation quality.
155
155
 
156
+ To translate with custom instructions, supply the `custom_instructions` parameter:
157
+
158
+ ```rb
159
+ translation = DeepL.translate 'Hello, world!', 'EN', 'DE',
160
+ custom_instructions: ['Use informal language', 'Be concise']
161
+
162
+ puts translation.text
163
+ ```
164
+
165
+ Up to 10 custom instructions can be specified, each with a maximum of 300 characters.
166
+ The target language must be `de`, `en`, `es`, `fr`, `it`, `ja`, `ko`, `zh` or any variants.
167
+ Note that using `custom_instructions` will automatically use `quality_optimized` models,
168
+ and cannot be combined with `model_type: 'latency_optimized'`.
156
169
 
157
170
  The following parameters will be automatically converted:
158
171
 
@@ -166,7 +179,10 @@ The following parameters will be automatically converted:
166
179
  | `ignore_tags` | Converts arrays to strings joining by commas
167
180
  | `formality` | No conversion applied
168
181
  | `glossary_id` | No conversion applied
182
+ | `style_id` | No conversion applied
183
+ | `style_rule` | No conversion applied (can be a string ID or a StyleRule object)
169
184
  | `context` | No conversion applied
185
+ | `custom_instructions` | No conversion applied
170
186
  | `extra_body_parameters` | Hash of extra parameters to pass in the body of the HTTP request. Can be used to access beta features, or to override built-in parameters for testing purposes. Extra parameters can override keys explicitly set by the client.
171
187
 
172
188
  ### Rephrase Text
@@ -294,6 +310,62 @@ puts language_pairs.first.target_lang
294
310
  # => de
295
311
  ```
296
312
 
313
+ ### Style Rules
314
+
315
+ Style rules allow you to customize your translations using a managed, shared list
316
+ of rules for style, formatting, and more. Multiple style rules can be stored with
317
+ your account, each with a user-specified name and a uniquely-assigned ID.
318
+
319
+ #### Creating and managing style rules
320
+
321
+ Currently style rules must be created and managed in the DeepL UI via
322
+ https://www.deepl.com/en/custom-rules. Full CRUD functionality via the APIs will
323
+ come shortly.
324
+
325
+ #### Listing all style rules
326
+
327
+ `style_rules.list` returns a list of `StyleRule` objects
328
+ corresponding to all of your stored style rules. The method accepts optional
329
+ parameters: `page` (page number for pagination, 0-indexed), `page_size` (number
330
+ of items per page), and `detailed` (whether to include detailed configuration
331
+ rules in the `configured_rules` property).
332
+
333
+ ```rb
334
+ # Get all style rules
335
+ style_rules = DeepL.style_rules.list
336
+ style_rules.each do |rule|
337
+ puts "#{rule.name} (#{rule.style_id})"
338
+ end
339
+
340
+ # Get style rules with detailed configuration
341
+ style_rules = DeepL.style_rules.list(detailed: true)
342
+ style_rules.each do |rule|
343
+ if rule.configured_rules
344
+ puts " Number formatting: #{rule.configured_rules.numbers.keys.join(', ')}"
345
+ end
346
+ end
347
+ ```
348
+
349
+ Created style rules can be used in the `translate` method by specifying the `style_id` option:
350
+
351
+ ```rb
352
+ translation = DeepL.translate 'Hello World', 'EN', 'ES', style_id: 'dca2e053-8ae5-45e6-a0d2-881156e7f4e4'
353
+
354
+ puts translation.class
355
+ # => DeepL::Resources::Text
356
+ puts translation.text
357
+ # => 'Hola Mundo'
358
+ ```
359
+
360
+ You can also pass a `StyleRule` object directly:
361
+
362
+ ```rb
363
+ style_rules = DeepL.style_rules.list
364
+ style_rule = style_rules.first
365
+
366
+ translation = DeepL.translate 'Hello World', 'EN', 'ES', style_rule: style_rule
367
+ ```
368
+
297
369
  ### Monitor usage
298
370
 
299
371
  To check current API usage, use:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deepl-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DeepL SE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-04 00:00:00.000000000 Z
11
+ date: 2025-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: juwelier
@@ -49,103 +49,10 @@ extra_rdoc_files:
49
49
  - README.md
50
50
  - license_checker.sh
51
51
  files:
52
- - ".circleci/config.yml"
53
- - ".github/workflows/add_issues_to_kanban.yml"
54
- - ".gitlab-ci.yml"
55
- - ".rubocop.yml"
56
52
  - CHANGELOG.md
57
- - CODE_OF_CONDUCT.md
58
- - CONTRIBUTING.md
59
- - Gemfile
60
53
  - LICENSE.md
61
54
  - README.md
62
- - Rakefile
63
- - SECURITY.md
64
- - VERSION
65
- - deepl-rb.gemspec
66
- - lib/deepl.rb
67
- - lib/deepl/api.rb
68
- - lib/deepl/configuration.rb
69
- - lib/deepl/constants/base_constant.rb
70
- - lib/deepl/constants/formality.rb
71
- - lib/deepl/constants/model_type.rb
72
- - lib/deepl/constants/split_sentences.rb
73
- - lib/deepl/constants/tag_handling.rb
74
- - lib/deepl/constants/tone.rb
75
- - lib/deepl/constants/writing_style.rb
76
- - lib/deepl/document_api.rb
77
- - lib/deepl/exceptions/authorization_failed.rb
78
- - lib/deepl/exceptions/bad_request.rb
79
- - lib/deepl/exceptions/document_translation_error.rb
80
- - lib/deepl/exceptions/error.rb
81
- - lib/deepl/exceptions/limit_exceeded.rb
82
- - lib/deepl/exceptions/not_found.rb
83
- - lib/deepl/exceptions/not_supported.rb
84
- - lib/deepl/exceptions/quota_exceeded.rb
85
- - lib/deepl/exceptions/request_entity_too_large.rb
86
- - lib/deepl/exceptions/request_error.rb
87
- - lib/deepl/exceptions/server_error.rb
88
- - lib/deepl/glossary_api.rb
89
- - lib/deepl/requests/base.rb
90
- - lib/deepl/requests/document/download.rb
91
- - lib/deepl/requests/document/get_status.rb
92
- - lib/deepl/requests/document/upload.rb
93
- - lib/deepl/requests/glossary/create.rb
94
- - lib/deepl/requests/glossary/destroy.rb
95
- - lib/deepl/requests/glossary/entries.rb
96
- - lib/deepl/requests/glossary/find.rb
97
- - lib/deepl/requests/glossary/language_pairs.rb
98
- - lib/deepl/requests/glossary/list.rb
99
- - lib/deepl/requests/languages.rb
100
- - lib/deepl/requests/rephrase.rb
101
- - lib/deepl/requests/translate.rb
102
- - lib/deepl/requests/usage.rb
103
- - lib/deepl/resources/base.rb
104
- - lib/deepl/resources/document_handle.rb
105
- - lib/deepl/resources/document_translation_status.rb
106
- - lib/deepl/resources/glossary.rb
107
- - lib/deepl/resources/language.rb
108
- - lib/deepl/resources/language_pair.rb
109
- - lib/deepl/resources/text.rb
110
- - lib/deepl/resources/usage.rb
111
- - lib/deepl/utils/backoff_timer.rb
112
- - lib/deepl/utils/exception_builder.rb
113
- - lib/http_client_options.rb
114
55
  - license_checker.sh
115
- - spec/api/api_spec.rb
116
- - spec/api/configuration_spec.rb
117
- - spec/api/deepl_spec.rb
118
- - spec/constants/constants_spec.rb
119
- - spec/fixtures/vcr_cassettes/deepl_document.yml
120
- - spec/fixtures/vcr_cassettes/deepl_document_download.yml
121
- - spec/fixtures/vcr_cassettes/deepl_glossaries.yml
122
- - spec/fixtures/vcr_cassettes/deepl_languages.yml
123
- - spec/fixtures/vcr_cassettes/deepl_rephrase.yml
124
- - spec/fixtures/vcr_cassettes/deepl_translate.yml
125
- - spec/fixtures/vcr_cassettes/deepl_usage.yml
126
- - spec/fixtures/vcr_cassettes/glossaries.yml
127
- - spec/fixtures/vcr_cassettes/languages.yml
128
- - spec/fixtures/vcr_cassettes/rephrase_texts.yml
129
- - spec/fixtures/vcr_cassettes/translate_texts.yml
130
- - spec/fixtures/vcr_cassettes/usage.yml
131
- - spec/integration_tests/document_api_spec.rb
132
- - spec/integration_tests/integration_test_utils.rb
133
- - spec/requests/glossary/create_spec.rb
134
- - spec/requests/glossary/destroy_spec.rb
135
- - spec/requests/glossary/entries_spec.rb
136
- - spec/requests/glossary/find_spec.rb
137
- - spec/requests/glossary/language_pairs_spec.rb
138
- - spec/requests/glossary/list_spec.rb
139
- - spec/requests/languages_spec.rb
140
- - spec/requests/rephrase_spec.rb
141
- - spec/requests/translate_spec.rb
142
- - spec/requests/usage_spec.rb
143
- - spec/resources/glossary_spec.rb
144
- - spec/resources/language_pair_spec.rb
145
- - spec/resources/language_spec.rb
146
- - spec/resources/text_spec.rb
147
- - spec/resources/usage_spec.rb
148
- - spec/spec_helper.rb
149
56
  homepage: https://github.com/DeepLcom/deepl-rb
150
57
  licenses:
151
58
  - MIT
data/.circleci/config.yml DELETED
@@ -1,27 +0,0 @@
1
- version: 2
2
- jobs:
3
- build:
4
- working_directory: ~/deepl-rb
5
- docker:
6
- - image: circleci/ruby:2.7
7
- steps:
8
- - checkout
9
-
10
- - run:
11
- name: Bundle Install
12
- command: bundle install --path vendor/bundle
13
-
14
- # Run rspec
15
- - type: shell
16
- command: |
17
- bundle exec rspec $(circleci tests glob "spec/**/*_spec.rb" |
18
- circleci tests split --split-by=timings)
19
-
20
- # Run rubocop
21
- - type: shell
22
- command: |
23
- bundle exec rubocop
24
-
25
- # Save test results for timing analysis
26
- - store_test_results:
27
- path: test_results
@@ -1,16 +0,0 @@
1
- name: Add bugs to bugs project
2
-
3
- on:
4
- issues:
5
- types:
6
- - opened
7
-
8
- jobs:
9
- add-to-project:
10
- name: Add issue to project
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/add-to-project@v0.5.0
14
- with:
15
- project-url: https://github.com/orgs/DeepLcom/projects/1
16
- github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
data/.gitlab-ci.yml DELETED
@@ -1,172 +0,0 @@
1
- # Note: This GitLab CI configuration is used for internal testing, users can ignore it.
2
- include:
3
- - template: Security/SAST.gitlab-ci.yml
4
- - project: '${CI_PROJECT_NAMESPACE}/ci-libs-for-client-libraries'
5
- file:
6
- - '/${CI_PROJECT_NAME}/.gitlab-ci.yml'
7
- - project: 'deepl/ops/ci-cd-infrastructure/gitlab-ci-lib'
8
- file:
9
- - '/templates/.buildkit.yml'
10
- - '/templates/.secret-detection.yml'
11
- - '/templates/.gitlab-release.yml'
12
-
13
- # Global --------------------------
14
-
15
- workflow:
16
- rules:
17
- - if: $CI_PIPELINE_SOURCE == "merge_request_event"
18
- - if: $CI_COMMIT_TAG
19
- - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
20
-
21
- variables:
22
- GITLAB_ADVANCED_SAST_ENABLED: 'true'
23
-
24
- stages:
25
- - install
26
- - check
27
- - test
28
- - publish # Only for internal tracking
29
-
30
-
31
- before_script:
32
- - ruby --version
33
- - bundle install
34
-
35
- # stage: install ----------------------
36
-
37
- package:
38
- stage: install
39
- parallel:
40
- matrix:
41
- - DOCKER_IMAGE: 'ruby:2.7'
42
- - DOCKER_IMAGE: 'ruby:3.2'
43
- - DOCKER_IMAGE: 'ruby:3.3'
44
- image:
45
- name: ${DOCKER_IMAGE}
46
- entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
47
- script:
48
- - bundle exec rake build
49
- artifacts:
50
- paths:
51
- - pkg/
52
-
53
- # stage: check ----------------------
54
-
55
- .rubocop_base:
56
- stage: check
57
- image:
58
- name: ruby:2.7
59
- entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
60
- script: bundle exec rubocop
61
-
62
- rubocop_scheduled:
63
- extends: .rubocop_base
64
- rules:
65
- - if: $CI_PIPELINE_SOURCE == "schedule"
66
- retry: 2
67
-
68
- rubocop_manual:
69
- extends: .rubocop_base
70
- rules:
71
- - if: $CI_PIPELINE_SOURCE != "schedule"
72
-
73
- secret_detection:
74
- extends: .secret-detection
75
- stage: check
76
- image: !reference [.secret-detection, image]
77
- before_script:
78
- - echo "overriding default before_script..."
79
- rules:
80
- - if: $CI_MERGE_REQUEST_ID
81
-
82
- license_check:
83
- stage: check
84
- before_script:
85
- - echo "overriding default before_script..."
86
- script:
87
- - ./license_checker.sh '*.rb' | tee license_check_output.txt
88
- - '[ ! -s license_check_output.txt ]'
89
-
90
- gitlab-advanced-sast:
91
- stage: check
92
- before_script:
93
- - ''
94
- rules:
95
- - when: always
96
- variables:
97
- SAST_EXCLUDED_PATHS: '$DEFAULT_SAST_EXCLUDED_PATHS,/spec'
98
- GIT_STRATEGY: clone
99
- KUBERNETES_HELPER_MEMORY_LIMIT: 8Gi
100
- SAST_SCANNER_ALLOWED_CLI_OPTS: --multi-core 8
101
-
102
- semgrep-sast:
103
- stage: check
104
- before_script:
105
- - ''
106
- rules:
107
- - when: always
108
- variables:
109
- SAST_EXCLUDED_PATHS: '$DEFAULT_SAST_EXCLUDED_PATHS,/spec'
110
- GIT_STRATEGY: clone
111
- KUBERNETES_MEMORY_LIMIT: 8Gi
112
-
113
-
114
- # stage: test ----------------------
115
-
116
- .test_base:
117
- stage: test
118
- extends: .test
119
- parallel:
120
- matrix:
121
- - DOCKER_IMAGE: 'ruby:2.7'
122
- - DOCKER_IMAGE: 'ruby:3.2'
123
- - DOCKER_IMAGE: 'ruby:3.3'
124
- - DOCKER_IMAGE: 'ruby:2.7'
125
- USE_MOCK_SERVER: "use mock server"
126
- - DOCKER_IMAGE: 'ruby:3.2'
127
- USE_MOCK_SERVER: "use mock server"
128
- - DOCKER_IMAGE: 'ruby:3.3'
129
- USE_MOCK_SERVER: "use mock server"
130
- image:
131
- name: ${DOCKER_IMAGE}
132
- entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
133
- script:
134
- - >
135
- if [[ ! -z "${USE_MOCK_SERVER}" ]]; then
136
- echo "Using mock server"
137
- export DEEPL_SERVER_URL=http://deepl-mock:3000
138
- export DEEPL_MOCK_SERVER_PORT=3000
139
- export DEEPL_PROXY_URL=http://deepl-mock:3001
140
- export DEEPL_MOCK_PROXY_SERVER_PORT=3001
141
- fi
142
- - bundle exec rake test
143
- - bundle exec rspec --format RspecJunitFormatter --out rspec.xml
144
- artifacts:
145
- reports:
146
- coverage_report:
147
- coverage_format: cobertura
148
- path: coverage/coverage.xml
149
- junit:
150
- - rspec.xml
151
- when: always
152
-
153
- test_scheduled:
154
- extends: .test_base
155
- rules:
156
- - if: $CI_PIPELINE_SOURCE == "schedule"
157
- retry: 2
158
-
159
- test_manual:
160
- stage: test
161
- extends: .test_base
162
- rules:
163
- - if: $CI_PIPELINE_SOURCE != "schedule"
164
-
165
-
166
- # stage: publish ----------------------
167
-
168
- gitlab release:
169
- stage: publish
170
- extends: .create_gitlab_release
171
- rules:
172
- - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
data/.rubocop.yml DELETED
@@ -1,51 +0,0 @@
1
- # Custom rubocop configuration
2
-
3
- require:
4
- - rubocop-rspec
5
-
6
- AllCops:
7
- DisplayCopNames: true
8
- NewCops: enable
9
- Exclude:
10
- - deepl-rb.gemspec
11
- - vendor/**/*
12
- TargetRubyVersion: 2.7.5
13
-
14
- Metrics/BlockLength:
15
- Exclude:
16
- - "**/*_spec.rb"
17
-
18
- Metrics/ParameterLists:
19
- Max: 6
20
-
21
- Layout/LineLength:
22
- Max: 100
23
-
24
- RSpec/ExampleLength:
25
- Max: 10
26
- CountAsOne: ['heredoc']
27
-
28
- RSpec/MessageSpies:
29
- EnforcedStyle: 'receive'
30
-
31
- RSpec/MultipleExpectations:
32
- Max: 8
33
-
34
- RSpec/MultipleMemoizedHelpers:
35
- Max: 7
36
-
37
- RSpec/NestedGroups:
38
- Max: 4
39
-
40
- RSpec/SpecFilePathSuffix:
41
- Enabled: false
42
-
43
- RSpec/SpecFilePathFormat:
44
- CustomTransform:
45
- DeepL: ''
46
-
47
- Style/Documentation:
48
- Enabled: false
49
-
50
- Style/ModuleFunction:
51
- EnforcedStyle: extend_self
data/CODE_OF_CONDUCT.md DELETED
@@ -1,132 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, caste, color, religion, or sexual
10
- identity and orientation.
11
-
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
19
-
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the overall
26
- community
27
-
28
- Examples of unacceptable behavior include:
29
-
30
- * The use of sexualized language or imagery, and sexual attention or advances of
31
- any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email address,
35
- without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
38
-
39
- ## Enforcement Responsibilities
40
-
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
45
-
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
50
-
51
- ## Scope
52
-
53
- This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official e-mail address,
56
- posting via an official social media account, or acting as an appointed
57
- representative at an online or offline event.
58
-
59
- ## Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at
63
- [open-source@deepl.com](mailto:open-source@deepl.com).
64
- All complaints will be reviewed and investigated promptly and fairly.
65
-
66
- All community leaders are obligated to respect the privacy and security of the
67
- reporter of any incident.
68
-
69
- ## Enforcement Guidelines
70
-
71
- Community leaders will follow these Community Impact Guidelines in determining
72
- the consequences for any action they deem in violation of this Code of Conduct:
73
-
74
- ### 1. Correction
75
-
76
- **Community Impact**: Use of inappropriate language or other behavior deemed
77
- unprofessional or unwelcome in the community.
78
-
79
- **Consequence**: A private, written warning from community leaders, providing
80
- clarity around the nature of the violation and an explanation of why the
81
- behavior was inappropriate. A public apology may be requested.
82
-
83
- ### 2. Warning
84
-
85
- **Community Impact**: A violation through a single incident or series of
86
- actions.
87
-
88
- **Consequence**: A warning with consequences for continued behavior. No
89
- interaction with the people involved, including unsolicited interaction with
90
- those enforcing the Code of Conduct, for a specified period of time. This
91
- includes avoiding interactions in community spaces as well as external channels
92
- like social media. Violating these terms may lead to a temporary or permanent
93
- ban.
94
-
95
- ### 3. Temporary Ban
96
-
97
- **Community Impact**: A serious violation of community standards, including
98
- sustained inappropriate behavior.
99
-
100
- **Consequence**: A temporary ban from any sort of interaction or public
101
- communication with the community for a specified period of time. No public or
102
- private interaction with the people involved, including unsolicited interaction
103
- with those enforcing the Code of Conduct, is allowed during this period.
104
- Violating these terms may lead to a permanent ban.
105
-
106
- ### 4. Permanent Ban
107
-
108
- **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
110
- individual, or aggression toward or disparagement of classes of individuals.
111
-
112
- **Consequence**: A permanent ban from any sort of public interaction within the
113
- community.
114
-
115
- ## Attribution
116
-
117
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
- version 2.1, available at
119
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
-
121
- Community Impact Guidelines were inspired by
122
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
-
124
- For answers to common questions about this code of conduct, see the FAQ at
125
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
- [https://www.contributor-covenant.org/translations][translations].
127
-
128
- [homepage]: https://www.contributor-covenant.org
129
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
- [Mozilla CoC]: https://github.com/mozilla/diversity
131
- [FAQ]: https://www.contributor-covenant.org/faq
132
- [translations]: https://www.contributor-covenant.org/translations