Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile linter #134

Merged
merged 3 commits into from Oct 16, 2023
Merged

Conversation

giampaolo
Copy link
Contributor

@giampaolo giampaolo commented Oct 12, 2023

I recently worked on this: https://github.com/giampaolo/SublimeLinter-contrib-makefile. The motivation which led me to it is because the only Makefile linter I found is https://github.com/mrtazz/checkmake, which provides a limited set of rules:

$ go run github.com/mrtazz/checkmake/cmd/checkmake@latest --list-rules
                                                      
        NAME                   DESCRIPTION            
                                                      
  maxbodylength       Target bodies should be kept    
                      simple and short.               
  minphony            Minimum required phony targets  
                      must be present                 
  phonydeclared       Every target without a body     
                      needs to be marked PHONY        
  timestampexpanded   timestamp variables should be   
                      simply expanded   

I use Makefiles in all of my projects, not to compile stuff, but to run repetitive tasks. I wanted to be able to identify (amongst other things) undefined variable names, undefined target names, and use of spaces instead of tabs. As such I decided to write my own plugin and came up with this.

In the future I may decide to turn this into a generic CLI tool, but for now this is implemented as a plugin which can only be used with Sublime Text + SublimeLinter.

Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
@kaste
Copy link
Contributor

kaste commented Oct 12, 2023

That doesn't look like a bad idea but you should not query self.view = sublime.active_window().active_view() because the linter might run lazy. The linter instance knows about the view it's linting so return Parser(self.view).run(), t.i. injecting the view, should be more reliable.

You need to make a release or push a semver tag (like 0.0.1 or so) though before I can merge.

contrib.json Outdated Show resolved Hide resolved
@giampaolo
Copy link
Contributor Author

That doesn't look like a bad idea but you should not query self.view = sublime.active_window().active_view() because the linter might run lazy. The linter instance knows about the view it's linting so return Parser(self.view).run(), t.i. injecting the view, should be more reliable.

You need to make a release or push a semver tag (like 0.0.1 or so) though before I can merge.

Thanks for the suggestion about view. I just pushed a git tag named 0.1.0.

@kaste kaste merged commit ac0e414 into SublimeLinter:master Oct 16, 2023
1 check passed
@kaste
Copy link
Contributor

kaste commented Oct 16, 2023

Not the standard adapter, well done. Looks like you know what you're doing. 👍

@giampaolo
Copy link
Contributor Author

Thanks for your time and the merge! :)

@giampaolo giampaolo deleted the SublimeLinter-makefile branch October 17, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants