All Projects → riscy → command_line_lint

riscy / command_line_lint

Licence: MIT license
This script generates a report against your command-line history and suggests workflow improvements.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to command line lint

therapist
Work out your commitment issues.
Stars: ✭ 29 (-30.95%)
Mutual labels:  linter
Golite
Add essential language support for the Go language to Sublime Text 3.
Stars: ✭ 14 (-66.67%)
Mutual labels:  linter
eslintcc
Complexity of Code - JavaScript/TypeScript
Stars: ✭ 15 (-64.29%)
Mutual labels:  linter
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Stars: ✭ 3,019 (+7088.1%)
Mutual labels:  linter
eslint-plugin-roku
ESLint plugin to parse and lint BrightScript files
Stars: ✭ 44 (+4.76%)
Mutual labels:  linter
asterisklint
Asterisk PBX configuration syntax checker
Stars: ✭ 45 (+7.14%)
Mutual labels:  linter
nestif
Detect deeply nested if statements in Go source code
Stars: ✭ 30 (-28.57%)
Mutual labels:  linter
linter-alex
📝Sensitive, considerate writing before you merge your Pull Requests
Stars: ✭ 67 (+59.52%)
Mutual labels:  linter
mllint
`mllint` is a command-line utility to evaluate the technical quality of Python Machine Learning (ML) projects by means of static analysis of the project's repository.
Stars: ✭ 67 (+59.52%)
Mutual labels:  linter
riskybird
Regular expression authors best friend
Stars: ✭ 48 (+14.29%)
Mutual labels:  linter
elodin-old
Quality and Optimisation tools for CSS in JavaScript
Stars: ✭ 15 (-64.29%)
Mutual labels:  linter
linter-glsl
Atom package that lints GLSL shaders on the fly.
Stars: ✭ 15 (-64.29%)
Mutual labels:  linter
rubocop-graphql
Rubocop extension for enforcing graphql-ruby best practices
Stars: ✭ 143 (+240.48%)
Mutual labels:  linter
ts-standard
Typescript style guide, linter, and formatter using StandardJS
Stars: ✭ 338 (+704.76%)
Mutual labels:  linter
li18nt
🌎 Lint your i18n translation files. Detect conflicting properties, duplicates and make it more readable and easier to maintain by formatting it!
Stars: ✭ 29 (-30.95%)
Mutual labels:  linter
textlint-rule-stop-words
Textlint rule to find filler words, buzzwords and clichés
Stars: ✭ 21 (-50%)
Mutual labels:  linter
reuse-action
A Github action to check repositories for REUSE compliance
Stars: ✭ 31 (-26.19%)
Mutual labels:  linter
linter-elixirc
Atom Linter plugin for ElixirC
Stars: ✭ 14 (-66.67%)
Mutual labels:  linter
eslint-config
🚀 Jetrockets Standarts | ESLint
Stars: ✭ 20 (-52.38%)
Mutual labels:  linter
standard-www
👆 Website for JavaScript Standard Style (@standard)
Stars: ✭ 28 (-33.33%)
Mutual labels:  linter

Command-Line Lint

https://github.com/riscy/command_line_lint/workflows/test/badge.svg

img/report_card.png

Description

This script generates a report against your command-line history and suggests workflow improvements. Its opinion is that most commands should be simple and require minimal typing. The report contains:

  • comprehensive lists of commands you use, with and without arguments
  • suggestions for ways to shorten commands (aliases, alternative syntax)
  • a subset of lints from Shellcheck, if installed; many of these can warn against dangerous habits

The script does not use the network, and it doesn’t move or store your command history anywhere. It should be fairly portable, running on Python 2.7 or 3.4+ and requiring “only” the standard library.

This is an early prototype and primarily supports bash, sh, and zsh.

img/screenshot.png

Run

Download command_line_lint.py and run it:

python command_line_lint.py <history_file>  # python 2 or 3 is fine

The <history_file> argument is optional. If omitted, a determination is made based on the value of the SHELL environment variable:

  • bash uses .bash_history
  • csh and tcsh use .history
  • zsh uses the value of HISTFILE

Not all shells have support for saving a history file (fish, dash, etc.)

Configure

Command-Line Lint gives better results when the following hold (it will tell you about these, too):

  • The HISTSIZE environment variable should be large enough to produce useful usage summaries. The defaults tend to be too small – try 5000.
  • Retaining duplicate entries is important for being able to determine what you do the most, so variables/options like bash’s HISTCONTROL or zsh’s histignorealldups should be set appropriately.
  • If you use bash, shopt histappend should be set so that multiple concurrent shell sessions can all add to your .bash_history. If you use zsh, setopt appendhistory should be set likewise.

If you’re linting a history file that comes from a different shell than the one you’re using, you can let the script know. For example, .history comes from a zsh session but you’re using bash, you can write:

SHELL=zsh python command_line_lint.py /path/to/.zsh_history

This script supports the use of NO_COLOR to disable color output:

NO_COLOR=1 python command_line_lint.py

Future

Because those who do not learn from history are doomed to !!, additional reporting around some of the following would be useful:

  • Command fingerprinting to sort out common typos (shopt dirspell, if it exists, can be used to fix typos in cd)
  • Security checks in addition to readability of history file (for example warnings about plaintext passwords, etc.)
  • Analyzing sequences of commands for improvements (e.g., sometimes dry-running a command like rm -rf ./* with ls ./* is a good idea; switching back and forth between directories can use cd - and switching back and forth between git branches can use git checkout -; etc.)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].