easy_style 1.0.0 → 1.0.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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +219 -0
  3. data/default.yml +2 -2
  4. data/lib/easy_style.rb +3 -0
  5. metadata +3 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1c116adcb355436046656f2a169867b2a0db4869838fbbe4141cc90599b0396
4
- data.tar.gz: 63750783ce4cf5f0eb67b6e6cfad65e1d4c80a2ab3826b1ccecacd8bacf0974a
3
+ metadata.gz: e0dd3123aa196dff1db3cf3b9598c3ab481c6f5be7f7c9a947e919a54b1286f1
4
+ data.tar.gz: 92642e2816cc648141ff825cfe1717109567498bed3a30f81f12c8b5e50afccb
5
5
  SHA512:
6
- metadata.gz: 86f161cc36d7afd3a2b91f39428ea4338174403051faefc045e8ed614adc09a4b46109fc1885f6996232fff7831d3ab9b60bbf460c692fa2a3cdc315330f7ccf
7
- data.tar.gz: 5bbc6dcea342ab72c518c7c231e2863c1f45e0da000500726fac0d79245c98b125ea70eae6e8ff85cb3499ab3a9263a11aa68a588763aeefaeb37d8d6e604a55
6
+ metadata.gz: 93d225ecc6e8a4bfd748ae66e52469533c0ffd87b19ee084afcce5bf6166a110bfa3e491209b41bec270557ec312e7e00050e7bacc0eac4fe673e0bad32567f4
7
+ data.tar.gz: cf8d26139911cc4d2f585a396841918751edb3f36dc5e258e75570c277cbda7e0f632119b73aea53afb71ec313beba63039bb5f9877fec30f2d45f7176ba9b0d
data/README.md ADDED
@@ -0,0 +1,219 @@
1
+ # EasyStyle
2
+
3
+ Default RuboCop configuration for Easy.
4
+
5
+ https://docs.rubocop.org/rubocop/
6
+
7
+ https://docs.easy8.com
8
+
9
+ Since February 2026 we decided move close to Omakase style, but still want to keep our individual used rules, so we are using Omakase as base and then add our own rules on top of it.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem "easy_style", group: %i[development], require: false
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle install
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install easy_style
26
+
27
+ ## Usage
28
+
29
+ In your `.rubocop.yml` file:
30
+ ```yaml
31
+ inherit_gem:
32
+ easy_style: default.yml
33
+ ```
34
+
35
+ Generate "todo" file is recommended:
36
+ ```bash
37
+ bundle exec rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 10000
38
+ ```
39
+
40
+ # GitLab CI/CD Component
41
+
42
+ This repository provides a reusable GitLab CI/CD component for running RuboCop in your pipelines.
43
+
44
+ ## Component Usage
45
+
46
+ Include the component in your project's `.gitlab-ci.yml`:
47
+
48
+ ```yaml
49
+ include:
50
+ - component: git.easy.cz/internal/easy_style/rubocop@v1.0.0
51
+ inputs:
52
+ version: "v1.0.0" # Match with ruby gem tag - specify which docker image of easy_style to use (default: latest)
53
+ ```
54
+
55
+ ### Component Inputs
56
+
57
+ | Input | Type | Default | Description |
58
+ |-------|------|---------|-------------|
59
+ | `job_name` | `string` | `rubocop` | Name of the CI job |
60
+ | `stage` | `string` | `linter` | Pipeline stage where the job runs |
61
+ | `allow_failure` | `boolean` | `false` | Whether to allow the job to fail |
62
+ | `version` | `string` | `latest` | Docker image version (should match git tag: v1.0.0, v1.1.0, etc.) |
63
+ | `changes_paths` | `array` | See below | Array of paths to check for changes |
64
+
65
+ **Important Notes:**
66
+ - `allow_failure` is typed as `boolean` and works correctly as an entire YAML value
67
+
68
+ **Default `changes_paths`:**
69
+ ```yaml
70
+ - "plugins/**/*.rb"
71
+ - "easy_engines/**/*.rb"
72
+ - "easy_lib/**/*.rb"
73
+ - "easy_plugins/**/*.rb"
74
+ ```
75
+
76
+ ### Examples
77
+
78
+ **Basic usage with specific version:**
79
+ ```yaml
80
+ include:
81
+ - component: git.easy.cz/internal/easy_style/rubocop@v1.0.0
82
+ ```
83
+
84
+ **Custom job name and stage:**
85
+ ```yaml
86
+ include:
87
+ - component: git.easy.cz/internal/easy_style/rubocop@v1.0.0
88
+ inputs:
89
+ job_name: code-quality
90
+ stage: test
91
+ version: "v1.0.0"
92
+ allow_failure: true
93
+ ```
94
+
95
+ **Disable changes detection (run on all commits):**
96
+ ```yaml
97
+ include:
98
+ - component: git.easy.cz/internal/easy_style/rubocop@v1.0.0
99
+ inputs:
100
+ version: "v1.0.0"
101
+ changes_paths:
102
+ - "**/*.rb"
103
+ ```
104
+
105
+ **Custom paths for changes detection:**
106
+ ```yaml
107
+ include:
108
+ - component: git.easy.cz/internal/easy_style/rubocop@v1.0.0
109
+ inputs:
110
+ version: "v1.0.0"
111
+ changes_paths:
112
+ - "app/**/*.rb"
113
+ - "lib/**/*.rb"
114
+ ```
115
+
116
+ ### How It Works
117
+
118
+ The component automatically:
119
+ - Uses the RuboCop Docker image from this project's registry (`${CI_REGISTRY}/internal/easy_style`)
120
+ - Creates a temporary `.rubocop_ci.yml` if it doesn't exist (inherits from `.rubocop.yml` and `.rubocop_todo.yml`)
121
+ - By default, runs RuboCop only when files in specified paths change (compared to `master` branch)
122
+ - Runs with shallow clone (GIT_DEPTH=1) for faster checkout
123
+
124
+ # Docker Image (Legacy Usage)
125
+
126
+ Rubocop standalone Docker image for CI/CD pipelines linting RoR applications.
127
+
128
+ Image is inspired by https://gitlab.com/pipeline-components/rubocop/-/blob/main/Dockerfile.
129
+
130
+ **Note:** We recommend using the GitLab CI/CD component (documented above) instead of directly using the Docker image. The component provides better integration and configuration options.
131
+
132
+ ## Highlights
133
+
134
+ * Ruby version matches platform ruby version (4.0.1)
135
+ * Multi-stage build for smaller image size
136
+ * Runs as non-root user for security
137
+ * CI automatically builds Docker images only for git tags
138
+ * Docker image version matches gem version 1:1
139
+
140
+ ## Direct Docker Usage
141
+
142
+ If you need to use the Docker image directly in `.gitlab-ci.yml`:
143
+ ```yaml
144
+ rubocop linter:
145
+ stage: lint
146
+ image: registry.git.easy.cz/internal/easy_style:v1.0.0 # Or :latest
147
+ before_script:
148
+ - "[ ! -f '.rubocop_ci.yml' ] && ((echo 'inherit_from:'; echo ' - .rubocop.yml') > .rubocop_ci.yml; echo ' - .rubocop_todo.yml' >> .rubocop_ci.yml)"
149
+ script:
150
+ - rubocop -c .rubocop_ci.yml
151
+ ```
152
+
153
+ Or use standalone via Docker CLI:
154
+ ```bash
155
+ # Using latest version - mounts your code to /code (working directory is /app)
156
+ docker run --rm -v $(pwd):/code -w /code registry.git.easy.cz/internal/easy_style:latest
157
+
158
+ # Alternative: mount to /app (image's default WORKDIR)
159
+ docker run --rm -v $(pwd):/app registry.git.easy.cz/internal/easy_style:latest
160
+ ```
161
+
162
+ **How config resolution works:**
163
+ 1. If your project has `.rubocop.yml`, RuboCop uses it
164
+ 2. If not, RuboCop automatically falls back to `~/.rubocop.yml` (the built-in easy_style config)
165
+ 3. This means you get easy_style's rules by default, but can override them per-project
166
+
167
+ ## Contributing
168
+
169
+ ### Release Workflow
170
+
171
+ This project uses a coordinated release workflow where the gem and Docker image are released together:
172
+
173
+ 1. **Develop and Test**
174
+ - Make changes to RuboCop configuration (`default.yml`) or gem code
175
+ - Test locally with `bundle exec rubocop`
176
+ - Commit and push to `master` branch
177
+
178
+ 2. **Release Gem to RubyGems** (Manual with 2FA)
179
+ ```bash
180
+ # Update version in easy_style.gemspec if needed
181
+ gem build easy_style.gemspec
182
+ gem push easy_style-1.0.0.gem # Requires 2FA authentication
183
+ ```
184
+
185
+ 3. **Create Git Tag** (Triggers Docker Build)
186
+ ```bash
187
+ # Tag with 'v' prefix matching the gem version
188
+ git tag v1.0.0
189
+ git push origin v1.0.0
190
+ ```
191
+
192
+ 4. **Automated Docker Release**
193
+ - GitLab CI automatically triggers on tag push (not on regular commits)
194
+ - Builds Docker image with multi-stage optimization
195
+ - Tags image as `registry.git.easy.cz/internal/easy_style:v1.0.0`
196
+ - Also tags as `:latest` for convenience
197
+ - Creates GitLab release with tag information
198
+
199
+ ### Version Numbering
200
+
201
+ - Use semantic versioning: `v1.0.0`, `v1.1.0`, `v2.0.0`, etc.
202
+ - **Always include the `v` prefix** in git tags
203
+ - Gem version (in gemspec) and git tag should match (e.g., gem `1.0.0` → tag `v1.0.0`)
204
+ - Docker images are tagged with the full git tag including `v` prefix
205
+
206
+ ### Release Checklist
207
+
208
+ - [ ] Update `easy_style.gemspec` version if needed
209
+ - [ ] Update `CHANGELOG.md` (if exists)
210
+ - [ ] Test locally: `gem build && gem install easy_style-*.gem`
211
+ - [ ] Push gem to RubyGems with 2FA
212
+ - [ ] Create and push git tag with `v` prefix
213
+ - [ ] Verify Docker build in GitLab CI completes successfully
214
+ - [ ] Test Docker image: `docker pull registry.git.easy.cz/internal/easy_style:v1.0.0`
215
+ - [ ] Verify GitLab component works in a test project
216
+
217
+ ## License
218
+
219
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/default.yml CHANGED
@@ -25,6 +25,8 @@ Layout/EmptyLinesAroundClassBody:
25
25
  EnforcedStyle: empty_lines_special
26
26
  Layout/EmptyLinesAroundModuleBody:
27
27
  EnforcedStyle: empty_lines_except_namespace
28
+ Layout/EndAlignment:
29
+ EnforcedStyleAlignWith: keyword
28
30
  Layout/LineLength:
29
31
  Enabled: false
30
32
 
@@ -61,8 +63,6 @@ Naming/BlockForwarding:
61
63
  Naming/VariableNumber:
62
64
  EnforcedStyle: snake_case
63
65
 
64
- Rails/ApplicationRecord:
65
- Enabled: false
66
66
  Rails/RedundantPresenceValidationOnBelongsTo:
67
67
  Enabled: false
68
68
  Rails/SkipsModelValidations:
data/lib/easy_style.rb ADDED
@@ -0,0 +1,3 @@
1
+ module EasyStyle
2
+ # Just stub
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_style
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Easy8
@@ -30,7 +30,9 @@ executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
+ - README.md
33
34
  - default.yml
35
+ - lib/easy_style.rb
34
36
  homepage: https://git.easy8.com/internal/easy_style
35
37
  licenses:
36
38
  - MIT