github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/nogo.yaml (about) 1 groups: 2 # We define three basic groups: generated (all generated files), 3 # external (all files outside the repository), and internal (all 4 # files within the local repository). We can't enforce many style 5 # checks on generated and external code, so enable those cases 6 # selectively for analyzers below. 7 - name: generated 8 regex: "^(bazel-genfiles|bazel-out|bazel-bin)/" 9 default: true 10 - name: external 11 regex: "^external/" 12 default: false 13 - name: internal 14 regex: ".*" 15 default: true 16 global: 17 generated: 18 suppress: 19 # Suppress the basic style checks for 20 # generated code, but keep the analysis 21 # that are required for quality & security. 22 - "should not use ALL_CAPS in Go names" 23 - "should not use underscores" 24 - "comment on exported" 25 - "methods on the same type should have the same receiver name" 26 - "at least one file in a package" 27 - "package comment should be of the form" 28 # Generated code may have dead code paths. 29 - "identical build constraints" 30 - "no value of type" 31 - "is never used" 32 # go_embed_data rules generate unicode literals. 33 - "string literal contains the Unicode format character" 34 - "string literal contains the Unicode control character" 35 - "string literal contains Unicode control characters" 36 - "string literal contains Unicode format and control characters" 37 # Some external code will generate protov1 38 # implementations. These should be ignored. 39 - "proto.* is deprecated" 40 - "xxx_messageInfo_.*" 41 - "receiver name should be a reflection of its identity" 42 # Generated gRPC code is not compliant either. 43 - "error strings should not be capitalized" 44 - "grpc.Errorf is deprecated" 45 # Generated proto code does not always follow capitalization conventions. 46 - "(field|method|struct|type) .* should be .*" 47 # Generated proto code sometimes duplicates imports with aliases. 48 - "duplicate import" 49 # These will never be annotated. 50 - "unexpected call to atomic function" 51 internal: 52 suppress: 53 # We use ALL_CAPS for system definitions, 54 # which are common enough in the code base 55 # that we shouldn't annotate exceptions. 56 # 57 # Same story for underscores. 58 - "should not use ALL_CAPS in Go names" 59 - "should not use underscores in Go names" 60 # These need to be annotated. 61 - "unexpected call to atomic function.*" 62 - "return with unexpected locks held.*" 63 - "incompatible return states.*" 64 exclude: 65 # Generated: exempt all. 66 - pkg/shim/runtimeoptions/runtimeoptions_cri.go 67 analyzers: 68 asmdecl: 69 external: # Enabled. 70 assign: 71 external: 72 exclude: 73 - gazelle/walk/walk.go 74 atomic: 75 external: # Enabled. 76 bools: 77 external: # Enabled. 78 buildtag: 79 external: # Enabled. 80 cgocall: 81 external: # Enabled. 82 checklocks: 83 internal: 84 exclude: 85 - "^-$" # b/181776900: analyzer fails on buildkite. 86 shadow: # Disable for now. 87 generated: 88 exclude: [".*"] 89 internal: 90 exclude: [".*"] 91 composites: # Disable for now. 92 generated: 93 exclude: [".*"] 94 internal: 95 exclude: [".*"] 96 errorsas: 97 external: # Enabled. 98 httpresponse: 99 external: # Enabled. 100 loopclosure: 101 external: # Enabled. 102 nilfunc: 103 external: # Enabled. 104 nilness: 105 internal: 106 exclude: 107 - pkg/sentry/platform/kvm/kvm_test.go # Intentional. 108 - tools/bigquery/bigquery.go # False positive. 109 printf: 110 external: # Enabled. 111 shift: 112 generated: # Disabled for generated code; these shifts are well-defined. 113 exclude: [".*"] 114 external: # Enabled. 115 stringintconv: 116 external: 117 exclude: 118 - ".*protobuf/.*.go" # Bad conversions. 119 - ".*flate/huffman_bit_writer.go" # Bad conversion. 120 # Runtime internal violations. 121 - ".*reflect/value.go" 122 - ".*encoding/xml/xml.go" 123 - ".*runtime/pprof/internal/profile/proto.go" 124 - ".*fmt/scan.go" 125 - ".*go/types/conversions.go" 126 - ".*golang.org/x/net/dns/dnsmessage/message.go" 127 tests: 128 external: # Enabled. 129 unmarshal: 130 external: # Enabled. 131 unreachable: 132 external: # Enabled. 133 unsafeptr: 134 internal: 135 exclude: 136 - ".*_test.go" # Exclude tests. 137 - "pkg/flipcall/.*_unsafe.go" # Special case. 138 - pkg/gohacks/gohacks_unsafe.go # Special case. 139 - pkg/ring0/pagetables/allocator_unsafe.go # Special case. 140 - pkg/sentry/fs/fsutil/host_file_mapper_unsafe.go # Special case. 141 - pkg/sentry/platform/kvm/bluepill_unsafe.go # Special case. 142 - pkg/sentry/platform/kvm/machine_unsafe.go # Special case. 143 - pkg/sentry/platform/safecopy/safecopy_unsafe.go # Special case. 144 - pkg/sentry/usage/memory_unsafe.go # Special case. 145 - pkg/sentry/vfs/mount_unsafe.go # Special case. 146 - pkg/state/decode_unsafe.go # Special case. 147 unusedresult: 148 external: # Enabled. 149 checkescape: 150 external: # Enabled. 151 SA4016: 152 internal: 153 exclude: 154 - pkg/gohacks/gohacks_unsafe.go # x ^ 0 always equals x. 155 SA2001: 156 internal: 157 exclude: 158 - pkg/sentry/fs/fs.go # Intentional. 159 - pkg/sentry/fs/gofer/inode.go # Intentional. 160 - pkg/refs/refcounter_test.go # Intentional. 161 ST1019: 162 generated: 163 exclude: 164 # package ".../kubeapi/core/v1/v1" is being imported more than once 165 - generated.gen.pb.go 166 ST1021: 167 internal: 168 suppress: 169 - "comment on exported type Translation" # Intentional. 170 - "comment on exported type PinnedRange" # Intentional. 171 SA5011: 172 internal: 173 exclude: 174 # https://github.com/dominikh/go-tools/issues/924 175 - pkg/sentry/fs/fdpipe/pipe_opener_test.go 176 - pkg/tcpip/tests/integration/link_resolution_test.go