diff options
| author | John Bampton <[email protected]> | 2021-03-01 10:06:17 +1000 |
|---|---|---|
| committer | John Bampton <[email protected]> | 2021-03-01 10:06:17 +1000 |
| commit | 1c9b1bfeb7932c1b82509679e40b2d2bf99768cc (patch) | |
| tree | 3868be98b373b479ab17173b2cb6a5c6ab095c57 | |
| parent | 65add8c650088f398642aa9611baf4cb2266fff4 (diff) | |
| download | mruby-1c9b1bfeb7932c1b82509679e40b2d2bf99768cc.tar.gz mruby-1c9b1bfeb7932c1b82509679e40b2d2bf99768cc.zip | |
feat: add pre-commit framework
| -rw-r--r-- | .pre-commit-config.yaml | 39 | ||||
| -rw-r--r-- | CONTRIBUTING.md | 9 | ||||
| -rw-r--r-- | LEGAL | 1 | ||||
| -rw-r--r-- | LICENSE | 1 | ||||
| -rw-r--r-- | NEWS | 2 | ||||
| -rw-r--r-- | mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h | 1 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/lex.def | 1 | ||||
| -rw-r--r-- | mrbgems/mruby-sleep/example/sleep.rb | 1 | ||||
| -rw-r--r-- | mrbgems/mruby-toplevel-ext/test/toplevel.rb | 1 | ||||
| -rw-r--r-- | test/t/basicobject.rb | 1 | ||||
| -rw-r--r-- | test/t/iterations.rb | 2 | ||||
| -rw-r--r-- | test/t/object.rb | 1 |
12 files changed, 49 insertions, 11 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..0a9da963f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,39 @@ +--- +default_stages: [commit, push] +default_language_version: + # force all unspecified Python hooks to run python3 + python: python3 +minimum_pre_commit_version: "1.20.0" +repos: + - repo: meta + hooks: + - id: identity + - id: check-hooks-apply + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-yaml + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: trailing-whitespace + # - repo: git://github.com/Lucas-C/pre-commit-hooks + # rev: v1.1.9 + # hooks: + # - id: forbid-tabs + # - id: remove-tabs + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.26.0 + hooks: + - id: markdownlint + name: Run markdownlint + - repo: https://github.com/adrienverge/yamllint + rev: v1.26.0 + hooks: + - id: yamllint + name: Check YAML files with yamllint + entry: yamllint --strict . + types: [yaml] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2ffd759b1..7e48508aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,6 +18,15 @@ things in mind before submitting your pull request: * Use mrbgem to provide non ISO features (classes, modules and methods) unless you have a special reason to implement them in the core +## Pre-commit + +A framework for managing and maintaining multi-language pre-commit hooks. +Pre-commit can be [installed](https://pre-commit.com/#installation) with `pip`, `curl`, `brew` or `conda`. +You need to first install pre-commit and then install the pre-commit hooks with `pre-commit install`. +Now pre-commit will run automatically on git commit! +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). +Use `pre-commit run --all-files` to check all files. + ## Coding conventions How to style your C and Ruby code which you want to submit. @@ -3,4 +3,3 @@ LEGAL NOTICE INFORMATION All the files in this distribution are covered under the MIT license (see the file LICENSE) except some files mentioned below: - @@ -17,4 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - @@ -9,5 +9,3 @@ with all sufficient information, see the ChangeLog file. ** Information about first release v1.0.0 - - diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h index c7812b0d6..6f1a53f3d 100644 --- a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h +++ b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h @@ -17,4 +17,3 @@ #define MRB_DEBUG_BREAK_NO_OVER (-15) #endif - diff --git a/mrbgems/mruby-compiler/core/lex.def b/mrbgems/mruby-compiler/core/lex.def index 944aaf4a8..7c6f316f0 100644 --- a/mrbgems/mruby-compiler/core/lex.def +++ b/mrbgems/mruby-compiler/core/lex.def @@ -205,4 +205,3 @@ mrb_reserved_word (register const char *str, register size_t len) return 0; } #line 52 "mrbgems/mruby-compiler/core/keywords" - diff --git a/mrbgems/mruby-sleep/example/sleep.rb b/mrbgems/mruby-sleep/example/sleep.rb index e5acea3b2..90a436937 100644 --- a/mrbgems/mruby-sleep/example/sleep.rb +++ b/mrbgems/mruby-sleep/example/sleep.rb @@ -1,3 +1,2 @@ sleep(10) usleep(10000) - diff --git a/mrbgems/mruby-toplevel-ext/test/toplevel.rb b/mrbgems/mruby-toplevel-ext/test/toplevel.rb index 26aae9a7d..369a14909 100644 --- a/mrbgems/mruby-toplevel-ext/test/toplevel.rb +++ b/mrbgems/mruby-toplevel-ext/test/toplevel.rb @@ -21,4 +21,3 @@ assert('Toplevel#include') do assert_equal :foo, method_foo assert_equal :bar2, CONST_BAR end - diff --git a/test/t/basicobject.rb b/test/t/basicobject.rb index f33171266..c5aa3f171 100644 --- a/test/t/basicobject.rb +++ b/test/t/basicobject.rb @@ -8,4 +8,3 @@ end assert('BasicObject superclass') do assert_nil(BasicObject.superclass) end - diff --git a/test/t/iterations.rb b/test/t/iterations.rb index f227a6037..9611388ea 100644 --- a/test/t/iterations.rb +++ b/test/t/iterations.rb @@ -58,4 +58,4 @@ assert('next expression', '11.5.2.4.4') do end all end -end
\ No newline at end of file +end diff --git a/test/t/object.rb b/test/t/object.rb index 6a755d3ba..b65f298e6 100644 --- a/test/t/object.rb +++ b/test/t/object.rb @@ -8,4 +8,3 @@ end assert('Object superclass', '15.2.1.2') do assert_equal BasicObject, Object.superclass end - |
