Code Monkey home page Code Monkey logo

flycheck-checkbashisms's Introduction

Flycheck linter for sh using checkbashisms

Build status MELPA MELPA Stable

Installation

checkbashisms is part of Debian devscript.

  • On Debian based systems:
sudo apt-get install devscripts
  • On Redhat/Centos:
sudo yum install rpmdevtools
  • On FreeBSD:
sudo pkg install checkbashisms

or you can download manually and add checkbashisms to your PATH.

Install flycheck-checkbashisms

Manual installation

Copy flycheck-checkbashisms file to load-path, then add these lines to init.el:

(require 'flycheck-checkbashisms)
(eval-after-load 'flycheck '(add-hook 'flycheck-mode-hook #'flycheck-checkbashisms-setup))

Melpa

This package is also available in:

If you use use-package:

(use-package flycheck-checkbashisms
  :ensure t
  :config
  (flycheck-checkbashisms-setup))

Customize variables

;; Check 'echo -n' usage
(setq flycheck-checkbashisms-newline t)

;; Check non-POSIX issues but required to be supported  by Debian Policy 10.4
;; Setting this variable to non nil made flycheck-checkbashisms-newline effects
;; regardless of its value
(setq flycheck-checkbashisms-posix t)

flycheck-checkbashisms's People

Contributors

cuonglm avatar purcell avatar snogge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flycheck-checkbashisms's Issues

suspicious state from checker when shebang uses 'env'

When I have a shell script that starts with:

!/usr/bin/env sh

the flycheck checker returns:
"Suspicious state from syntax checker sh-checkbashisms: Checker sh-checkbashisms returned non-zero exit code 2, but no errors from output: script (stdin) does not appear to be a /bin/sh script; skipping.

Checker definition probably flawed."

Relation to other shell script checkers

Before we can add this repo to our list of extensions I would like to see the relation between this syntax checker and the built-in shell script checkers clarified.

Currently I see a couple of issues:

  • flycheck-checkbashisms-setup adds the new syntax checker to the front of flycheck-checkers, overriding all built-in syntax checkers.
  • sh-checkbashisms does not have any :next-checkers at all. Combined with the above this essentially means that it disables all built-in checkers for shells other than bash.
  • sh-checkbashisms runs for Zsh scripts, where it's probably not desired.

In my opinion that's a no-go, and it means that we cannot recommend this extension to our users with good conscience. Before we add this repo to our list of extensions, I'd like to see a couple of fixes applied. Specifically:

  • sh-checkbashisms should only run for sh scripts.
  • It should be added at the end of flycheck-checkers, to run after the built-in syntax checkers.
  • It should register itself to run after the built-in sh syntax checkers with flycheck-add-next-checker.

In the end a sh buffer should be checked with sh-posix-dash or sh-bash-posix, then sh-shellcheck and ultimately sh-checkbashisms. sh-checkbashishms should not run for bash or zsh scripts, or any other non-sh shell script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.