https://github.com/lowrisc/misc-linters
Some Internal Linter Scripts
https://github.com/lowrisc/misc-linters
Last synced: 10 months ago
JSON representation
Some Internal Linter Scripts
- Host: GitHub
- URL: https://github.com/lowrisc/misc-linters
- Owner: lowRISC
- License: apache-2.0
- Created: 2019-10-10T12:21:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-02-17T17:06:32.000Z (about 1 year ago)
- Last Synced: 2025-04-02T20:38:24.307Z (11 months ago)
- Language: Python
- Size: 73.2 KB
- Stars: 1
- Watchers: 50
- Forks: 13
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# lowRISC's Miscellaneous Linters
## About the project
These are linters and checkers, usually for source code, which we have written
for various lowRISC projects.
They include
* `licence-checker/licence-checker.py` which will ensure source code in your
repository contains correctly formatted licence headers. This is designed to
be reused: it is configured with `licence-checker.hjson`.
## Using the linters
This repository provides Bazel rules for generating linting jobs. First, add
this repository to your `WORKSPACE` (with a name like `lowrisc_lint`). Then,
in `WORKSPACE` add
```bazel
load("@lowrisc_lint//rules:deps.bzl", "lowrisc_misc_linters_dependencies")
lowrisc_misc_linters_dependencies()
load("@lowrisc_lint//rules:pip.bzl", "lowrisc_misc_linters_pip_dependencies")
lowrisc_misc_linters_pip_dependencies()
load("@lowrisc_misc_linters_pip//:requirements.bzl", "install_deps")
install_deps()
```
If using `bzlmod`, instead add the following to `MODULE.bazel`:
```bazel
bazel_dep(name = "lowrisc_misc_linters")
git_override(
module_name = "lowrisc_misc_linters",
remote = "https://github.com/lowRISC/misc-linters",
commit = "",
)
```
and then in a BUILD file, like the root:
```bazel
load("@lowrisc_lint//rules:rules.bzl", "licence_check")
licence_check(
name = "licence-check",
licence = '''
Copyright lowRISC contributors.
Licensed under the Apache License, Version 2.0, see LICENSE for details.
SPDX-License-Identifier: Apache-2.0
''',
exclude_patterns = [".style.yapf"],
)
```
This will generate a rule that will check licence headers, callable as
`bazel run //:licence-check`.
## How to contribute
Have a look at [CONTRIBUTING](./CONTRIBUTING.md) for guidelines on how to
contribute code to this repository.
## Licensing
Unless otherwise noted, everything in this repository is covered by the Apache
License, Version 2.0 (see [LICENSE](./LICENSE) for full text).