profile
viewpoint
Peter Leitzen splattael @gitlab Bochum, Germany https://peter.leitzen.de Staff Backend Engineer @gitlab Passionate coder and open-source enthusiast specialised in backend development using Ruby, Crystal, Docker and Elixir.

dry-rb/dry-validation 1152

Validation library with type-safe schemas and rules

solnic/transproc 418

The project was ported to dry-rb/dry-transformer

dry-rb/dry-configurable 323

A simple mixin to make Ruby classes configurable

ruby-formatter/rufo-vim 52

Ruby format for vim via rufo

jodosha/collaborators 9

Hanami workshop

splattael/docker-phpmyadmin 7

Dockerized phpMyAdmin on Alpine

splattael/bigbrother 6

Server overseer.

splattael/dind-example 6

Docker in docker example

splattael/dotfiles 6

Personal dotfiles

splattael/erl_nif.cr 6

WIP: Erlang NIF in Crystal

push eventsplattael/dotfiles

Peter Leitzen

commit sha ed18c3a305b253c050ab6edc3f4d19684a3e61f1

Install vim gtk3 so we have clipboard functionality again

view details

push time in 14 hours

push eventsplattael/dotfiles

Peter Leitzen

commit sha d706dc41196dea8bf2ffc3cb2687100409f6f5dc

Test bin/install-my-laptop via docker

view details

Peter Leitzen

commit sha 8357761992ca5f266107eb24fba379b158c62dce

Merge branch 'docker' into 'master' Test bin/install-my-laptop via docker See merge request splattael/dotfiles!1

view details

Peter Leitzen

commit sha 90b9808d769d6ee9a4b7de3d2b201f4dea597cf2

vim: Map `gx` manually because netrw did not properly anymore

view details

Peter Leitzen

commit sha 517d4abfb1e745c146d8b38a046125c789ce025c

install-my-laptop: Always update dotfiles

view details

push time in a day

push eventsplattael/dotfiles

Peter Leitzen

commit sha 89a36936fcc4a1e1ff3ee01331453b43f3422943

Rename xcopy to pbcopy and add pbpaste

view details

push time in 3 days

push eventsplattael/dotfiles

Peter Leitzen

commit sha a64d987ce03b0e81295c4e83738d6e193d397022

Test bin/install-my-laptop via docker

view details

push time in 5 days

push eventsplattael/dotfiles

Peter Leitzen

commit sha 5eeed8b5e899b8241b337f37c15dbc3b71975c3e

Test bin/install-my-laptop via docker

view details

push time in 5 days

push eventsplattael/dotfiles

Peter Leitzen

commit sha 437c3e0ffb3988d5168ec8b0d947481fab92c4c1

Test bin/install-my-laptop via docker

view details

push time in 6 days

push eventsplattael/dotfiles

Peter Leitzen

commit sha facc9d3beff28f4b8859f1ad837fb9872b145fb2

Test bin/install-my-laptop via docker

view details

push time in 6 days

create barnchsplattael/dotfiles

branch : docker

created branch time in 6 days

push eventsplattael/dotfiles

Peter Leitzen

commit sha 173d31d682d6520d6b90574b2f8deedb1a5122c1

laptop: Fix switching windows using ALT+Tab Extract hardcoded values (debian release, user) as variables

view details

push time in 6 days

push eventsplattael/dotfiles

Peter Leitzen

commit sha 380c65a84cba4409ca04a8c41005418adc767e51

Upgrade asdf

view details

Peter Leitzen

commit sha f6e00614f04624f6a5e2af8e0611a638b166d85c

Update bundle/config

view details

Peter Leitzen

commit sha d74f9c066132719e0407e3cd5beb4c7c02ff253c

Install `hub` via `apt`

view details

push time in 7 days

fork splattael/po_to_json

Ruby library for converting gettext PO files to JSON

https://github.com/webhippie/po_to_json

fork in 8 days

push eventsplattael/dotfiles

Peter Leitzen

commit sha 50aa82153b67096f67969ecda0e6353e7d57eb84

alacritty: Expose TERM as xterm-256color to work well with remote screen

view details

Peter Leitzen

commit sha 91975ce358fd7a0b367aab926e4602919e0f6d4b

Gnome: Adjust keybindings to move windows between workspaces Also remove switch locales keybinding.

view details

push time in 8 days

push eventsplattael/dotfiles

Peter Leitzen

commit sha bccdf01b003554bb190781f9bd49e0772b374795

install-my-laptop: Resolve shellcheck warnings

view details

Peter Leitzen

commit sha 5a06bc83a063b2619aa4fedcbe539fe289892943

