Skip to content

Commit 7e76feb

Browse files
Merge branch 'main' into CLOUDP-304954
2 parents 1b6dcd4 + 28c4c0e commit 7e76feb

33 files changed

+678278
-679266
lines changed

.github/workflows/code-health-foascli.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ jobs:
6565
go-version-file: 'tools/cli/go.mod'
6666
cache: false # see https://github.com/golangci/golangci-lint-action/issues/807
6767
- name: golangci-lint
68-
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84
68+
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd
6969
with:
70-
version: v1.64.5
70+
version: v2.0.1
7171
working-directory: tools/cli
7272
- name: Checkout GitHub actions
7373
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,28 @@
55

66
This repository hosts the OpenAPI specification for the [Atlas Administration API (v2.0)](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/).
77

8+
9+
10+
## Tools
11+
This repository also contains tools for validating, generating, and distributing OpenAPI specifications.
12+
### FoasCLI
13+
The [tools/cli](tools/cli) directory hosts a Go-based CLI tool used to merge multiple OpenAPI specifications into a single federated specification, which is used for the Admin APIs.
14+
15+
For more details, please refer to the [CLI’s README.md](tools/cli/README.md).
16+
17+
### Spectral
18+
The [tools/spectral](tools/spectral) directory contains MongoDB-specific [Spectral](https://github.com/stoplightio/spectral) rule definitions.
19+
These rules are used to validate that the generated OpenAPI specifications comply with MongoDB’s guidelines.
20+
21+
For more details, please refer to the [Spectral’s README.md](tools/spectral/README.md).
22+
23+
24+
### Postman
25+
The [tools/postman](tools/postman) directory contains the logic required to generate the [MongoDB Atlas Postman collections](https://www.postman.com/mongodb-devrel?tab=collections).
26+
27+
For more details, please refer to the [Spectral’s README.md](tools/postman/README.md).
28+
29+
30+
31+
## Contributing
32+
See our [CONTRIBUTING.md](../../CONTRIBUTING.md) guide.

tools/cli/.golangci.bck.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# TO BE REMOVED IN https://jira.mongodb.org/browse/CLOUDP-308470
2+
3+
linters-settings:
4+
gocritic:
5+
enabled-tags:
6+
- diagnostic
7+
- experimental
8+
- opinionated
9+
- performance
10+
- style
11+
govet:
12+
enable:
13+
- shadow
14+
15+
revive:
16+
# see https://github.com/mgechev/revive#available-rules for details.
17+
ignore-generated-header: true
18+
severity: warning
19+
rules:
20+
- name: blank-imports
21+
- name: context-as-argument
22+
- name: context-keys-type
23+
- name: defer
24+
- name: dot-imports
25+
- name: error-return
26+
- name: error-strings
27+
- name: error-naming
28+
- name: early-return
29+
- name: errorf
30+
- name: exported
31+
- name: import-shadowing
32+
- name: indent-error-flow
33+
- name: if-return
34+
- name: increment-decrement
35+
- name: var-naming
36+
- name: var-declaration
37+
- name: package-comments
38+
- name: range
39+
- name: receiver-naming
40+
- name: time-naming
41+
- name: unexported-return
42+
- name: indent-error-flow
43+
- name: errorf
44+
- name: empty-block
45+
- name: superfluous-else
46+
- name: struct-tag
47+
- name: unused-parameter
48+
- name: unreachable-code
49+
- name: redefines-builtin-id
50+
- name: unused-receiver
51+
- name: constant-logical-expr
52+
- name: confusing-naming
53+
- name: unnecessary-stmt
54+
- name: use-any
55+
- name: imports-blocklist
56+
arguments:
57+
- "github.com/pkg/errors"
58+
misspell:
59+
locale: US
60+
lll:
61+
line-length: 150
62+
nestif:
63+
# minimal complexity of if statements to report, 5 by default
64+
min-complexity: 7
65+
funlen:
66+
lines: 360
67+
statements: 120
68+
gci:
69+
sections:
70+
- standard
71+
- default
72+
linters:
73+
disable-all: true
74+
enable:
75+
- copyloopvar # copyloopvar is a linter detects places where loop variables are copied
76+
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
77+
- errcheck # errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases
78+
- errorlint # Errorlint is a linter that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
79+
- exhaustive # check exhaustiveness of enum switch statements
80+
- copyloopvar # copyloopvar is a linter detects places where loop variables are copied. Replaces exportloopref since Go1.22
81+
- funlen # Tool for detection of long functions
82+
- gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false]
83+
- gocritic # Provides diagnostics that check for bugs, performance and style issues.
84+
- godot # Check if comments end in a period [fast: true, auto-fix: true]
85+
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
86+
- goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode.
87+
- goprintffuncname # Checks that printf-like functions are named with `f` at the end.
88+
- gosec # Inspects source code for security problems
89+
- gosimple # Linter for Go source code that specializes in simplifying code
90+
- govet # Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes.
91+
- ineffassign # Detects when assignments to existing variables are not used
92+
- lll # Reports long lines
93+
- makezero # Finds slice declarations with non-zero initial length
94+
- misspell # Finds commonly misspelled English words
95+
- nakedret # Checks that functions with naked returns are not longer than a maximum size (can be zero).
96+
- noctx # Finds sending http request without context.Context
97+
- nolintlint # Reports ill-formed or insufficient nolint directives
98+
- perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative.
99+
- prealloc # Finds slice declarations that could potentially be pre-allocated
100+
- predeclared # find code that shadows one of Go's predeclared identifiers
101+
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
102+
- rowserrcheck # checks whether Rows.Err of rows is checked successfully
103+
- staticcheck # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint.
104+
- stylecheck # Stylecheck is a replacement for golint
105+
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
106+
- testifylint # Checks usage of github.com/stretchr/testify.
107+
- thelper # thelper detects tests helpers which is not start with t.Helper() method.
108+
- unconvert # Remove unnecessary type conversions
109+
- unused # Checks Go code for unused constants, variables, functions and types
110+
- whitespace # Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc.
111+
112+
# don't enable:
113+
# - deadcode
114+
# - varcheck
115+
# - structcheck
116+
# - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
117+
# - gocyclo # we already have funlen lint
118+
# - dupl # we have a lot of duplicate test cases
119+
# - gochecknoinits # we need the init function for the provider
120+
# - gochecknoglobals # we need some global variables
121+
# - unparam # Forces to create global variables when one variable is repeated in different functions
122+
# - goerr113 # It does not allow you to return an error, you need to save the error in a variable to do it
123+
# - goconst
124+
# - gocognit
125+
126+
run:
127+
timeout: 10m
128+
tests: true
129+
modules-download-mode: readonly

0 commit comments

Comments
 (0)