Skip to content

Commit

Permalink
Stop skipping JSON copyright & license headers by default. (#3959)
Browse files Browse the repository at this point in the history
A lot of the JSON we use is parsed by VSCode or other systems that are
happy to have comments in them, and we should retain a license header
there. We can exclude specific files where this is a problem. I think
the `package.json` and generated lock file from it are two such cases
where we can't have the license header, but we can directly exclude more
as needed.

This should help make sure that when we *do* have a license header in a
JSON file it stays up to date and is formatted canonically.
  • Loading branch information
chandlerc committed May 21, 2024
1 parent e028fbe commit 8e92d3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

{
"name": "carbon-lang",
"build": {
Expand Down
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,12 @@ repos:
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
Exceptions. See /LICENSE for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- --skip_pattern
# The default skip pattern skips JSON which we use with VSCode and
# it, like most file-based parsers, can support comments easily.
- '(^LICENSE|\.(ico))$'
- --custom_format
- '\.(carbon|proto|ypp)(\.tmpl)?$'
- '\.(carbon|c|json|proto|ypp)(\.tmpl)?$'
- ''
- '// '
- ''
Expand Down Expand Up @@ -209,18 +213,15 @@ repos:
- ''
- '-- '
- ''
- --custom_format
- '\.c$'
- ''
- '// '
- ''
exclude: |
(?x)^(
.bazelversion|
.github/pull_request_template.md|
.vscode/extensions.json|
compile_flags.txt|
github_tools/requirements.txt|
third_party/.*|
utils/vscode/package(-lock)?.json|
.*\.def|
.*\.svg|
.*/fuzzer_corpus/.*|
Expand Down

0 comments on commit 8e92d3a

Please sign in to comment.