Commit Graph

66 Commits

Author SHA1 Message Date
aleksandr.vodyanov
bc2ae7b9b2 add new extensions 2024-05-13 18:29:10 +03:00
Stanislav Gabenov
65deee00fd [DO-169] Modify to add template with Avroid license 2024-04-10 14:47:27 +03:00
sjswerdlow
183e474cde Adding support for the j2 format. See: https://tedboy.github.io/jinja2/templ5.html 2023-07-25 16:24:50 +00:00
Marc
ef92449ebb Merge branch 'master' into patch-1 2023-06-13 22:23:31 +01:00
Peter Meric
e88333e754 Support *.BUILD files
bazel build files for external repos -- eg. used in conjunction with `http_archive` -- are often named <repo>.BUILD
2023-05-26 17:28:19 -04:00
Alyssa Haroldsen
5c8c44041a Add support for TOML configuration files
This is used in many contexts, including being the format used by
Cargo, the Rust package manager.
2023-04-11 19:14:34 -07:00
Xuehai Pan
66bad5e563 fix: fix extra spacing in Apache License template 2023-01-18 13:42:46 +08:00
Mike Verbanic
cfe103d3f1 update terraform to use hash as comment per recommended guidelines (#137)
* update terraform to use hash as comment per recommended guidelines (https://developer.hashicorp.com/terraform/language/syntax/configuration\#comments)

* update golanci-lint version in linter.yaml per PR #132
2023-01-16 09:07:57 -08:00
Omkar Ghanekar
53d978ad7e Add support for bazel BUILD files 2022-10-10 19:30:07 -07:00
Muhammad Talal Anwar
eadb73ac0d Only log skipped files in verbose mode 2022-08-26 07:57:04 -07:00
Will Norris
8cfc1b5425 chore: fix govet error on trailing newline
conversation in golang/go#18085, but basically a single trailing newline
is a govet error, but two are not.
2022-04-21 16:21:41 -07:00
Ben Ford
758687b5e3 Add support for Puppet manifests (#92) 2022-04-20 13:21:18 -07:00
Will Norris
2b44b36759 feat: add support for cmake files
Co-authored-by: Sergii Baitala <sbaitala@gmail.com>
2021-11-15 07:55:21 -08:00
Will Norris
90da58c801 refactor: prep for additional licenseHeader logic
this refactors licenseHeader to make it easier to add additional logic
to determine prefix, beyond just file extension.
2021-11-15 07:55:21 -08:00
Carlos Boneti
fc41b40a66 Added .pl to the list of supported files (#98)
* Added .pl to the list of supported files

Includes support for Perl (.pl) file, treated in the same way as shell scripts.

* Adding .pl to the relevant test case
2021-10-27 18:51:01 -07:00
Will Norris
2fe3ee9447 fix: use block-style comments for java, scala, kotlin
fixes #46
2021-08-14 14:09:22 -07:00
Sergii Baitala
9cc7ec3e36 Support WiX files 2021-08-10 10:04:08 -07:00
Will Norris
4f7a460357 support ignoring file or directories
use the doublestar library to support pattern matching of files or
directories to ignore. This replaces (and deprecates) the previous
-skip flag which only supported file extensions.
2021-08-09 12:52:40 -07:00
CrazyMax
99ebc9c9db Update Dockerfile handling to keep parser directives at the top
Signed-off-by: CrazyMax <google@crazymax.dev>
2021-08-09 12:50:07 -07:00
CrazyMax
5be3beef79 Add hcl extension
Signed-off-by: CrazyMax <google@crazymax.dev>
2021-08-09 12:45:59 -07:00
Will Norris
b431030b15 use text/template to avoid HTML escaping
Co-authored-by: Roy O'Young <roy2220@outlook.com>

Closes #57
2021-08-09 11:36:20 -07:00
Will Norris
366936ef00 tests: add unit tests for header and template funcs
Much of this is being tested with the existing file-based tests in
testdata/*, but this moves us toward a much more targetted and simpler
test structure.
2021-08-09 11:20:27 -07:00
Will Norris
792e7a3462 migrate CI to GitHub Actions
use codecov.io to report on code coverage.
fix a few issues raised by golangci-lint
2021-07-27 22:11:04 -07:00
Will Norris
97ae522f98 add support for SPDX license headers
This adds a new "-s" flag that will append an SPDX-License-Identifier
line to license headers.  If "-s=only" is specified, then only the SPDX
identifier will be used.

This also changes the "-l" flag to use SPDX identifiers, with mappings
to support the legacy "apache", "mit", and "mpl" values.  Together with
the "-s" flag, this allows SPDX headers for any arbitrary license type
to be added to files.

Co-authored-by: Bob Callaway <bcallawa@redhat.com>
2021-07-26 20:43:15 -07:00
Will Norris
c2fdf83882 refactor template parsing logic
Move the logic for selecting a license template based on user input into
a standalone func (fetchTemplate), and add test cases for all code
paths.

Delay parsing predefined license templates. This allows the new
fetchTemplate method to modify these templates before returning in the
future (to add SPDX license information).  Add tests to ensure that
these templates must always parse properly.

Rename copyrightData type to licenseData, since we will soon begin to
add more than just copyright data here (SPDX ID).

Rename prefix func to executeTemplate, since this better describes what
the function is doing.

These are all refactoring and cleanup changes; no behavioral changes.
2021-07-26 19:38:13 -07:00
Carlos Panato
ab5e2b3095 skip extensions or files 2021-04-28 11:01:02 +02:00
Piotr Sikora
73f8d3e793 Skip .bzl files generated by cargo raze.
Broken by #45.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2020-08-18 07:36:45 +00:00
Marc Cohen
6f4cd4aacc Merge pull request #42 from tpryan/master
Adding support for SCSS and Sass files.
2020-08-17 06:19:35 +01:00
Marc Cohen
38d99b79c9 Merge pull request #43 from TomerAberbach/master
Support DOT files
2020-08-17 06:16:32 +01:00
Marc Cohen
144dc783ad Merge branch 'master' into master 2020-08-17 06:15:11 +01:00
Marc Cohen
03fdaf6bea Merge pull request #49 from ax3ghazy/master
{.tcl,.v,.sv} support
2020-08-17 06:06:13 +01:00
Mark Fashing
82e1f9d7b8 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.
2020-07-28 14:15:54 -06:00
Ahmed Ghazy
a31a084d2c {.tcl,.v,.sv} support 2020-07-25 21:46:31 +02:00
Tomer Aberbach
c4cb7c1b63 feat: support graphviz file extension 2020-07-04 00:10:47 -04:00
Terrence Ryan
e2ec6d07f7 Adding support for SCSS and Sass files. 2020-06-23 10:56:15 -07:00
Marc-Antoine Ruel
541722a254 Skip generated files
Ensure it skips for both check only mode and modification mode.

Fixes #39
2020-06-22 12:57:52 -04:00
Tomer Aberbach
9f75d2be47 feat: support .mjs and .cjs javascript file extensions 2020-04-25 20:42:34 -04:00
Marc Cohen
68a83edd47 Merge pull request #35 from YangjingZhou/master
feat: add vue file type
2020-04-22 18:24:52 +01:00
Tim Clifford
fb22319bcc add support for MPL license 2020-04-14 21:20:33 +02:00
YangjingZhou
d5a1286c05 feat:add filetype vue 2020-03-20 09:53:37 +08:00
Lei
9db1a20351 Fix typo 2020-03-01 16:58:26 +08:00
alex
20ee99ff6a Update .php handling to keep <?php at the top
Looking at https://www.php.net/manual/en/language.basic-syntax.phptags.php
there are just too many variations and I'm not convinced the added
complexity to support all of them would be worth it here.

Thus, support only the case where closing tag "?>" is either omitted
or on a separate line. A workaround for all other cases is to add
the license header manually.

Can always revisit this later.
2020-02-22 20:45:35 +01:00
Mithun Ayachit
27146d5f03 Implement -check flag
When this flag is used:

* The program never modifies any files
* If all files in the pattern contain a license, the program exits with
a zero exit code
* If at least one file in the pattern requires modification to include
license text, the program prints such files to STDOUT and exits with
a non-zero exit code
2020-02-18 08:54:38 -05:00
Mithun Ayachit
c46413539e replace WaitGroup with errgroup to allow error handling and propagation
The program now exits with a non-zero code when errors are encountered
while reading and/or writing files.

This now also introduces Go Modules for dependency management
2020-02-12 06:05:24 -06:00
Thiébaud Weksteen
fd1a812fc2 Add verbose option to print filename when modified
Adds the -v option which prints the name of the files that have been
modified.
2020-01-08 05:56:47 +01:00
Frank Farzan
d70fc5530d Support TypeScript files 2019-12-05 13:43:45 -08:00
Alejandro Lopez
0df0829f35 Add OCaml files to list of accepted extensions 2019-09-06 11:56:11 -04:00
mjduijn
ba3f334c00 Add kotlin files to list of accepted extensions 2019-05-10 11:35:41 +02:00
alex
f6c8b89ee5 Switch year arg from int to string
This effectively allows for arbitrary copyright
years. For instance, 2018-2019.
2019-01-07 14:10:08 +01:00
Daniel Seymour
66fdaacba5 Update test data licenses to use the current year and copyright holder 2018-12-19 15:59:35 -08:00