Skip to content

Commit

Permalink
Autoformatting
Browse files Browse the repository at this point in the history
Added make target for auto fomratting Jsonnet code.
Applied the auto formatting to all Jsonnet files.
  • Loading branch information
Christian Haeusler committed Jun 12, 2020
1 parent 19b032d commit c916deb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@ SHELL := bash
.DELETE_ON_ERROR:
.SUFFIXES:

FILES_JSONNET ?= $(shell find . -type f -name '*.*jsonnet' -or -name '*.libsonnet')
FILES_YAML ?= $(shell find . -type f -name '*.yaml' -or -name '*.yml')

JSONNETFMT_ARGS ?= --in-place

.PHONY: all
all: lint

.PHONY: lint
lint: lint_jsonnet lint_yaml

.PHONY: lint_jsonnet
lint_jsonnet: $(shell find . -type f -name '*.*jsonnet' -or -name '*.libsonnet')
jsonnetfmt --in-place --test -- $?
lint_jsonnet: $(FILES_JSONNET)
jsonnetfmt $(JSONNETFMT_ARGS) --test -- $?

.PHONY: lint_yaml
lint_yaml: $(shell find . -type f -name '*.yaml' -or -name '*.yml')
lint_yaml: $(FILES_YAML)
yamllint -f parsable --no-warnings -- $?

.PHONY: format
format: format_jsonnet

.PHONY: format_jsonnet
format_jsonnet: $(FILES_JSONNET)
jsonnetfmt $(JSONNETFMT_ARGS) -- $?
4 changes: 2 additions & 2 deletions component/ldap.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ local syncConfig(namespace, idp, sa) =
'--whitelist=' + mount + files.whitelist,
],
volumeMounts_+: {
[volume]: {mountPath: mount},
[volume]: { mountPath: mount },
},
},
],
serviceAccountName: sa,
volumes_+: {
[volume]: {secret: {secretName: name}},
[volume]: { secret: { secretName: name } },
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// main template for openshift4-oauth
local ldap = import 'ldap.libsonnet';
local com = import 'lib/commodore.libjsonnet';
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local oauth = import 'lib/openshift4-oauth.libjsonnet';
local ldap = import 'ldap.libsonnet';
local inv = kap.inventory();
// The hiera parameters for the component
local params = inv.parameters.openshift4_oauth;
Expand Down Expand Up @@ -110,5 +110,5 @@ local clusterOAuth = kube._Object('config.openshift.io/v1', 'OAuth', 'cluster')
[if std.length(secrets) > 0 then '02_secrets']: secrets,
[if std.length(configs) > 0 then '03_configs']: configs,
'10_oauth': clusterOAuth,
[ if std.length(ldapSync) > 2 then '20_ldap_sync']: ldapSync,
[if std.length(ldapSync) > 2 then '20_ldap_sync']: ldapSync,
}

0 comments on commit c916deb

Please sign in to comment.