Skip to content

Commit

Permalink
chore: enforce formatting (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo authored Sep 19, 2022
1 parent 56ef9fb commit e7e4226
Show file tree
Hide file tree
Showing 55 changed files with 588 additions and 1,402 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Format

on:
pull_request:
push:

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- run: make format
- name: Indicate formatting issues
run: git diff HEAD --exit-code --color
20 changes: 13 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.18'
go-version: "1.18"
- run: |
go test -tags sqlite -failfast -short -timeout=20m $(go list ./... | grep -v sqlcon | grep -v watcherx | grep -v pkgerx | grep -v configx)
shell: bash
Expand Down Expand Up @@ -48,12 +48,14 @@ jobs:
MYSQL_ROOT_PASSWORD: test
steps:
- name: Start cockroach
run: docker run --name cockroach -p 26257:26257 -d cockroachdb/cockroach:v20.2.5 start-single-node --insecure
run:
docker run --name cockroach -p 26257:26257 -d
cockroachdb/cockroach:v20.2.5 start-single-node --insecure
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.18.0'
go-version: "1.18.0"
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -69,7 +71,9 @@ jobs:
- name: Run nancy
uses: sonatype-nexus-community/nancy-github-action@main
- run: make .bin/go-acc .bin/gcov2lcov
- run: COCKROACH_BINARY=cockroach .bin/go-acc -o coverage.out ./... -- -v -failfast -timeout=5m -tags sqlite
- run:
COCKROACH_BINARY=cockroach .bin/go-acc -o coverage.out ./... -- -v
-failfast -timeout=5m -tags sqlite
- name: Convert coverage report to lcov
run: .bin/gcov2lcov -infile=coverage.out -outfile=coverage.lcov
- name: Coveralls
Expand All @@ -86,12 +90,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: '0'
fetch-depth: "0"
- uses: actions/setup-node@v2
with:
node-version: '14'
node-version: "14"
- name: Define next tag
run: npx semver -- $(git describe --tags `git rev-list --tags --max-count=1`)
run:
npx semver -- $(git describe --tags `git rev-list --tags
--max-count=1`)
- name: Create git tag
run: |
git tag "v$(npx semver -- $(git describe --tags `git rev-list --tags --max-count=1`) --increment=patch)"
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ linters:
run:
skip-files:
- "migrate_files.go" # go-bindata
- ".+_test.go"
- ".+_test.go"
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github/pull_request_template.md
clidoc/testdata/
healthx/openapi/patch.yaml
.snapshots
fixtures
26 changes: 7 additions & 19 deletions .schemas/corsx/viper.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
"type": "string",
"minLength": 1
},
"default": [
"*"
],
"default": ["*"],
"uniqueItems": true,
"examples": [
"https://example.com",
Expand All @@ -47,13 +45,7 @@
]
},
"uniqueItems": true,
"default": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
]
"default": ["GET", "POST", "PUT", "PATCH", "DELETE"]
},
"allowed_headers": {
"description": "A list of non simple headers the client is allowed to use with cross-domain requests.",
Expand All @@ -64,10 +56,7 @@
},
"minLength": 1,
"uniqueItems": true,
"default": [
"Authorization",
"Content-Type"
]
"default": ["Authorization", "Content-Type"]
},
"exposed_headers": {
"description": "Indicates which headers are safe to expose to the API of a CORS API specification",
Expand All @@ -78,9 +67,7 @@
},
"minLength": 1,
"uniqueItems": true,
"default": [
"Content-Type"
]
"default": ["Content-Type"]
},
"allow_credentials": {
"type": "boolean",
Expand All @@ -92,7 +79,8 @@
"type": "number",
"default": 0,
"title": "Maximum Age",
"description": "Indicates how long (in seconds) the results of a preflight request can be cached. The default is 0 which stands for no max age."},
"description": "Indicates how long (in seconds) the results of a preflight request can be cached. The default is 0 which stands for no max age."
},
"debug": {
"type": "boolean",
"default": false,
Expand All @@ -101,4 +89,4 @@
}
},
"additionalProperties": false
}
}
16 changes: 3 additions & 13 deletions .schemas/logrusx/viper.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,17 @@
"level": {
"type": "string",
"default": "info",
"enum": [
"panic",
"fatal",
"error",
"warn",
"info",
"debug"
],
"enum": ["panic", "fatal", "error", "warn", "info", "debug"],
"title": "Level",
"description": "Debug enables stack traces on errors. Can also be set using environment variable LOG_LEVEL."
},
"format": {
"type": "string",
"default": "text",
"enum": [
"text",
"json"
],
"enum": ["text", "json"],
"title": "Format",
"description": "The log format can either be text or JSON."
}
},
"additionalProperties": false
}
}
5 changes: 1 addition & 4 deletions .schemas/profilingx/viper.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
"title": "Profiling",
"description": "Enables CPU or memory profiling if set. For more details on profiling Go programs read [Profiling Go Programs](https://blog.golang.org/profiling-go-programs).",
"type": "string",
"enum": [
"cpu",
"mem"
]
"enum": ["cpu", "mem"]
}
20 changes: 11 additions & 9 deletions .schemas/tlsx/viper.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"path": {
"title": "Path to PEM-encoded Fle",
"type": "string",
"examples": [
"path/to/file.pem"
]
"examples": ["path/to/file.pem"]
},
"base64": {
"title": "Base64 Encoded Inline",
Expand All @@ -31,15 +29,19 @@
"properties": {
"key": {
"title": "Private Key (PEM)",
"allOf": [{
"$ref": "#/definitions/source"
}]
"allOf": [
{
"$ref": "#/definitions/source"
}
]
},
"cert": {
"title": "TLS Certificate (PEM)",
"allOf": [{
"$ref": "#/definitions/source"
}]
"allOf": [
{
"$ref": "#/definitions/source"
}
]
}
}
}
49 changes: 23 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ https://github.com/ory/meta/blob/master/templates/repository/common/CONTRIBUTING