Upgrade alacritty to 0.9.0

view details

push time in 9 days

startedbarnumbirr/alacritty-debian

started time in 9 days

push eventsplattael/dotfiles

Peter Leitzen

commit sha ab86ee2583181cbe4b5598d521e2fee6d7c96994

Add $HOME/.local/bin

view details

Peter Leitzen

commit sha bfe132d40c8a39a44ad3eb6e66698456f27bc676

vim: Fix ale rubocop once again

view details

Peter Leitzen

commit sha a0d01e95a864ab94001ae3331d9f2746148fc3e0

git: Switch to diff3 for conflictstyle

view details

push time in 9 days

starteddjezzzl/database_consistency

started time in 22 days

pull request commentrubocop/rubocop

[#10221] Update `Naming::FileName` to recognize `Struct`s as classes that satisfy the `ExpectMatchingDefinition` requirement

I'm not sold on having a constant defined satisfying the FileName cop. For Struct it's one thing because it's actually defining a class, but a constant could be anything.

Would you think this should satisfy the ExpectMatchingDefinition requirement?

module Foo
  Bar = 5
end

Yes, I think this cop should only check whether the defined constant matches the file name. The value of the constant can be anything - which is zeitwerk's approach as well.

Note that Ruby has many ways of creating a class/module so it don't have to be Struct specific at all:

module Foo
  Bar = SomeClassFactory.create
end 

See for example, https://github.com/dry-rb/dry-types/blob/9562995e50f9dfba0b8628224b07d865d18335da/lib/dry/types/any.rb#L45.

For your specific use case, I wonder if just excluding gitlab/ee/lib/elastic/v12p1/**/* from this cop would be a better solution.

We did exclude them for now but ideally we'd also support aliasing hence the issue :sweat_smile:

dvandersluis

comment created time in a month

issue commentrubocop/rubocop

Naming/FileName: Detect constant assignment

We might also want to support aliasing as in:

module Something
  Bar = ::OtherNamespace::Bar
end
splattael

comment created time in a month

pull request commentrubocop/rubocop

[#10221] Update `Naming::FileName` to recognize `Struct`s as classes that satisfy the `ExpectMatchingDefinition` requirement

@dvandersluis Thanks for opening this PR so quickly :heart:

I think this is a good start but I was wondering if we need to take care of non-Struct related assignments as well to support e.g. aliasing:

module Something
  Bar = ::OtherNamespace::Bar
end

At GitLab we use such technique for aliasing in particular, for example: https://gitlab.com/gitlab-org/gitlab/-/blob/4e75a27af3add26b45c4dd05314946757a670578/ee/lib/elastic/v12p1/routing.rb#L6

dvandersluis

comment created time in a month

issue openedrubocop/rubocop

Naming/FileName: Detect constant assignment

Is your feature request related to a problem? Please describe.

Currently, Naming/FileName always flag the following code:

lib/something/bar.rb

module Something
  Bar = Struct.new(:bar)
end

which produces

Offenses:

lib/something/bar.rb:1:1: C: Naming/FileName: bar.rb should define a class or module called Something::Bar.
module Something
^

Describe the solution you'd like

It'd be great to support such constant assignments.

Describe alternatives you've considered

In this example, one could use class Bar < Struct.new(:bar) but those workaround are not always feasible.

created time in a month

issue commentrubocop/rubocop

Naming/FileName with ExpectMatchingDefinition and CheckDefinitionPathHierarchy does not enforce in custom folders

I can reproduce it with:

peter@lappy ~/devel/testing-rubocop$ cat $(find . -name "*.rb")
module Foo
  class Bar
  end
end
module Foo
  class Bar
  end
end
module Foo
  class Bar
  end
end
peter@lappy ~/devel/testing-rubocop$ rubocop -v
1.22.3
peter@lappy ~/devel/testing-rubocop$ rubocop --only Naming/FileName .
Inspecting 3 files
C..

Offenses:

lib/something/bar.rb:1:1: C: Naming/FileName: bar.rb should define a class or module called Something::Bar.
module Foo
^

3 files inspected, 1 offense detected

RuboCop only detects a single offenses for code which is inside lib (or test, spec or src). Code outside of this structure (e.g. lol/) won't be detected.

grosser

comment created time in a month

PR opened ruby/ruby

Clarify docs about magic comments placement

Magic comments like frozen_string_literal may appear everywhere within the first comment section while encoding have to be the first line, or second line after shebang.

Examples

frozen_string_literal must appear in the first comment section

# any comment
# It's OK as long it's not a "token"

# frozen_string_literal: true

p ''.frozen? # => true

encoding must be first or second line

# another comment or empty line
# encoding: big5

p ''.encoding # => #<Encoding:UTF-8> so not #<Encoding:Big5>
+3 -3

0 comment

1 changed file

pr created time in a month

create barnchsplattael/ruby

branch : splattael/doc-magic-comment-placement

created branch time in a month

fork splattael/ruby

The Ruby Programming Language [mirror]

https://www.ruby-lang.org/

fork in a month

startedammar/regexp_parser

started time in 2 months

push eventsplattael/dotfiles

Peter Leitzen

commit sha f02930a52b12ff6fe4f800c81a80522ac2ee719d

vim: Fix rubocop executable for ale

view details

Peter Leitzen

commit sha ce30e985e980f35e1edc3e99c3853999e3652081

vim: Add vim-vue-plugin

view details

Peter Leitzen

commit sha c8691f7e0d9c83e52328bef8b490043ae96b9384

Update asdf and fzf

view details

Peter Leitzen

commit sha 019a4c1d35f2634a1996846577df12a29e504f6d

vim: Update plugins

view details

push time in 2 months

delete branch splattael/grafana

delete branch : gitlab-auth-role-attribute-path

delete time in 3 months

pull request commentgrafana/grafana

OAuth: Support role mapping for GitLab OAuth

@henrysachs Thanks for updating the docs again :bow:

@marefr Thanks for review and approval :heart:

CI complains:

continuous-integration/drone/pr — Build was killed

Is this something we need to address or is it fine? :sweat_smile: :crossed_fingers:

splattael

comment created time in 3 months

Pull request review commentgrafana/grafana

Social login: Support `role_attribute_path` for GitLab OAuth

 enabled = true allow_sign_up = true client_id = GITLAB_APPLICATION_ID client_secret = GITLAB_SECRET-scopes = api+scopes = read_api auth_url = https://gitlab.com/oauth/authorize token_url = https://gitlab.com/oauth/token api_url = https://gitlab.com/api/v4 allowed_groups = example, foo/bar ``` +### Map roles++Grafana can attempt to do role mapping through Gitlab OAuth. In order to achieve this, Grafana checks for the presence of a role using the [JMESPath](http://jmespath.org/examples.html) specified via the `role_attribute_path` configuration option.++Grafana uses JSON obtained from querying the `/api/v4/user` endpoint for the path lookup. The result after evaluating the `role_attribute_path` JMESPath expression needs to be a valid Grafana role, i.e. `Viewer`, `Editor` or `Admin`. Refer to [Organization roles]({{< relref "../permissions/organization_roles.md" >}}) for more information about roles and permissions in Grafana.++An example Query could look like the following:++```bash+role_attribute_path = is_admin && 'Admin' || 'Viewer'+```++This would allow you every Gitlab Admin to be an Admin in Grafana.
This would allow you every GitLab Admin to be an Admin in Grafana.
splattael

comment created time in 3 months

Pull request review commentgrafana/grafana

Social login: Support `role_attribute_path` for GitLab OAuth

 enabled = true allow_sign_up = true client_id = GITLAB_APPLICATION_ID client_secret = GITLAB_SECRET-scopes = api+scopes = read_api auth_url = https://gitlab.com/oauth/authorize token_url = https://gitlab.com/oauth/token api_url = https://gitlab.com/api/v4 allowed_groups = example, foo/bar ``` +### Map roles++Grafana can attempt to do role mapping through Gitlab OAuth. In order to achieve this, Grafana checks for the presence of a role using the [JMESPath](http://jmespath.org/examples.html) specified via the `role_attribute_path` configuration option.++Grafana uses JSON obtained from querying the `/api/v4/user` endpoint for the path lookup. The result after evaluating the `role_attribute_path` JMESPath expression needs to be a valid Grafana role, i.e. `Viewer`, `Editor` or `Admin`. Refer to [Organization roles]({{< relref "../permissions/organization_roles.md" >}}) for more information about roles and permissions in Grafana.++An example Query could look like the following:++```bash+role_attribute_path = is_admin && 'Admin' || 'Viewer'

Suggestion What are your thoughts on copying this great example into the first [auth.gitlab] example above https://github.com/grafana/grafana/pull/30025/files#diff-1d2cd961688172e12c62c2902ccbe4a45e2f990d82fda8e48516099b58b2b9e5L53? :thinking:

Question Do you think this JMESPath query could be the default value in the default [auth.gitlab] configuration sample? :shrug: It's also a question for other reviewers I feel.

splattael

comment created time in 3 months

more