Merge pull request #188 from rpdelaney/pre-commit

Add pre-commit hooks & lint checking to build process
This commit is contained in:
Ryan Delaney 2022-03-09 11:41:06 -05:00 committed by GitHub
commit 6818ea7b89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 87 additions and 22 deletions

View file

@ -1,4 +1,6 @@
---
name: 'Release'
on:
push:
branches: [master]
@ -8,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Check out Git repository'
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: 'Generate shell files'
run: make generate

26
.github/workflows/pre_commit.yaml vendored Normal file
View file

@ -0,0 +1,26 @@
---
name: pre-commit
on:
pull_request:
push:
branches: [main]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install pre-commit
run: pip install pre-commit
- name: cache
uses: actions/cache@v2
with:
key: pre-commit-dot-cache-{{ checksum ".pre-commit-config.yaml" }}
path: ~/.cache/pre-commit
- name: Pre-commit checks
run: pre-commit run --all-files --show-diff-on-failure

24
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,24 @@
---
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.13
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat-toc
# EOF

View file

@ -7,5 +7,5 @@ The following is a set of guidelines for contributing to LS_COLORS
## Pull Request Process
1. Add the new file extension and its color to [`LS_COLORS`](./LS_COLORS). Try to find the most appropriate category for the file type and match the style to the others in the same category.
2. Run tests
3. Create a new pull request
1. Run tests
1. Create a new pull request

View file

@ -1,12 +1,19 @@
### Table of contents
* [LS_COLORS](#ls_colors)
* [What does it look like?](#what-does-it-look-like)
* [Dependencies](#dependencies)
* [Installation](#installation)
* [Information for Developers](#information-for-developers)
* [Legal](#legal)
# LS_COLORS
![Build](https://github.com/trapd00r/LS_COLORS/actions/workflows/build.yaml/badge.svg)
<!-- mdformat-toc start --slug=github --no-anchors --maxlevel=3 --minlevel=1 -->
- [LS_COLORS](#ls_colors)
- [What does it look like?](#what-does-it-look-like)
- [Dependencies](#dependencies)
- [Installation](#installation)
- [Arch Linux](#arch-linux)
- [Information for Developers](#information-for-developers)
- [Legal](#legal)
<!-- mdformat-toc end -->
This is a collection of extension:color mappings, suitable to use as your
`LS_COLORS` environment variable. Most of them use the extended color map,
described in the ECMA-48 document; in other words, you'll need a terminal
@ -25,33 +32,31 @@ For files that usually ends up next to each other, like html, css and js,
try to pick colors that fits in nicely together. Filetypes with multiple
possible extensions, like htm and html, should have the same color.
# What does it look like?
## What does it look like?
Here's a screenshot _(font and minor color shades, of course, depend on terminal and its configuration)_:
![Screenshot1](docs/static/LS_COLORS.png)
[0]: https://github.com/trapd00r/zsh-syntax-highlighting-filetypes
[1]: https://github.com/trapd00r/File-LsColor
[2]: https://github.com/trapd00r/File-LsColor/tree/master/bin
[3]: https://aur.archlinux.org/packages/lscolors-git
# Dependencies
## Dependencies
You need GNU `dircolors` and a compatible directory listing tool, such as GNU
`ls`. Both are available in GNU coreutils.
# Installation
## Installation
The repo contains two compiled scripts `lscolors.sh` & `lscolors.csh`, which you can download & source directly or point your plugin manager to pick up one of them.
To enable the colors, add the following line to your shell's start-up script:
For Bourne shell (e.g. `~/.bashrc` or `~/.zshrc`):
```
source ~/path/to/lscolors.sh
```
For C shell (e.g. `~/.cshrc`):
```
source ~/path/to/lscolors.csh
```
@ -71,15 +76,18 @@ For C shell (e.g. ~/.cshrc):
$
```
## Arch Linux
### Arch Linux
Arch Linux users can install the [`lscolors-git`][3] package from the AUR for easy
integration with bash, csh, or zsh.
# Information for Developers
## Information for Developers
There's a [library][1] I've written that lets you use various LS COLORS on
arbitrary files and directories. A simple implementation can be found [here][2].
Using this, you can do
```shell
find $HOME -maxdepth 1 | ls_color
@ -88,7 +96,8 @@ mpc search artist Laleh | ls_color
... and so on.
# Legal
## Legal
© Copyright 2014-2022 Magnus Woldrich.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
@ -101,3 +110,7 @@ either version 1.0 of the License, or (at your option) any later version.
You should have received a copy of the Perl Artistic License along
with this program. If not, see <http://www.perlfoundation.org/artistic_license_1_0>.
[1]: https://github.com/trapd00r/File-LsColor
[2]: https://github.com/trapd00r/File-LsColor/tree/master/bin
[3]: https://aur.archlinux.org/packages/lscolors-git