ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sublime​Linter-contrib-makefile

by giampaolo ST3

SublimeLinter plugin for Makefiles

Labels linting, makefile, make

Details

  • 0.1.2
  • github.​com
  • github.​com
  • 8 months ago
  • 14 minutes ago
  • 9 months ago

Installs

  • Total 144
  • Win 71
  • Mac 34
  • Linux 39
Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11
Windows 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 1 0 0 2 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2 1 0 0 0 0 1 0

Readme

Source
raw.​githubusercontent.​com

tests

About

A plugin for SublimeLinter which provides linting for Makefiles.

Installation

Use Package Control: search for a package named SublimeLinter-contrib-makefile and install it. SublimeLinter must also be installed.

Checkers

This plugin is able to detect the following mistakes. They will be visually signaled in the status bar and the left gutter.

Undefined global variable names

Correct:

FOO = 1

test:
    echo $(FOO)

Incorrect:

test:
    echo $(FOO)

Undefined target names

Correct:

clean:
    rm -rf build/*

test:
    ${MAKE} clean
    pytest .

Incorrect:

test:
    ${MAKE} clean
    pytest .

Duplicated targets

When there's 2 targets with the same name, e.g.:

test:
    pytest .

test:
    pytest .

Use of spaces instead of tabs

Any line starting with a space instead of tab is considered an error, e.g.

test1:
    pytest .  # use tab

test2:
  pytest .  # use spaces

Missing .PHONY directive

This will print missing .PHONY declaration if there's a file or directory named “test” in the same directory as the Makefile:

test:
    pytest .

Trailing spaces

Any trailing space at the end of the line, e.g.:

test:
    pytest .<SPACE><SPACE><SPACE>

Unnecessary empty lines at EOF

E.g.:

test:
    pytest .

Motivations

Why not use an existing CLI tool?

As stated in https://github.com/SublimeLinter/package_control_channel/pull/134, the motivation which led me to write this plugin is because the only Makefile linter I found is https://github.com/mrtazz/checkmake, which provides a quite limited set of rules. I wanted a linter which was able to identify at least undefined variable names, undefined target names, and the use of spaces instead of tabs. I found none so I wrote my own.

Why not turn this into a generic CLI tool?

Indeed that probably makes a lot more sense. I may (or may not) do this later. :)