Skip to content

Commit 9d32d44

Browse files
jbamptonmatz
authored andcommitted
feat(CI): add the GitHub Super Linter
The GitHub Super Linter is a more robust and better supported tool than the current GitHub Actions we are using. Running these checks: ERROR_ON_MISSING_EXEC_BIT: true VALIDATE_BASH: true VALIDATE_BASH_EXEC: true VALIDATE_EDITORCONFIG: true VALIDATE_MARKDOWN: true VALIDATE_SHELL_SHFMT: true VALIDATE_YAML: true https://github.com/marketplace/actions/super-linter https://github.com/github/super-linter Added the GitHub Super Linter badge to the README. Also updated the pre-commit framework and added more documentation on pre-commit. Added one more pre-commit check: check-executables-have-shebangs Added one extra check for merge conflicts to our GitHub Actions. EditorConfig and Markdown linting. Minor grammar and spelling fixes. Update linter.yml
1 parent ac90381 commit 9d32d44

49 files changed

Lines changed: 299 additions & 259 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/linters/.ecrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"verbose": false,
3+
"ignore_defaults": false,
4+
"exclude": ["oss-fuzz/", "src/"],
5+
"disable": {
6+
"end_of_line": false,
7+
"trim_trailing_whitespace": false,
8+
"insert_final_newline": false,
9+
"indent_size": true,
10+
"indent_style": true
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
MD001: false
22
MD003: false
3-
MD004: false
43
MD005: false
54
MD007: false
65
MD010: false
7-
MD011: false
86
MD013: false
97
MD014: false
108
MD024: false
119
MD025: false
1210
MD026: false
13-
MD034: false
1411
MD040: false
15-
MD041: false
1612
MD046: false

.github/workflows/lint.yml

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,32 @@
1-
name: ❄️ Lint
1+
name: Lint
22

33
on: [pull_request]
44

55
jobs:
6-
markdownlint:
7-
name: 🍸 Markdown
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v2
11-
- name: 🚀 Use Node.js
12-
uses: actions/setup-node@v2.1.5
13-
with:
14-
node-version: '14'
15-
- run: npm install -g markdownlint-cli@0.27.1
16-
- run: markdownlint '**/*.md'
176
misspell:
18-
name: 🥛 Check Spelling
7+
name: Check Spelling
198
runs-on: ubuntu-latest
209
steps:
21-
- name: 🍒 Check Out
10+
- name: Check Out
2211
uses: actions/checkout@v2
23-
- name: 🍅 Install
12+
- name: Install
2413
run: |
2514
wget -O - -q https://git.io/misspell | sh -s -- -b .
26-
- name: 🌶️ Misspell
15+
- name: Misspell
2716
run: |
2817
git ls-files --empty-directory | xargs ./misspell -error
29-
trailing-whitespace:
30-
name: 🧋 Trailing whitespace
18+
merge-conflict:
19+
name: Merge Conflict
3120
runs-on: ubuntu-latest
3221
steps:
3322
- uses: actions/checkout@v2
34-
- name: 🧹 Check for trailing whitespace
35-
run: "! git grep -EIn $'[ \t]+$'"
36-
yamllint:
37-
name: 🍶 YAML
23+
- name: Check merge conflict
24+
run: |
25+
grep "^<<<<<<< HEAD" $(git ls-files | xargs) && exit 1 || true
26+
trailing-whitespace:
27+
name: Trailing whitespace
3828
runs-on: ubuntu-latest
3929
steps:
4030
- uses: actions/checkout@v2
41-
- uses: actions/setup-python@v2
42-
with:
43-
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
44-
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
45-
- name: Install dependencies
46-
run: |
47-
python -m pip install --upgrade pip
48-
pip install yamllint
49-
- name: 🧹 YAML Lint
50-
run: |
51-
# return non-zero exit code on warnings
52-
yamllint --strict .
31+
- name: Check for trailing whitespace
32+
run: "! git grep -EIn $'[ \t]+$'"

.github/workflows/linter.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint Code Base
2+
3+
on:
4+
push:
5+
branches-ignore: [master]
6+
# Remove the line above to run when pushing to master
7+
pull_request:
8+
branches: [master]
9+
10+
jobs:
11+
build:
12+
name: Lint Code Base
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: github/super-linter@v3
17+
env:
18+
ERROR_ON_MISSING_EXEC_BIT: true
19+
VALIDATE_BASH: true
20+
# VALIDATE_BASH_EXEC: true
21+
# VALIDATE_EDITORCONFIG: true
22+
VALIDATE_MARKDOWN: true
23+
# VALIDATE_SHELL_SHFMT: true
24+
VALIDATE_YAML: true
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.pre-commit-config.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ repos:
1414
hooks:
1515
- id: check-added-large-files
1616
- id: check-case-conflict
17+
- id: check-executables-have-shebangs
18+
exclude: ^test/t/lang\.rb$
1719
- id: check-merge-conflict
1820
- id: check-yaml
1921
- id: end-of-file-fixer
@@ -26,14 +28,15 @@ repos:
2628
# - id: forbid-tabs
2729
# - id: remove-tabs
2830
- repo: https://github.com/igorshubovych/markdownlint-cli
29-
rev: v0.26.0
31+
rev: v0.27.1
3032
hooks:
3133
- id: markdownlint
3234
name: Run markdownlint
35+
entry: markdownlint -c .github/linters/.markdown-lint.yml .
3336
- repo: https://github.com/adrienverge/yamllint
34-
rev: v1.26.0
37+
rev: v1.26.1
3538
hooks:
3639
- id: yamllint
3740
name: Check YAML files with yamllint
38-
entry: yamllint --strict .
41+
entry: yamllint --strict -c .github/linters/.yaml-lint.yml .
3942
types: [yaml]

CONTRIBUTING.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,21 @@ things in mind before submitting your pull request:
2222

2323
A framework for managing and maintaining multi-language pre-commit hooks.
2424
Pre-commit can be [installed](https://pre-commit.com/#installation) with `pip`, `curl`, `brew` or `conda`.
25+
2526
You need to first install pre-commit and then install the pre-commit hooks with `pre-commit install`.
2627
Now pre-commit will run automatically on git commit!
28+
2729
It's usually a good idea to run the hooks against all the files when adding new hooks (usually pre-commit will only run on the changed files during git hooks).
2830
Use `pre-commit run --all-files` to check all files.
2931

32+
To run a single hook use `pre-commit run --all-files <hook_id>`
33+
34+
To update use `pre-commit autoupdate`
35+
36+
* [Quick start](https://pre-commit.com/#quick-start)
37+
* [Usage](https://pre-commit.com/#usage)
38+
* [pre-commit-autoupdate](https://pre-commit.com/#pre-commit-autoupdate)
39+
3040
## Coding conventions
3141

3242
How to style your C and Ruby code which you want to submit.
@@ -41,7 +51,7 @@ C code:
4151

4252
mruby should be highly portable to other systems and compilers. For this it is
4353
recommended to keep your code as close as possible to the C99 standard
44-
(http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf).
54+
(<http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf>).
4555

4656
Visual C++ is also an important target for mruby (supported version is 2013 or
4757
later). For this reason features that are not supported by Visual C++ may not
@@ -73,5 +83,5 @@ language itself. Please note the following hints for your Ruby code:
7383
#### Comply with the Ruby standard (ISO/IEC 30170:2012)
7484

7585
mruby is currently targeting to execute Ruby code which complies to ISO/IEC
76-
30170:2012 (https://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579),
86+
30170:2012 (<https://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579>),
7787
unless there's a clear reason, e.g. the latest Ruby has changed behavior from ISO.

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# mruby
2+
13
[![Build Status][build-status-img]][travis-ci]
4+
[![GitHub Super-Linter](https://github.com/mruby/mruby/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter)
25

36
## What is mruby
47

@@ -24,13 +27,15 @@ The latest development version of mruby can be downloaded via the following URL:
2427
The trunk of the mruby source tree can be checked out with the
2528
following command:
2629

27-
$ git clone https://github.com/mruby/mruby.git
30+
```
31+
$ git clone https://github.com/mruby/mruby.git
32+
```
2833

2934
You can also install and compile mruby using [ruby-install](https://github.com/postmodern/ruby-install), [ruby-build](https://github.com/rbenv/ruby-build) or [rvm](https://github.com/rvm/rvm).
3035

3136
## mruby home-page
3237

33-
The URL of the mruby home-page is: https://mruby.org.
38+
The URL of the mruby home-page is: <https://mruby.org>.
3439

3540
## Mailing list
3641

@@ -46,12 +51,16 @@ There are two sets of documentation in mruby: the mruby API (generated by yard)
4651

4752
To build both of them, simply go
4853

49-
rake doc
54+
```
55+
rake doc
56+
```
5057

5158
You can also view them in your browser
5259

53-
rake view_api
54-
rake view_capi
60+
```
61+
rake view_api
62+
rake view_capi
63+
```
5564

5665
## How to customize mruby (mrbgems)
5766

TODO.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ Thing to Do in the future
33

44
# After mruby 3.0
55

6-
* replace `fp_fmt.c` by `float_format` (https://github.com/dhylands/format-float.git)
6+
* replace `fp_fmt.c` by `float_format` (<https://github.com/dhylands/format-float.git>)
77
* multi-precision integer
88
* WORD_BOXING: Pack some floats in `mrb_value`
99
* NAN_BOXING: Allow `MRB_INT64` along with NaN boxing
10-
* keyword arguments a la Ruby3.0 (using `OP_SENDVK`)
10+
* keyword arguments à la Ruby3.0 (using `OP_SENDVK`)
1111
* parser and code generator independent from `mrb_state` (mmruby?)
1212

1313
# Things to do (Things that are not done yet)

benchmark/bm_so_lists.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby
1+
# from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby
22

33
NUM = 300
44
SIZE = 10000

0 commit comments

Comments
 (0)