-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Pennebaker
committed
Apr 8, 2023
0 parents
commit 2bf62e2
Showing
208 changed files
with
28,139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.crit | ||
# Created by https://www.toptal.com/developers/gitignore/api/rust | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=rust | ||
|
||
### Rust ### | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/rust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rust 1.68.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[package] | ||
name = "unmake" | ||
description = "a makefile linter" | ||
version = "0.0.1" | ||
authors = ["Andrew Pennebaker <andrew.pennebaker@gmail.com>"] | ||
license = "BSD-2-Clause" | ||
homepage = "https://github.com/mcandre/unmake" | ||
|
||
[dependencies] | ||
die = "0.2.0" | ||
getopts = "0.2.21" | ||
lazy_static = "1.4.0" | ||
peg = "0.8.1" | ||
tinyrick = { version = "^0.0.9", optional = true } | ||
tinyrick_extras = { version = "^0.0.6", optional = true } | ||
|
||
[features] | ||
letmeout = ["tinyrick", "tinyrick_extras"] | ||
|
||
[lib] | ||
name = "unmake" | ||
|
||
[[bin]] | ||
name = "unmake" | ||
path = "src/unmake.rs" | ||
|
||
[[bin]] | ||
name = "tinyrick" | ||
path = "tinyrick.rs" | ||
required-features = ["letmeout"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[target.aarch64-apple-darwin] | ||
image = "freeznet/aarch64-apple-darwin-cross:11.3" | ||
|
||
[target.x86_64-apple-darwin] | ||
image = "freeznet/x86_64-apple-darwin-cross:11.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# BUILDTIME REQUIREMENTS | ||
|
||
* [rustup](https://rustup.rs/) 1.25.2+ | ||
* [Rust](https://www.rust-lang.org/en-US/) 1.68.2+ with `rustup component add clippy rustfmt` and `cargo install cargo-audit@0.17.5 crit@0.0.6 tinyrick@0.0.9` | ||
* [Docker](https://www.docker.com/) 20.10.12+ | ||
* [zip](https://en.wikipedia.org/wiki/ZIP_(file_format)) | ||
|
||
## Recommended | ||
|
||
* [ASDF](https://asdf-vm.com/) 0.10 (run `asdf reshim` after each Rust application binary installation) | ||
* [direnv](https://direnv.net/) 2 | ||
* [cargo-cache](https://crates.io/crates/cargo-cache) | ||
* a POSIX compliant [make](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html) implementation | ||
* [tree](https://en.wikipedia.org/wiki/Tree_(command)) | ||
* GNU compatible [time](https://www.gnu.org/software/time/) | ||
|
||
# INSTALL BINARIES FROM SOURCE | ||
|
||
```console | ||
$ tinyrick install | ||
``` | ||
|
||
# UNINSTALL BINARIES | ||
|
||
```console | ||
$ tinyrick uninstall | ||
``` | ||
|
||
# SECURITY AUDIT | ||
|
||
```console | ||
$ tinyrick audit | ||
``` | ||
|
||
# LINT | ||
|
||
```console | ||
$ tinyrick lint | ||
``` | ||
|
||
# TEST | ||
|
||
```console | ||
$ tinyrick test | ||
``` | ||
|
||
# PORT | ||
|
||
```console | ||
$ tinyrick port | ||
``` | ||
|
||
# PUBLISH | ||
|
||
```console | ||
$ tinyrick publish | ||
``` | ||
|
||
# CLEAN | ||
|
||
```console | ||
$ tinyrick clean | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Copyright (c) 2023, Andrew Pennebaker | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright, this | ||
list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OR MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
The views and conclusions contained in the software and documentation are those | ||
of the authors and should not be interpreted as representing official policies, | ||
either expressed or implied, of the FreeBSD project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# unmake: a makefile linter | ||
|
||
```text | ||
_ | ||
_ _ ___ _____ ___| |_ ___ | ||
| | | | | .'| '_| -_| | ||
|___|_|_|_|_|_|__,|_,_|___| | ||
``` | ||
|
||
# EXAMPLES | ||
|
||
```console | ||
$ cd examples | ||
|
||
$ unmake -n Makefile; echo "$?" | ||
0 | ||
|
||
$ unmake -n bsd/makefile; echo "$?" | ||
error at 1:16: expected one of " ", "$(", "${", ":", "\t", [^ (' ' | '\t' | ':' | ';' | '#' | '\r' | '\n')] | ||
1 | ||
``` | ||
|
||
See `unmake -h` for more options. | ||
|
||
# INSTALL FROM SOURCE | ||
|
||
```console | ||
$ cargo install --force --path . | ||
``` | ||
|
||
# MOTIVATION | ||
|
||
The `unmake` linter serves several purposes. | ||
|
||
`unmake` provides a strict replacement for `make -n`, in case the local make implementation has BSD, GNU, etc. extensions. To encourage people to validate makefiles for syntactic wholeness as part of their projects' linter suites, before any tasks are actually run. | ||
|
||
`unmake` encourage long or subtle shell snippets to be moved to dedicated shell script files, where they are more amenable to scanning with shell script linters. Most linters for common shell snippet wrapping languages (e.g., Ansible, Dockerfile, makefile, Vagrantfile, various CI/CD pipelines) perform very limited scanning for potential flaws in the embedded snippets, compared with linters that specifically scan shell script files. | ||
|
||
`unmake` discourages vendor locking in makefile scripts. Numerous makefiles online assume a highly specific development environment. For example, assuming that (GNU) findutils, (GNU) sed, (GNU) awk, (non-PowerShell) curl are installed, with a GNU bash or zsh user interpreter, on a GNU/Linux operating system. So the typical makefile is likely to fail for (non-WSL) Windows users, or macOS users, or FreeBSD users, and so on. Ideally, our makefiles strive for portability, so that our projects can be enjoyed on a wider variety of computers. | ||
|
||
`make` is a natural candidate for working around limitations in provisioning scripts. For example, `go mod` / `cargo` do not track linters or other dev dependencies, and `sh` defaults to ignoring errors during provisioning. `make`'s default semantics prepare it well for provisioning and other activities. `make` can do many things! `unmake` helps it do them better. | ||
|
||
# RUNTIME REQUIREMENTS | ||
|
||
(None) | ||
|
||
# CONTRIBUTING | ||
|
||
For more details on developing crit itself, see [DEVELOPMENT.md](DEVELOPMENT.md). | ||
|
||
# LICENSE | ||
|
||
FreeBSD | ||
|
||
# SEE ALSO | ||
|
||
* [BSD make](https://man.freebsd.org/cgi/man.cgi?make(1)), a popular make implementation with BSD extensions | ||
* [checkmake](https://github.com/mrtazz/checkmake), an experimental makefile linter | ||
* [cmake](https://cmake.org/), a build system for C/C++ projects | ||
* [dale](https://github.com/mcandre/dale), a task runner for D projects | ||
* [GNU autotools](https://www.gnu.org/software/automake/manual/html_node/Autotools-Introduction.html), a build system for Linux C/C++ projects | ||
* [GNU make](https://www.gnu.org/software/make/), a popular make implementation with GNU extensions | ||
* [Gradle](https://gradle.org/), a build system for JVM projects | ||
* [invoke](https://pypi.org/project/invoke/), a task runner for Python projects | ||
* [lake](https://luarocks.org/modules/steved/lake), a task runner for Lua projects | ||
* [Mage](https://magefile.org/), a task runner for Go projects | ||
* [npm](https://www.npmjs.com/), [Grunt](https://gruntjs.com/), Node.js task runners | ||
* the [POSIX make](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html) standard | ||
* [Rake](https://ruby.github.io/rake/), a task runner for Ruby projects | ||
* [rez](https://github.com/mcandre/rez), a task runner for C/C++ projects | ||
* [Shake](https://shakebuild.com/), a task runner for Haskell projects | ||
* [tinyrick](https://github.com/mcandre/tinyrick), a task runner for Rust projects | ||
* [vast](https://github.com/mcandre/vast), a task runner for sh projects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SYSTEM=$(shell uname -a) | ||
|
||
all: | ||
@echo $(SYSTEM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
test: test-hi test-howdy | ||
|
||
test-hi: | ||
@echo hi | ||
|
||
test-howdy: | ||
@echo howdy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.for i in 1 2 3 | ||
test-double-${i}: | ||
@echo "2 * ${i}" | bc | ||
.endfor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
message("Hello World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
APPLE=granny | ||
BANANA=cavendish | ||
CHERRY=rum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include fruit.mk | ||
|
||
all: | ||
@echo "Apples for sale! Today, we have $(APPLE)!" | ||
@echo "Bananas for sale! Today, we have $(BANANA)!" | ||
@echo "Cherries for sale! Today, we have $(CHERRY)!" |
Oops, something went wrong.