• Stars
    star
    1,036
  • Rank 44,478 (Top 0.9 %)
  • Language
    Go
  • License
    MIT License
  • Created over 8 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

experimental linter/analyzer for Makefiles

checkmake

Build Status Coverage Status Code Climate Packagecloud MIT license

Overview

checkmake is an experimental tool for linting and checking Makefiles. It may not do what you want it to.

Usage

% checkmake Makefile

% checkmake Makefile foo.mk bar.mk baz.mk

% checkmake --help
checkmake.

Usage:
checkmake [--debug|--config=<configPath>] <makefile>...
checkmake -h | --help
checkmake --version

Options:
-h --help               Show this screen.
--version               Show version.
--debug                 Enable debug mode
--config=<configPath>   Configuration file to read
--list-rules            List registered rules

% checkmake fixtures/missing_phony.make

      RULE                 DESCRIPTION             LINE NUMBER

  minphony        Missing required phony target    0
                  "all"
  minphony        Missing required phony target    0
                  "test"
  phonydeclared   Target "all" should be           18
                  declared PHONY.

Docker usage

Build the image, or pull it:

docker build --build-arg BUILDER_NAME='Your Name' --build-arg [email protected] . -t checker

Then run it with your Makefile attached, below is an example of it assuming the Makefile is in your current working directory:

docker run -v "$PWD"/Makefile:/Makefile checker

pre-commit usage

This repo includes a pre-commit hook, which you may choose to use in your own repos. Simply add a .pre-commit-config.yaml to your repo's top-level directory

repos:
-   repo: https://github.com/mrtazz/checkmake.git
    # Or another commit hash or version
    rev: 0.2.2
    hooks:
    # Use this hook to let pre-commit build checkmake in its sandbox
    -   id: checkmake
    # OR Use this hook to use a pre-installed checkmark executable
    # -   id: checkmake-system

There are two hooks available:

  • checkmake (Recommended)

    pre-commit will set up a Go environment from scratch to compile and run checkmake. See the pre-commit golang plugin docs for more information.

  • checkmake-system

    pre-commit will look for checkmake on your PATH. This hook requires you to install checkmake separately, e.g. with your package manager or a prebuilt binary release. Only recommended if it's permissible to require all repository users install checkmake manually.

Then, run pre-commit as usual as a part of git commit or explicitly, for example:

pre-commit run --all-files

pre-commit in GitHub Actions

You may also choose to run this as a GitHub Actions workflow. To do this, add a .github/workflows/pre-commit.yml workflow to your repo:

name: pre-commit

on:
  pull_request:
    branches:
      - master
      - main
    paths:
      - '.pre-commit-config.yaml'
      - '.pre-commit-hooks.yaml'
      - 'Makefile'
      - 'makefile'
      - 'GNUmakefile'
      - '**.mk'
      - '**.make'
  push:
    paths:
      - '.pre-commit-config.yaml'
      - '.pre-commit-hooks.yaml'
      - 'Makefile'
      - 'makefile'
      - 'GNUmakefile'
      - '**.mk'
      - '**.make'

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-python@v3
    - name: Set up Go 1.17
      uses: actions/setup-go@v2
      with:
        go-version: 1.17
      id: go
    - uses: pre-commit/[email protected]

Installation

Requirements

The pandoc document converter utility is required to run checkmate. You can find out if you have it via which pandoc. Install pandoc if the command was not found.

With Go

With go 1.16 or higher:

go install github.com/mrtazz/checkmake/cmd/checkmake@latest
checkmake Makefile

Or alternatively, run it directly:

go run github.com/mrtazz/checkmake/cmd/checkmake@latest Makefile

Packages

There are packages for linux up on packagecloud.io or build it yourself with the steps below.

Build

To build checkmake you will need to have golang installed. Once you have Go installed, you can simply clone the repo and build the binary and man page yourself with the following commands.

git clone https://github.com/mrtazz/checkmake
cd checkmake
make

Use in CI

MegaLinter

checkmake is natively embedded within MegaLinter

To install it, run npx mega-linter-runner --install (requires Node.js)

Inspiration

This is totally inspired by an idea by Dan Buch.

More Repositories

1

restclient-cpp

C++ client for making HTTP/REST requests
C++
1,509
star
2

plustache

{{mustaches}} for C++
C++
203
star
3

katana

ready to go heroku hosted URL shortener based on guillotine
Ruby
74
star
4

json-cpp

[DEPRECATED] use https://github.com/open-source-parsers/jsoncpp
C++
71
star
5

InstapaperLibrary

Simple python library utilizing the instapaper.com API
Python
54
star
6

notifo.py

python wrapper for notifo.com
Python
33
star
7

bin

my ~/bin folder
30
star
8

dotfiles

collection of my dotfiles
Vim Script
28
star
9

pocketcleaner

keep your pocket clean
Go
24
star
10

DoxygenToolkit.vim

Doxygen plugin for vim
Vim Script
19
star
11

statsd-amqp-backend

StatsD backend to emit stats to AMQP
JavaScript
16
star
12

cookbooks

collection of chef cookbooks, mainly for FreeBSD and OSX
HTML
13
star
13

molokai.vim

tomas restrepos molokai theme for vim put here for easy installation as a submodule via pathogen
Vim Script
13
star
14

statsd-traffic-loader

simple CLI script to send traffic to StatsD
Go
11
star
15

instapaper.py

cli client for instapaper.com - now contained in the python library
Python
11
star
16

sensu-heroku-app

example app to run sensu on heroku
Ruby
10
star
17

knife-wip

A workflow plugin to track WIP nodes on a chef server
Ruby
10
star
18