## Introduction

_Please note_: We take Ory X's security and our users' trust very
seriously. If you believe you have found a security issue in Ory X,
please disclose by contacting us at [email protected].
_Please note_: We take Ory X's security and our users' trust very seriously. If
you believe you have found a security issue in Ory X, please disclose by
contacting us at [email protected].

There are many ways in which you can contribute. The goal of this document is to
provide a high-level overview of how you can get involved in Ory.
Expand All @@ -47,11 +47,9 @@ contributions, and don't want a wall of rules to get in the way of that.

That said, if you want to ensure that a pull request is likely to be merged,
talk to us! You can find out our thoughts and ensure that your contribution
won't clash with Ory
X's direction. A great way to
do this is via
[Ory X Discussions](https://github.com/orgs/ory/discussions)
or the [Ory Chat](https://www.ory.sh/chat).
won't clash with Ory X's direction. A great way to do this is via
[Ory X Discussions](https://github.com/orgs/ory/discussions) or the
[Ory Chat](https://www.ory.sh/chat).

## FAQ

Expand All @@ -68,10 +66,8 @@ or the [Ory Chat](https://www.ory.sh/chat).
- I want to talk to other Ory X users.
[How can I become a part of the community?](#communication)

- I would like to know what I am agreeing to when I contribute to Ory
X.
Does Ory have
[a Contributors License Agreement?](https://cla-assistant.io/ory/x)
- I would like to know what I am agreeing to when I contribute to Ory X. Does
Ory have [a Contributors License Agreement?](https://cla-assistant.io/ory/x)

- I would like updates about new versions of Ory X.
[How are new releases announced?](https://ory.us10.list-manage.com/subscribe?u=ffb1a878e4ec6c0ed312a3480&id=f605a41b53)
Expand All @@ -85,8 +81,8 @@ There are many other ways you can contribute. Here are a few things you can do
to help out:

- **Give us a star.** It may not seem like much, but it really makes a
difference. This is something that everyone can do to help out Ory X.
Github stars help the project gain visibility and stand out.
difference. This is something that everyone can do to help out Ory X. Github
stars help the project gain visibility and stand out.

- **Join the community.** Sometimes helping people can be as easy as listening
to their problems and offering a different perspective. Join our Slack, have a
Expand All @@ -100,11 +96,11 @@ to help out:
help, please share it! Bonus: You get GitHub achievements for answered
discussions.

- **Help with open issues.** We have a lot of open issues for Ory X and
some of them may lack necessary information, some are duplicates of older
issues. You can help out by guiding people through the process of filling out
the issue template, asking for clarifying information, or pointing them to
existing issues that match their description of the problem.
- **Help with open issues.** We have a lot of open issues for Ory X and some of
them may lack necessary information, some are duplicates of older issues. You
can help out by guiding people through the process of filling out the issue
template, asking for clarifying information, or pointing them to existing
issues that match their description of the problem.

- **Review documentation changes.** Most documentation just needs a review for
proper spelling and grammar. If you think a document can be improved in any
Expand All @@ -119,16 +115,17 @@ to help out:
We use [Slack](https://www.ory.sh/chat). You are welcome to drop in and ask
questions, discuss bugs and feature requests, talk to other users of Ory, etc.

Check out [Ory X Discussions](https://github.com/orgs/ory/discussions). This is a great place for
in-depth discussions and lots of code examples, logs and similar data.
Check out [Ory X Discussions](https://github.com/orgs/ory/discussions). This is
a great place for in-depth discussions and lots of code examples, logs and
similar data.

You can also join our community calls, if you want to speak to the Ory team
directly or ask some questions. You can find more info and participate in
[Slack](https://www.ory.sh/chat) in the #community-call channel.

If you want to receive regular notifications about updates to Ory X,
consider joining the mailing list. We will _only_ send you vital information on
the projects that you are interested in.
If you want to receive regular notifications about updates to Ory X, consider
joining the mailing list. We will _only_ send you vital information on the
projects that you are interested in.

Also [follow us on twitter](https://twitter.com/orycorp).

Expand Down Expand Up @@ -163,8 +160,8 @@ checklist to contribute an example:

Unless you are fixing a known bug, we **strongly** recommend discussing it with
the core team via a GitHub issue or [in our chat](https://www.ory.sh/chat)
before getting started to ensure your work is consistent with Ory X's
roadmap and architecture.
before getting started to ensure your work is consistent with Ory X's roadmap
and architecture.

All contributions are made via pull requests. To make a pull request, you will
need a GitHub account; if you are unclear on this process, see GitHub's
Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ $(call make-lint-dependency)
touch -a -m .bin/ory

.PHONY: format
format:
goimports -w -local github.com/ory .
format: .bin/goimports node_modules
.bin/goimports -w -local github.com/ory .
npm exec -- prettier --write .

.bin/goimports: Makefile
GOBIN=$(shell pwd)/.bin go install golang.org/x/tools/cmd/goimports@latest

.bin/golangci-lint: Makefile
bash <(curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh) -d -b .bin v1.46.2
Expand Down Expand Up @@ -60,3 +64,7 @@ mocks: .bin/mockgen
mockgen -package hasherx_test -destination hasherx/mocks_argon2_test.go github.com/ory/x/hasherx Argon2Configurator
mockgen -package hasherx_test -destination hasherx/mocks_bcrypt_test.go github.com/ory/x/hasherx BCryptConfigurator
mockgen -package hasherx_test -destination hasherx/mocks_pkdbf2_test.go github.com/ory/x/hasherx PBKDF2Configurator

node_modules: package-lock.json
npm ci
touch node_modules
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
[![Coverage Status](https://coveralls.io/repos/github/ory/x/badge.svg?branch=master)](https://coveralls.io/github/ory/x?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/ory/x)](https://goreportcard.com/report/github.com/ory/x)

Shared libraries used in the ORY ecosystem. Use at your own risk. Breaking changes should be anticipated.
Shared libraries used in the ORY ecosystem. Use at your own risk. Breaking
changes should be anticipated.
Loading

0 comments on commit e7e4226

Please sign in to comment.