GitXplorerGitXplorer
g

SublimeLinter-contrib-makefile

public
2 stars
0 forks
3 issues

Commits

List of commits on branch master.
Unverified
cb00aea8284c9d80105d11904614560fd29f8533

was erroneously considered a target name.

ggiampaolo committed 10 months ago
Unverified
e7bcc128cfc630cae92033a8a809894992b7fd20

pre-release

ggiampaolo committed 10 months ago
Unverified
da8577b601a20f3440c884b091555d9c067845a9

refact for speedup

ggiampaolo committed 10 months ago
Unverified
3774923a981f3f69bd4d53d0d0baab0dec72ca9a

faster readlines() algo

ggiampaolo committed 10 months ago
Unverified
b284060829c62a432e86817c0e6ef04daccd8b47

fix #3: unnecessary empty lines at EOF

ggiampaolo committed 10 months ago
Unverified
d6cf272912161325d5977e1e929aed397a34d1e1

fix #2: recognize trailing spaces at EOL

ggiampaolo committed 10 months ago

README

The README file for this repository.

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. :)