gtd-couch

gtd task management with a couchapp
JavaScript
10
star
19

vimfiles

moved into https://github.com/mrtazz/dotfiles
Vim Script
9
star
20

GithubFeedFilter

[not maintained] Sinatra + Redis app to show a filtered github feed
Ruby
9
star
21

yagd

super simple dashboard framework in PHP
PHP
9
star
22

vim-stencil

simple template loading plugin for VIM
Vim Script
8
star
23

fitbit-to-graphite

record fitbit sleep data into graphite
Ruby
8
star
24

knife-node-attribute

knife plugin to show and delete node attributes
Ruby
8
star
25

snyder

metrics library for C++11
C++
8
star
26

muttfiles

moved into https://github.com/mrtazz/dotfiles
7
star
27

certcal

provide an iCal web feed for certificate expiration
Go
7
star
28

thingnatra

Sinatra frontend for Things.app data
Ruby
7
star
29

weechat-config

config files for weechat
Python
6
star
30

couchapp-cucumber

Cucumber drop-in for testing couchapps
Ruby
6
star
31

homebrew-misc

additional formula for https://github.com/mxcl/homebrew
Ruby
6
star
32

instareader.py

Add starred items from google reader to instapaper
Python
6
star
33

vim-plan

experiments in a vim plugin for personal planning
Vim Script
5
star
34

ramrod

Command center for multiple CI instances/agents
JavaScript
5
star
35

kangaroo

location aware task planer for mobile devices
Java
5
star
36

minibashtest

simplest unit testing framework for bash
Shell
5
star
37

irssi-zeromq

Irssi script to distribute events via ZeroMQ pub/sub
Perl
5
star
38

github-unreleased

find commits in a GitHub repository that got added after the most recent release/tag
Go
5
star
39

recipes

Collection of recipes, for actual cooking and stuff
4
star
40

relaxtrack

time tracking couchapp
JavaScript
4
star
41

chef-groveio-handler

Chef report handler to push a notice into a grove.io channel
Ruby
4
star
42

admiral

Inverted Index implementation with web server and frontend in python
Python
4
star
43

chinstrap

[WIP] Pure C mustache parser
C
4
star
44

mrtazz.github.com

homepage
CSS
3
star
45

zerigo_dyndns.sh

dyndns update shell script with zerigo and http://icanhazip.com
Shell
3
star
46

gifs

my collection of gifs
HTML
3
star
47

zshfiles

moved into https://github.com/mrtazz/dotfiles
Shell
3
star
48

notify-by-pushover

Nagios pushover notification script written in Go
Go
3
star
49

leoric-skeletons

my skeleton setup to use with http://code.mrtazz.com/leoric/
PHP
3
star
50

towbar

Python API wrapper for boxcar.io
Python
3
star
51

osxzip-cookbook

Chef LWRP for installing zipped OSX apps
Ruby
3
star
52

introduction-to-algorithms

Algorithm implementations from the book
Python
3
star
53

coppergenie

webhook bridge between copperegg alerts and opsgenie notifications
Ruby
2
star
54

go-statsd-proxy

consistent hashing based proxy for multiple statsd backends
Go
2
star
55

BackoffTimer

a simple backoff timer written in rust
Rust
2
star
56

octonode

[Nothing to see because I never found the time to actually work on this] node.js wrapper for the github v3 API
2
star
57

kong-ini

ini file configuration resolver for alecthomas/kong
Go
2
star
58

php-dyndns

php dyndns system
PHP
2
star
59

unwiredcouch.com

the website
CSS
2
star
60

foodlist

makes importable shopping lists from yaml input
Python
2
star
61

troubagix

troubagix sings into your IRC channel when something happens in your github repositories
2
star
62

twsh

A twitter client, which feels a bit like a shell, using the library from http://code.google.com/p/python-twitter/
Python
2
star
63

groupmecat

bot for groupme
JavaScript
2
star
64

http-test-server

simple HTTP test server for testing client side http calls
Ruby
2
star
65

twanity

see all those important twitter stats about yourself
Go
1
star
66

whoownsmyworklifebalance.com

what it says on the tin
HTML
1
star
67

thunkapi.py

Python API wrapper for thunk.us
Python
1
star
68

pkgr

tool to create pkgng packages from a directory
Go
1
star
69

gistapi.erl

erlang wrapper for the gist.github.com API
Erlang
1
star
70

notify-by-opsgenie

simple program to notify opsgenie from nagios
Go
1
star
71

irc-notifier

notifier for my IRC setup
Go
1
star
72

ketchupstatus

Status of ketchup supply with sinatra and mustache
Ruby
1
star
73

stz-hubot

hubot for the stz offtopic channel
CoffeeScript
1
star
74

php-nagioseasier

PHP wrapper around the nagioseasier query handler
PHP
1
star
75

artefacts

place to build some public containers
Dockerfile
1
star
76

jekyll-layouts

collection of layouts I use for jekyll generated pages
HTML
1
star
77

chef-deploy

tool to deploy changes to a Chef server based on a git diff
Go
1
star
78

disrupt

send notifications via multiple providers
Go
1
star
79

plan

cli tool for some planning tasks
Go
1
star
80

mime-extractor

extract mime bodies from email
Go
1
star
81

emo.theme

an irssi theme based on gothic
PHP
1
star
82

kerl-cookbook

chef cookbook for kerl
Ruby
1
star
83

leoric

Project initialization from skeleton files
Shell
1
star
84

cocoa-currency-converter

Xcode tutorial
Objective-C
1
star
85

latex-letter-example

a set of templates and tools to easily write letters in LaTeX
TeX
1
star