Skip to content

Commit

Permalink
fixup! feat: add editorconfig
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Mar 1, 2024
1 parent b2a1bdf commit 46d41c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
[{*.go,go.mod,Makefile}]
indent_style = unset

[{*.{yaml,yml},PROJECT}]
indent_size = 2

[{*.go,go.mod,*.md,LICENSE}]
[{*.md,LICENSE}]
indent_size = unset
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ jobs:
- name: Check if 'make manifests' was run
run: make check-manifests

# TODO editorconfig
- name: Check all files format
run: make ec
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,21 @@ endef

##@ oadp-nac specifics

EC ?= $(LOCALBIN)/ec-$(EC_VERSION)
EC_VERSION ?= 2.8.0

.PHONY: editorconfig
editorconfig: $(LOCALBIN) ## Download editorconfig locally if necessary.
@[ -f $(EC) ] || { \
set -e ;\
ec_binary=ec-$(shell go env GOOS)-$(shell go env GOARCH) ;\
ec_tar=$(LOCALBIN)/$${ec_binary}.tar.gz ;\
curl -sSLo $${ec_tar} https://github.com/editorconfig-checker/editorconfig-checker/releases/download/$(EC_VERSION)/$${ec_binary}.tar.gz ;\
tar xzf $${ec_tar} ;\
rm -rf $${ec_tar} ;\
mv $(LOCALBIN)/$${ec_binary} $(EC) ;\
}

.PHONY: ci
ci: simulation-test lint docker-build hadolint check-generate check-manifests ec ## Run all checks run by the project continuous integration (CI) locally.

Expand All @@ -223,21 +238,6 @@ check-generate: generate ## Check if 'make generate' was run.
check-manifests: manifests ## Check if 'make manifests' was run.
test -z "$(shell git status --short)" || (echo "run 'make manifests' to generate code" && exit 1)

EC ?= $(LOCALBIN)/ec-$(EC_VERSION)
EC_VERSION ?= 2.8.0

.PHONY: editorconfig
editorconfig: $(LOCALBIN) ## Download editorconfig locally if necessary.
@[ -f $(EC) ] || { \
set -e ;\
ec_binary=ec-$(shell go env GOOS)-$(shell go env GOARCH) ;\
ec_tar=$(LOCALBIN)/$${ec_binary}.tar.gz ;\
curl -sSLo $${ec_tar} https://github.com/editorconfig-checker/editorconfig-checker/releases/download/$(EC_VERSION)/$${ec_binary}.tar.gz ;\
tar xzf $${ec_tar} ;\
rm -rf $${ec_tar} ;\
mv $(LOCALBIN)/$${ec_binary} $(EC) ;\
}

.PHONY: ec
ec: editorconfig ## Run file formatter checks against all project's files.
$(EC)

0 comments on commit 46d41c0

Please sign in to comment.