Skip to content

Commit 82e1f9d

Browse files
committed
Support Spanner schema and Skylark files.
Adds support for the .sdl file extension which is used for Spanner's Schema Definition Language. It uses -- for comments in the manner of .sql files. Adds support for the .bzl file extension which is used for Bazel's Starlark language. It uses # for comments in the manner of Python.
1 parent df58aca commit 82e1f9d

File tree

5 files changed

+56
-2
lines changed

5 files changed

+56
-2
lines changed

main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,13 @@ func licenseHeader(path string, tmpl *template.Template, data *copyrightData) ([
211211
lic, err = prefix(tmpl, data, "/**", " * ", " */")
212212
case ".cc", ".cpp", ".cs", ".go", ".hh", ".hpp", ".java", ".m", ".mm", ".proto", ".rs", ".scala", ".swift", ".dart", ".groovy", ".kt", ".kts":
213213
lic, err = prefix(tmpl, data, "", "// ", "")
214-
case ".py", ".sh", ".yaml", ".yml", ".dockerfile", "dockerfile", ".rb", "gemfile":
214+
case ".py", ".sh", ".yaml", ".yml", ".dockerfile", "dockerfile", ".rb", "gemfile", ".bzl":
215215
lic, err = prefix(tmpl, data, "", "# ", "")
216216
case ".el", ".lisp":
217217
lic, err = prefix(tmpl, data, "", ";; ", "")
218218
case ".erl":
219219
lic, err = prefix(tmpl, data, "", "% ", "")
220-
case ".hs", ".sql":
220+
case ".hs", ".sql", ".sdl":
221221
lic, err = prefix(tmpl, data, "", "-- ", "")
222222
case ".html", ".xml", ".vue":
223223
lic, err = prefix(tmpl, data, "<!--", " ", "-->")

testdata/expected/file.bzl

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2018 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Say hello
16+
def hello():
17+
print("Hello world!")
18+
19+
hello()

testdata/expected/file.sdl

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-- Copyright 2018 Google LLC
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
15+
-- This is a fake table.
16+
CREATE TABLE Foo (
17+
-- This is a fake column.
18+
Bar INT64 NOT NULL,
19+
20+
-- Another fake column.
21+
Baz STRING(MAX) NOT NULL,
22+
) PRIMARY KEY (Bar);

testdata/initial/file.bzl

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Say hello
2+
def hello():
3+
print("Hello world!")
4+
5+
hello()

testdata/initial/file.sdl

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- This is a fake table.
2+
CREATE TABLE Foo (
3+
-- This is a fake column.
4+
Bar INT64 NOT NULL,
5+
6+
-- Another fake column.
7+
Baz STRING(MAX) NOT NULL,
8+
) PRIMARY KEY (Bar);

0 commit comments

Comments
 (0)