Skip to content

Commit 7758f2c

Browse files
authored
Add pre-commit hooks to format trailing whitespaces (#924)
1 parent b0b1d47 commit 7758f2c

File tree

20 files changed

+118
-131
lines changed

20 files changed

+118
-131
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ repos:
1010
hooks:
1111
- id: buildifier
1212
- id: buildifier-lint
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v5.0.0
15+
hooks:
16+
- id: check-toml
17+
- id: destroyed-symlinks
18+
- id: detect-private-key
19+
- id: end-of-file-fixer
20+
exclude: |
21+
(?x)^(
22+
tests/testdata/
23+
)
24+
- id: trailing-whitespace
1325
- repo: https://github.com/crate-ci/typos
1426
rev: v1.29.4
1527
hooks:

CHANGELOG.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Thanks to: Alex Bozhenko, Chuck Grindel, Diego Ortin, and Tomasz Wojno
5151

5252
**Breaking Changes
5353
- Remove PackageArtifactsInfo. (#752)
54-
54+
5555
Thanks to: Adam Azarchs, Alex Eagle, August Karlstedt, Austin Schuh, Adrian Vogelsgesang,
5656
flode, Florian Scheibner, Ignas Kaziukėnas, Jean-Hadrien Chabran, Matt,
5757
Mike Kelly, Paul Draper, Sam Schwebach, Tomasz Wojno, and Vertexwahn
@@ -117,7 +117,7 @@ for contributions to this release.
117117
- Get rid of the long deprecated archive_name and extension from pkg_zip. (#552)
118118
- Make 'out' work in a reasonable way. Fixes #414
119119
- Partial fix for #284
120-
120+
121121
## Bug fixes:
122122

123123
- Only allow .deb Description to be multiline. (#573)
@@ -533,23 +533,23 @@ commit 48001d12e7037b04dc5b28fadfb1e10a8447e2fc
533533
Date: Thu Mar 12 15:14:32 2020 -0400
534534

535535
Depend on rules_python (#140)
536-
536+
537537
* load rules python
538-
538+
539539
* add workspace deps
540-
540+
541541
* add missing loads
542542

543543
commit 2b375a08bfe36d2c35885a6f4e5b12d7898c9426
544544
Author: Ryan Beasley <[email protected]>
545545
Date: Wed Mar 11 14:49:21 2020 -0400
546546

547547
Update test data in response to #121 (#137)
548-
548+
549549
PR #121 changed pkg_deb's behavior but didn't update test data to match.
550-
550+
551551
Reported in PR #132.
552-
552+
553553
Testing Done:
554554
- `bazelisk test ...`
555555

@@ -558,45 +558,45 @@ commit e5919f43791b2d4c5ab9e68786087cf889b9987e
558558
Date: Fri Feb 28 01:22:37 2020 -0500
559559

560560
Add pkgfilegroup for package-independent destination mappings (#128)
561-
561+
562562
* Add pkgfilegroup for package-independent destination mappings
563-
563+
564564
This adds an experimental rule, `pkgfilegroup`, along with associated Providers,
565565
that gives rule developers and users a consistent mechanism for using the output
566566
of bazel targets in packaging rules.
567-
567+
568568
Inspired by #36.
569-
569+
570570
Other capabilities that are provided by this that were not mentioned in #36 are:
571-
571+
572572
- Creation of empty directories (`pkg_mkdirs`)
573573
- Exclusion of files from a `pkgfilegroup` (`excludes`)
574574
- Renames of files in a `pkgfilegroup` (`renames`)
575-
575+
576576
* Add analysis tests for pkgfilegroup and friends
577-
577+
578578
This provides some analysis tests for various features of `pkgfilegroup` and
579579
`pkg_mkdirs`. See #128.
580-
580+
581581
You can run them by invoking `bazel test experimental/...` from the `pkg`
582582
directory
583-
583+
584584
This implementation of pkgfilegroup was inspired by #36.
585585

586586
commit 7a991dea418ab17c7e86f0a7b5e7d4a87ef4304b
587587
Author: Ryan Beasley <[email protected]>
588588
Date: Fri Feb 28 01:02:24 2020 -0500
589589

590590
Improve handling of sources from external repositories (#132)
591-
591+
592592
Avoid use of [`File.short_path`][1] when mapping filenames, because when
593593
creating archives from files imported from external repositories we'll create
594594
archive members with leading `./../` prefixes. Instead, we'll stick to stripping
595595
to leading `File.root.path` (if present) from `File.path`, resulting in archive
596596
members like `external/repo/package/file.txt`.
597-
597+
598598
[1]: https://docs.bazel.build/versions/master/skylark/lib/File.html#short_path
599-
599+
600600
Resolves #131.
601601

602602
commit 532f2857e712c5fcb71c662d680108685b242251
@@ -610,7 +610,7 @@ commit 5877fa85b8598b5bb2186d3addca2408b1e61c5e
610610
Date: Fri Feb 28 05:49:40 2020 +0000
611611

612612
Rpm source date epoch (#113)
613-
613+
614614
* Added --source_date_epoch
615615
* Support source_date_epoch_file since stamp variables are not accessible
616616
* Fixed _make_rpm label
@@ -628,25 +628,25 @@ commit 2f5c9815a7bde4f18acfde268bd63fedd107d87c
628628
Date: Wed Dec 4 22:32:01 2019 +0100
629629

630630
Add "./" prefix to files in control.tar (#121)
631-
631+
632632
This improves compatibility to Debian packages created using dpkg.
633-
633+
634634
https://github.com/bazelbuild/rules_pkg/issues/116
635635

636636
commit 2f09779667f0d6644c2ca5914d6113a82666ec63
637637
Author: Benjamin Peterson <[email protected]>
638638
Date: Fri Nov 15 10:09:45 2019 -0800
639639

640640
pkg_deb: Support Breaks and Replaces. (#117)
641-
641+
642642
https://www.debian.org/doc/debian-policy/ch-relationships.html#overwriting-files-and-replacing-packages-replaces
643643

644644
commit 9192d3b3a0f6ccfdecdc66f08f0b2664fa0afc0f
645645
Author: Tony Aiuto <[email protected]>
646646
Date: Fri Oct 4 16:33:47 2019 -0400
647647

648648
Fix repo names with '-' in them.
649-
649+
650650
We can not use the form "@repo-name" in Bazel, so the common solution is
651651
to transform that to "@repo_name". We auto-correct the repo names to the
652652
required form when printing the WORKSPACE stanza.

doc_build/merge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def fix_stardoc_table_align(line: str) -> str:
7575

7676
def main(argv: typing.Sequence[str]) -> None:
7777
wrapper_map = {}
78-
for file in argv[1:]:
78+
for file in argv[1:]:
7979
merge_file(file, sys.stdout, wrapper_map)
8080
if wrapper_map:
8181
print("We didn't use all the @wraps()", wrapper_map, file=sys.stderr)

docs/0.10.0/reference.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pkg_deb(<a href="#pkg_deb-name">name</a>, <a href="#pkg_deb-architecture">archit
109109
- `out` the Debian package or a symlink to the actual package.
110110
- `deb` the package with any precise file name created with `package_file_name`.
111111
- `changes` the .changes file.
112-
112+
113113

114114
**ATTRIBUTES**
115115

@@ -225,7 +225,7 @@ Creates an RPM format package via `pkg_filegroup` and friends.
225225
- `out` the RPM or a symlink to the actual package.
226226
- `rpm` the package with any precise file name created with `package_file_name`.
227227
- `changes` the .changes file.
228-
228+
229229

230230
**ATTRIBUTES**
231231

@@ -396,30 +396,30 @@ filter_directory(<a href="#filter_directory-name">name</a>, <a href="#filter_dir
396396
Transform directories (TreeArtifacts) using pkg_filegroup-like semantics.
397397

398398
Effective order of operations:
399-
399+
400400
1) Files are `exclude`d
401401
2) `renames` _or_ `strip_prefix` is applied.
402-
3) `prefix` is applied
403-
402+
3) `prefix` is applied
403+
404404
In particular, if a `rename` applies to an individual file, `strip_prefix`
405405
will not be applied to that particular file.
406-
406+
407407
Each non-`rename``d path will look like this:
408408

409409
```
410410
$OUTPUT_DIR/$PREFIX/$FILE_WITHOUT_STRIP_PREFIX
411411
```
412412

413413
Each `rename`d path will look like this:
414-
414+
415415
```
416416
$OUTPUT_DIR/$PREFIX/$FILE_RENAMED
417417
```
418-
418+
419419
If an operation cannot be applied (`strip_prefix`) to any component in the
420420
directory, or if one is unused (`exclude`, `rename`), the underlying command
421421
will fail. See the individual attributes for details.
422-
422+
423423

424424
**ATTRIBUTES**
425425

@@ -448,7 +448,7 @@ Package contents grouping rule.
448448
This rule represents a collection of packaging specifications (e.g. those
449449
created by `pkg_files`, `pkg_mklink`, etc.) that have something in common,
450450
such as a prefix or a human-readable category.
451-
451+
452452

453453
**ATTRIBUTES**
454454

@@ -480,7 +480,7 @@ General-purpose package target-to-destination mapping rule.
480480
Consumers of `pkg_files`s will, where possible, create the necessary
481481
directory structure for your files so you do not have to unless you have
482482
special requirements. Consult `pkg_mkdirs` for more details.
483-
483+
484484

485485
**ATTRIBUTES**
486486

@@ -520,7 +520,7 @@ Defines creation and ownership of directories in packages
520520
For some package management systems (e.g. RPM), directory ownership (2) may
521521
imply additional semantics. Consult your package manager's and target
522522
distribution's documentation for more details.
523-
523+
524524

525525
**ATTRIBUTES**
526526

@@ -547,7 +547,7 @@ Define a symlink within packages
547547
Symbolic links specified by this rule may point at files/directories outside of the
548548
package, or otherwise left dangling.
549549

550-
550+
551551

552552
**ATTRIBUTES**
553553

@@ -721,6 +721,3 @@ Legacy version
721721
| <a id="pkg_rpm-spec_file"></a>spec_file | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
722722
| <a id="pkg_rpm-version"></a>version | - | String | optional | "" |
723723
| <a id="pkg_rpm-version_file"></a>version_file | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
724-
725-
726-

docs/0.6.0/reference.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Creates an RPM format package via `pkg_filegroup` and friends.
221221

222222
Is the equivalent to `%config(missingok, noreplace)` in the `%files` list.
223223

224-
224+
225225

226226
**ATTRIBUTES**
227227

@@ -426,30 +426,30 @@ filter_directory(<a href="#filter_directory-name">name</a>, <a href="#filter_dir
426426
Transform directories (TreeArtifacts) using pkg_filegroup-like semantics.
427427

428428
Effective order of operations:
429-
429+
430430
1) Files are `exclude`d
431431
2) `renames` _or_ `strip_prefix` is applied.
432-
3) `prefix` is applied
433-
432+
3) `prefix` is applied
433+
434434
In particular, if a `rename` applies to an individual file, `strip_prefix`
435435
will not be applied to that particular file.
436-
436+
437437
Each non-`rename``d path will look like this:
438438

439439
```
440440
$OUTPUT_DIR/$PREFIX/$FILE_WITHOUT_STRIP_PREFIX
441441
```
442442

443443
Each `rename`d path will look like this:
444-
444+
445445
```
446446
$OUTPUT_DIR/$PREFIX/$FILE_RENAMED
447447
```
448-
448+
449449
If an operation cannot be applied (`strip_prefix`) to any component in the
450450
directory, or if one is unused (`exclude`, `rename`), the underlying command
451451
will fail. See the individual attributes for details.
452-
452+
453453

454454
**ATTRIBUTES**
455455

@@ -478,7 +478,7 @@ Package contents grouping rule.
478478
This rule represents a collection of packaging specifications (e.g. those
479479
created by `pkg_files`, `pkg_mklink`, etc.) that have something in common,
480480
such as a prefix or a human-readable category.
481-
481+
482482

483483
**ATTRIBUTES**
484484

@@ -512,7 +512,7 @@ General-purpose package target-to-destination mapping rule.
512512
Consumers of `pkg_files`s will, where possible, create the necessary
513513
directory structure for your files so you do not have to unless you have
514514
special requirements. Consult `pkg_mkdirs` for more details.
515-
515+
516516

517517
**ATTRIBUTES**
518518

@@ -551,7 +551,7 @@ Defines creation and ownership of directories in packages
551551
For some package management systems (e.g. RPM), directory ownership (2) may
552552
imply additional semantics. Consult your package manager's and target
553553
distribution's documentation for more details.
554-
554+
555555

556556
**ATTRIBUTES**
557557

@@ -578,7 +578,7 @@ Define a symlink within packages
578578
Symbolic links specified by this rule may point at files/directories outside of the
579579
package, or otherwise left dangling.
580580

581-
581+
582582

583583
**ATTRIBUTES**
584584

@@ -746,5 +746,3 @@ Legacy version
746746
| <a id="pkg_rpm-spec_file"></a>spec_file | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
747747
| <a id="pkg_rpm-version"></a>version | - | String | optional | "" |
748748
| <a id="pkg_rpm-version_file"></a>version_file | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
749-
750-

0 commit comments

Comments
 (0)