diff options
| author | John Bampton <[email protected]> | 2021-04-11 12:51:28 +1000 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-04-16 16:37:52 +0900 |
| commit | 9d32d440ebf1ebd0684f5349316a15602bea5421 (patch) | |
| tree | ae119a76ef9922d77fd9d13efc095e0a746253ec | |
| parent | ac9038121bec0141b93c8751248ffdb7688b9474 (diff) | |
| download | mruby-9d32d440ebf1ebd0684f5349316a15602bea5421.tar.gz mruby-9d32d440ebf1ebd0684f5349316a15602bea5421.zip | |
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
49 files changed, 299 insertions, 259 deletions
diff --git a/.github/linters/.ecrc b/.github/linters/.ecrc new file mode 100644 index 000000000..fb885d02a --- /dev/null +++ b/.github/linters/.ecrc @@ -0,0 +1,12 @@ +{ + "verbose": false, + "ignore_defaults": false, + "exclude": ["oss-fuzz/", "src/"], + "disable": { + "end_of_line": false, + "trim_trailing_whitespace": false, + "insert_final_newline": false, + "indent_size": true, + "indent_style": true + } +} diff --git a/.markdownlint.yml b/.github/linters/.markdown-lint.yml index b59c6cb53..8020fc062 100644 --- a/.markdownlint.yml +++ b/.github/linters/.markdown-lint.yml @@ -1,16 +1,12 @@ MD001: false MD003: false -MD004: false MD005: false MD007: false MD010: false -MD011: false MD013: false MD014: false MD024: false MD025: false MD026: false -MD034: false MD040: false -MD041: false MD046: false diff --git a/.yamllint b/.github/linters/.yaml-lint.yml index 88f3b4eb9..88f3b4eb9 100644 --- a/.yamllint +++ b/.github/linters/.yaml-lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fb7f62d4a..f949c5bbc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,52 +1,32 @@ -name: โ๏ธ Lint +name: Lint on: [pull_request] jobs: - markdownlint: - name: ๐ธ Markdown - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: ๐ Use Node.js - uses: actions/[email protected] - with: - node-version: '14' - - run: npm install -g [email protected] - - run: markdownlint '**/*.md' misspell: - name: ๐ฅ Check Spelling + name: Check Spelling runs-on: ubuntu-latest steps: - - name: ๐ Check Out + - name: Check Out uses: actions/checkout@v2 - - name: ๐
Install + - name: Install run: | wget -O - -q https://git.io/misspell | sh -s -- -b . - - name: ๐ถ๏ธ Misspell + - name: Misspell run: | git ls-files --empty-directory | xargs ./misspell -error - trailing-whitespace: - name: ๐ง Trailing whitespace + merge-conflict: + name: Merge Conflict runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: ๐งน Check for trailing whitespace - run: "! git grep -EIn $'[ \t]+$'" - yamllint: - name: ๐ถ YAML + - name: Check merge conflict + run: | + grep "^<<<<<<< HEAD" $(git ls-files | xargs) && exit 1 || true + trailing-whitespace: + name: Trailing whitespace runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax - architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install yamllint - - name: ๐งน YAML Lint - run: | - # return non-zero exit code on warnings - yamllint --strict . + - name: Check for trailing whitespace + run: "! git grep -EIn $'[ \t]+$'" diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 000000000..306060c3f --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,25 @@ +name: Lint Code Base + +on: + push: + branches-ignore: [master] + # Remove the line above to run when pushing to master + pull_request: + branches: [master] + +jobs: + build: + name: Lint Code Base + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: github/super-linter@v3 + env: + 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 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a9da963f..46abd0675 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,8 @@ repos: hooks: - id: check-added-large-files - id: check-case-conflict + - id: check-executables-have-shebangs + exclude: ^test/t/lang\.rb$ - id: check-merge-conflict - id: check-yaml - id: end-of-file-fixer @@ -26,14 +28,15 @@ repos: # - id: forbid-tabs # - id: remove-tabs - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.26.0 + rev: v0.27.1 hooks: - id: markdownlint name: Run markdownlint + entry: markdownlint -c .github/linters/.markdown-lint.yml . - repo: https://github.com/adrienverge/yamllint - rev: v1.26.0 + rev: v1.26.1 hooks: - id: yamllint name: Check YAML files with yamllint - entry: yamllint --strict . + entry: yamllint --strict -c .github/linters/.yaml-lint.yml . types: [yaml] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e48508aa..ebc9c2239 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,11 +22,21 @@ things in mind before submitting your pull request: 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. +To run a single hook use `pre-commit run --all-files <hook_id>` + +To update use `pre-commit autoupdate` + +* [Quick start](https://pre-commit.com/#quick-start) +* [Usage](https://pre-commit.com/#usage) +* [pre-commit-autoupdate](https://pre-commit.com/#pre-commit-autoupdate) + ## Coding conventions How to style your C and Ruby code which you want to submit. @@ -41,7 +51,7 @@ C code: mruby should be highly portable to other systems and compilers. For this it is recommended to keep your code as close as possible to the C99 standard -(http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf). +(<http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf>). Visual C++ is also an important target for mruby (supported version is 2013 or 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: #### Comply with the Ruby standard (ISO/IEC 30170:2012) mruby is currently targeting to execute Ruby code which complies to ISO/IEC -30170:2012 (https://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579), +30170:2012 (<https://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=59579>), unless there's a clear reason, e.g. the latest Ruby has changed behavior from ISO. @@ -1,4 +1,7 @@ +# mruby + [![Build Status][build-status-img]][travis-ci] +[](https://github.com/marketplace/actions/super-linter) ## What is mruby @@ -24,13 +27,15 @@ The latest development version of mruby can be downloaded via the following URL: The trunk of the mruby source tree can be checked out with the following command: - $ git clone https://github.com/mruby/mruby.git +``` +$ git clone https://github.com/mruby/mruby.git +``` 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). ## mruby home-page -The URL of the mruby home-page is: https://mruby.org. +The URL of the mruby home-page is: <https://mruby.org>. ## Mailing list @@ -46,12 +51,16 @@ There are two sets of documentation in mruby: the mruby API (generated by yard) To build both of them, simply go - rake doc +``` +rake doc +``` You can also view them in your browser - rake view_api - rake view_capi +``` +rake view_api +rake view_capi +``` ## How to customize mruby (mrbgems) @@ -3,11 +3,11 @@ Thing to Do in the future # After mruby 3.0 -* replace `fp_fmt.c` by `float_format` (https://github.com/dhylands/format-float.git) +* replace `fp_fmt.c` by `float_format` (<https://github.com/dhylands/format-float.git>) * multi-precision integer * WORD_BOXING: Pack some floats in `mrb_value` * NAN_BOXING: Allow `MRB_INT64` along with NaN boxing -* keyword arguments a la Ruby3.0 (using `OP_SENDVK`) +* keyword arguments ร la Ruby3.0 (using `OP_SENDVK`) * parser and code generator independent from `mrb_state` (mmruby?) # Things to do (Things that are not done yet) diff --git a/benchmark/bm_so_lists.rb b/benchmark/bm_so_lists.rb index 512e312cc..fdee0e4d4 100644 --- a/benchmark/bm_so_lists.rb +++ b/benchmark/bm_so_lists.rb @@ -1,4 +1,4 @@ -#from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby +# from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby NUM = 300 SIZE = 10000 diff --git a/build_config/ArduinoDue.rb b/build_config/ArduinoDue.rb index 9292183e2..9baf1ef92 100644 --- a/build_config/ArduinoDue.rb +++ b/build_config/ArduinoDue.rb @@ -11,7 +11,7 @@ MRuby::CrossBuild.new("ArduinoDue") do |conf| # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Java' # GNU Linux ARDUINO_PATH = '/opt/arduino' - # Arduino IDE <= 1.5.6 + # Arduino IDE <= 1.5.6 BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/g++_arm_none_eabi/bin" # Arduino IDE >= 1.5.7 # BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin" diff --git a/build_config/IntelEdison.rb b/build_config/IntelEdison.rb index a33d83bd7..65b6a9a5f 100644 --- a/build_config/IntelEdison.rb +++ b/build_config/IntelEdison.rb @@ -21,7 +21,7 @@ MRuby::CrossBuild.new('core2-32-poky-linux') do |conf| # POKY_EDISON_PATH = '/opt/poky-edison/1.7.2' - POKY_EDISON_SYSROOT = "#{POKY_EDISON_PATH}/sysroots/core2-32-poky-linux" + POKY_EDISON_SYSROOT = "#{POKY_EDISON_PATH}/sysroots/core2-32-poky-linux" POKY_EDISON_X86_PATH = "#{POKY_EDISON_PATH}/sysroots/i386-pokysdk-darwin" POKY_EDISON_BIN_PATH = "#{POKY_EDISON_X86_PATH}/usr/bin/i586-poky-linux" diff --git a/build_config/host-shared.rb b/build_config/host-shared.rb index 6b19b3640..38cab8145 100644 --- a/build_config/host-shared.rb +++ b/build_config/host-shared.rb @@ -23,7 +23,7 @@ MRuby::Build.new do |conf| # file extensions conf.exts do |exts| - exts.library = '.so' + exts.library = '.so' end # file separator diff --git a/build_config/nintendo_switch.rb b/build_config/nintendo_switch.rb index 02c067fea..549c1f269 100644 --- a/build_config/nintendo_switch.rb +++ b/build_config/nintendo_switch.rb @@ -1,73 +1,73 @@ # Cross Compiling configuration for the Nintendo Switch, it requires Nintendo SDK # Tested on windows MRuby::CrossBuild.new('nintendo_switch_32bit') do |conf| - conf.toolchain :clang - NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT'] + conf.toolchain :clang + NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT'] - include_paths = [ - "#{NINTENDO_SDK_PATH}/Include", - "#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a32/Include" - ] + include_paths = [ + "#{NINTENDO_SDK_PATH}/Include", + "#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a32/Include" + ] - conf.cc do |cc| - cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" - cc.include_paths += include_paths - cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] - cc.defines += 'NN_SDK_BUILD_RELEASE' - end + conf.cc do |cc| + cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" + cc.include_paths += include_paths + cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] + cc.defines += 'NN_SDK_BUILD_RELEASE' + end - conf.cxx do |cxx| - cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" - cxx.include_paths += include_paths - cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] - cxx.defines += 'NN_SDK_BUILD_RELEASE' - end + conf.cxx do |cxx| + cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" + cxx.include_paths += include_paths + cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] + cxx.defines += 'NN_SDK_BUILD_RELEASE' + end - conf.archiver do |archiver| - archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/llvm-ar" - end + conf.archiver do |archiver| + archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/llvm-ar" + end - conf.linker do |linker| - linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/clang++" - linker.libraries = [] - end + conf.linker do |linker| + linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/armv7l/bin/clang++" + linker.libraries = [] + end - # Add your mrbgems + # Add your mrbgems end MRuby::CrossBuild.new('nintendo_switch_64bit') do |conf| - conf.toolchain :clang - NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT'] + conf.toolchain :clang + NINTENDO_SDK_PATH = ENV['NINTENDO_SDK_ROOT'] - include_paths = [ - "#{NINTENDO_SDK_PATH}/Include", - "#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a64/Include" - ] + include_paths = [ + "#{NINTENDO_SDK_PATH}/Include", + "#{NINTENDO_SDK_PATH}/Common/Configs/Targets/NX-NXFP2-a64/Include" + ] - conf.cc do |cc| - cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" - cc.include_paths += include_paths - cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] - cc.flags << '--target=aarch64-nintendo-nx-elf' - cc.defines += 'NN_SDK_BUILD_RELEASE' - end + conf.cc do |cc| + cc.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" + cc.include_paths += include_paths + cc.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] + cc.flags << '--target=aarch64-nintendo-nx-elf' + cc.defines += 'NN_SDK_BUILD_RELEASE' + end - conf.cxx do |cxx| - cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" - cxx.include_paths += include_paths - cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] - cxx.flags << '--target=aarch64-nintendo-nx-elf' - cxx.defines += 'NN_SDK_BUILD_RELEASE' - end + conf.cxx do |cxx| + cxx.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/bin/nx-clang++" + cxx.include_paths += include_paths + cxx.flags += ['-fpic -fno-short-enums -ffunction-sections -fdata-sections -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-vectorize -funsigned-char -O2 -g -mno-implicit-float'] + cxx.flags << '--target=aarch64-nintendo-nx-elf' + cxx.defines += 'NN_SDK_BUILD_RELEASE' + end - conf.archiver do |archiver| - archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/llvm-ar" - end + conf.archiver do |archiver| + archiver.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/llvm-ar" + end - conf.linker do |linker| - linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/clang++" - linker.libraries = [] - end + conf.linker do |linker| + linker.command = "#{NINTENDO_SDK_PATH}/Compilers/NX/nx/aarch64/bin/clang++" + linker.libraries = [] + end - # Add your mrbgems + # Add your mrbgems end diff --git a/doc/guides/compile.md b/doc/guides/compile.md index 740663ff8..7156b2b68 100644 --- a/doc/guides/compile.md +++ b/doc/guides/compile.md @@ -271,7 +271,7 @@ See doc/mrbgems/README.md for more option about mrbgems. Configuration Mrbtest build process. -If you want mrbtest.a only, You should set `conf.build_mrbtest_lib_only` +If you want `mrbtest.a` only, You should set `conf.build_mrbtest_lib_only` ```ruby conf.build_mrbtest_lib_only @@ -309,7 +309,7 @@ If you need to enable C++ exception explicitly add the following: conf.enable_cxx_exception ``` -#### C++ exception disabling. +#### C++ exception disabling If your compiler does not support C++, and you want to ensure you don't use mrbgem written in C++, you can explicitly disable diff --git a/doc/guides/debugger.md b/doc/guides/debugger.md index 2393c20b1..14c9bfebd 100644 --- a/doc/guides/debugger.md +++ b/doc/guides/debugger.md @@ -115,7 +115,7 @@ The breakpoint will be ordered in serial from 1. The number, which was given to the deleted breakpoint, will never be given to another breakpoint again. You can give multiple breakpoints to the specified the line number and method. -Be ware that breakpoint command will not check the validity of the class name and method name. +Be aware that the breakpoint command will not check the validity of the class name and method name. You can get the current breakpoint information by the following options. @@ -367,5 +367,5 @@ r #### Step Command This will run the program step by step. -When the method and the block are invoked, the program will be stop at the first row. +When the method and the block are invoked, the program will stop at the first row. The program, which is developed in C, will be ignored. diff --git a/doc/guides/gc-arena-howto.md b/doc/guides/gc-arena-howto.md index 192a10802..2c1cdc1fb 100644 --- a/doc/guides/gc-arena-howto.md +++ b/doc/guides/gc-arena-howto.md @@ -3,7 +3,7 @@ _This is an English translation of [Matz's blog post][matz blog post] written in Japanese._ _Some parts are updated to reflect recent changes._ -[matz blog post]: https://www.rubyist.net/~matz/20130731.html +[matz blog post]: <https://www.rubyist.net/~matz/20130731.html> When you are extending mruby using C language, you may encounter mysterious "arena overflow error" or memory leak or very slow @@ -46,7 +46,7 @@ no longer referenced in the Ruby world, and cannot be treated as garbage. In mruby, we recognize all objects created in C function are alive. Then we have no problem such as confusing a live object as dead. -This means that because we cannot collect truly dead object, we may +This means that because we cannot collect a truly dead object, we may lose efficiency, but as a trade-off the GC itself is highly portable. We can say goodbye to the problem that GC deletes live objects due to optimization which sometimes occurs in CRuby. @@ -140,7 +140,7 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list) } ``` -This is a real example, so a little bit complicated, but bear with me. +This is a real example, so slightly complicated, but bear with me. The essence of `Array#inspect` is that after stringifying each element of array using `inspect` method, we join them together so that we can get `inspect` representation of the entire array. diff --git a/doc/guides/link.md b/doc/guides/link.md index 4bef8414c..8d70330fc 100644 --- a/doc/guides/link.md +++ b/doc/guides/link.md @@ -7,7 +7,7 @@ You have two ways to link `libmruby` to your application. ## Executable Gems -If your application is relatively small, `mrbgem` is easier way to +If your application is relatively small, `mrbgem` is an easier way to create the executable. By tradition, the gem name start with `mruby-bin-`, e.g. `mruby-bin-debugger`. diff --git a/doc/guides/mrbconf.md b/doc/guides/mrbconf.md index 2e76464d2..b5bc8c85c 100644 --- a/doc/guides/mrbconf.md +++ b/doc/guides/mrbconf.md @@ -1,28 +1,28 @@ -# mruby configuration macros. +# mruby configuration macros -## How to use these macros. +## How to use these macros You can use mrbconfs with following ways: * Write them in `mrbconf.h`. - * Using compiler flags is preferred when building a cross binaries or multiple mruby binaries - since it's easier to use different mrbconf per each `MRuby::Build`. - * Most flags can be enabled by just commenting in. + * Using compiler flags is preferred when building a cross binaries or multiple mruby binaries + since it's easier to use different mrbconf per each `MRuby::Build`. + * Most flags can be enabled by just commenting in. * Pass them as compiler flags. - * Make sure you pass the same flags to all compilers since some mrbconf(e.g., `MRB_GC_FIXED_ARENA`) - changes `struct` layout and cause memory access error when C and other language(e.g., C++) is mixed. + * Make sure you pass the same flags to all compilers since some mrbconf(e.g., `MRB_GC_FIXED_ARENA`) + changes `struct` layout and cause memory access error when C and other language(e.g., C++) is mixed. -## stdio setting. +## stdio setting `MRB_NO_STDIO` * When defined `<stdio.h>` functions won't be used. * Some features will be disabled when this is enabled: * `mrb_irep` load/dump from/to file. - * Compiling mruby script from file. + * Compiling mruby script from a file. * Printing features in **src/print.c**. -## Debug macros. +## Debug macros `MRB_USE_DEBUG_HOOK` @@ -54,16 +54,16 @@ You can use mrbconfs with following ways: * Default value is `0x40000 - MRB_STACK_GROWTH`. * Raises `RuntimeError` when stack size exceeds this value. -## Primitive type configuration. +## Primitive type configuration `MRB_USE_FLOAT32` -* When defined single precision floating point type(C type `float`) is used as `mrb_float`. -* Otherwise double precision floating point type(C type `double`) is used as `mrb_float`. +* When defined single precision floating-point type(C type `float`) is used as `mrb_float`. +* Otherwise, double precision floating-point type(C type `double`) is used as `mrb_float`. `MRB_NO_FLOAT` -* When defined removes floating point numbers from mruby. +* When defined removes floating-point numbers from mruby. * It makes mruby easier to handle in "Microcontroller without FPU" and "Kernel Space". `MRB_INT32` @@ -76,7 +76,7 @@ You can use mrbconfs with following ways: * When defined, or `MRB_INT32` are not defined on 64-bit CPU mode, `mrb_int` will be defined as `int64_t`. * Conflicts with `MRB_INT32`. -## Garbage collector configuration. +## Garbage collector configuration `MRB_GC_STRESS` @@ -104,7 +104,7 @@ You can use mrbconfs with following ways: * Defines value is `1024`. * Specifies number of `RBasic` per each heap page. -## Memory pool configuration. +## Memory pool configuration `POOL_ALIGNMENT` @@ -118,7 +118,7 @@ largest value of required alignment. * Specifies page size of pool page. * Smaller the value is increases memory overhead. -## State atexit configuration. +## State atexit configuration `MRB_FIXED_STATE_ATEXIT_STACK` @@ -131,7 +131,7 @@ largest value of required alignment. * Default value is `5`. * If `MRB_FIXED_STATE_ATEXIT_STACK` isn't defined this macro is ignored. -## `mrb_value` configuration. +## `mrb_value` configuration `MRB_ENDIAN_BIG` @@ -149,7 +149,7 @@ largest value of required alignment. * If defined represent `mrb_value` as a word. * If defined `Float` will be a mruby object with `RBasic`. -## Reduce heap memory configuration. +## Reduce heap memory configuration `MRB_USE_LINK_TIME_RO_DATA_P` @@ -167,7 +167,7 @@ largest value of required alignment. * The prototype declaration is `mrb_bool mrb_ro_data_p(const char *ptr)`. * Return `TRUE` if `ptr` is in the read-only section, otherwise return `FALSE`. -## Other configuration. +## Other configuration `MRB_UTF8_STRING` diff --git a/doc/guides/mrbgems.md b/doc/guides/mrbgems.md index 00e097f4c..d4160ebc8 100644 --- a/doc/guides/mrbgems.md +++ b/doc/guides/mrbgems.md @@ -33,7 +33,7 @@ conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master' conf.gem :bitbucket => 'mruby/mrbgems-example', :branch => 'master' ``` -You can specify the sub directory of the repository with `:path` option: +You can specify the subdirectory of the repository with `:path` option: ```ruby conf.gem github: 'mruby/mruby', path: 'mrbgems/mruby-socket' @@ -46,7 +46,7 @@ conf.gem :mgem => 'mruby-yaml' conf.gem :mgem => 'yaml' # 'mruby-' prefix could be omitted ``` -For specifying commit hash to checkout use `:checksum_hash` option: +For specifying the commit hash to checkout use `:checksum_hash` option: ```ruby conf.gem mgem: 'mruby-redis', checksum_hash: '3446d19fc4a3f9697b5ddbf2a904f301c42f2f4e' @@ -110,21 +110,23 @@ contains every gem found in the `mrbgems` directory. The maximal GEM structure looks like this: - +- GEM_NAME <- Name of GEM - | - +- README.md <- Readme for GEM - | - +- mrbgem.rake <- GEM Specification - | - +- include/ <- Header for Ruby extension (will exported) - | - +- mrblib/ <- Source for Ruby extension - | - +- src/ <- Source for C extension - | - +- tools/ <- Source for Executable (in C) - | - +- test/ <- Test code (Ruby) +``` ++- GEM_NAME <- Name of GEM + | + +- README.md <- Readme for GEM + | + +- mrbgem.rake <- GEM Specification + | + +- include/ <- Header for Ruby extension (will exported) + | + +- mrblib/ <- Source for Ruby extension + | + +- src/ <- Source for C extension + | + +- tools/ <- Source for Executable (in C) + | + +- test/ <- Test code (Ruby) +``` The folder `mrblib` contains pure Ruby files to extend mruby. The folder `src` contains C/C++ files to extend mruby. The folder `include` contains C/C++ header @@ -386,22 +388,24 @@ binary gems, to separate normal gems and binary gems. ### Example - +- mruby-bin-example/ - | - +- README.md (Optional) - | - +- bintest/ - | | - | +- example.rb <- Test code for binary gem - | - +- mrbgem.rake <- Gem specification - | - +- mrblib/ <- Source for Ruby extension (Optional) - | - +- src/ <- Source for C extension (Optional) - | - +- tools/ - | - +- example/ <- Executable name directory - | - +- example.c <- Source for Executable (includes main) +``` + +- mruby-bin-example/ + | + +- README.md (Optional) + | + +- bintest/ + | | + | +- example.rb <- Test code for binary gem + | + +- mrbgem.rake <- Gem specification + | + +- mrblib/ <- Source for Ruby extension (Optional) + | + +- src/ <- Source for C extension (Optional) + | + +- tools/ + | + +- example/ <- Executable name directory + | + +- example.c <- Source for Executable (includes main) +``` diff --git a/doc/mruby3.md b/doc/mruby3.md index aacbbb371..d5218428e 100644 --- a/doc/mruby3.md +++ b/doc/mruby3.md @@ -43,7 +43,7 @@ We have ported some new syntax from CRuby. ## Renamed for consistency Some configuration macro names are changed for consistency (use `MRB_USE_XXX` - or `MRB_NO_XXX`). +or `MRB_NO_XXX`). | mruby2 | mruby3 | |--------------------------------|---------------------------| @@ -61,7 +61,7 @@ Some configuration macro names are changed for consistency (use `MRB_USE_XXX` | `DISABLE_MIRB_UNDERSCORE` | `MRB_NO_MIRB_UNDERSCORE` | * `MRB_USE_FLOAT32` is changed from `MRB_USE_FLOAT` to make sure `float` here - means using single precision float, and not the opposite of `MRB_NO_FLOAT`. + means using single precision float, and not the opposite of `MRB_NO_FLOAT`. * `MRB_USE_METHOD_T_STRUCT` uses `struct` version of `mrb_method_t`. More portable but consumes more memory. Turned on by default on 32bit platforms. * `MRB_` prefix is added to those without. @@ -82,7 +82,7 @@ does not fit in `Fixnum` integers. ## `MRB_NAN_BOXING` -Pack `mrb_value` in a floating pointer number. Nothing +Pack `mrb_value` in a floating-point number. Nothing changed from previous versions. ## `MRB_USE_MALLOC_TRIM` @@ -152,7 +152,7 @@ No more operand extension Jump addresses used to be specified by absolute offset from the start of `iseq`. Now they are relative offset from the address of the next instruction. -## `Random` now use `xoshiro128++`. +## `Random` now use `xoshiro128++` For better and faster random number generation. diff --git a/doc/opcode.md b/doc/opcode.md index 3ad09919c..aca3a0827 100644 --- a/doc/opcode.md +++ b/doc/opcode.md @@ -101,9 +101,9 @@ sign) of operands. | OP_ARYCAT | B | ary_cat(R(a),R(a+1)) | | OP_ARYPUSH | B | ary_push(R(a),R(a+1)) | | OP_ARYDUP | B | R(a) = ary_dup(R(a)) | -| OP_AREF | BBB | R(a) = R(b)[c] | -| OP_ASET | BBB | R(a)[c] = R(b) | -| OP_APOST | BBB | *R(a),R(a+1)..R(a+c) = R(a)[b..] | +| OP_AREF | BBB | R(a) = R(b)[c] | <!-- markdownlint-disable --> +| OP_ASET | BBB | R(a)[c] = R(b) | <!-- markdownlint-disable --> +| OP_APOST | BBB | *R(a),R(a+1)..R(a+c) = R(a)[b..] | <!-- markdownlint-disable --> | OP_INTERN | B | R(a) = intern(R(a)) | | OP_STRING | BB | R(a) = str_dup(Lit(b)) | | OP_STRING16 | BS | R(a) = str_dup(Lit(b)) | diff --git a/include/mrbconf.h b/include/mrbconf.h index 347f6786e..d4da81bfc 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -25,10 +25,10 @@ #endif /* configuration options: */ -/* add -DMRB_USE_FLOAT32 to use float instead of double for floating point numbers */ +/* add -DMRB_USE_FLOAT32 to use float instead of double for floating-point numbers */ //#define MRB_USE_FLOAT32 -/* exclude floating point numbers */ +/* exclude floating-point numbers */ //#define MRB_NO_FLOAT /* obsolete configuration */ diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 0bd8e7daf..2c2bff714 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -5865,7 +5865,7 @@ parser_yylex(parser_state *p) tokfix(p); if (is_float) { #ifdef MRB_NO_FLOAT - yywarning_s(p, "floating point numbers are not supported", tok(p)); + yywarning_s(p, "floating-point numbers are not supported", tok(p)); pylval.nd = new_int(p, "0", 10, 0); return tINTEGER; #else diff --git a/mrbgems/mruby-compiler/core/y.tab.c b/mrbgems/mruby-compiler/core/y.tab.c index b27b6a136..137e4d4cf 100644 --- a/mrbgems/mruby-compiler/core/y.tab.c +++ b/mrbgems/mruby-compiler/core/y.tab.c @@ -11895,7 +11895,7 @@ parser_yylex(parser_state *p) tokfix(p); if (is_float) { #ifdef MRB_NO_FLOAT - yywarning_s(p, "floating point numbers are not supported", tok(p)); + yywarning_s(p, "floating-point numbers are not supported", tok(p)); pylval.nd = new_int(p, "0", 10, 0); return tINTEGER; #else diff --git a/mrbgems/mruby-complex/src/complex.c b/mrbgems/mruby-complex/src/complex.c index 0bf5377ed..968d3fe2e 100644 --- a/mrbgems/mruby-complex/src/complex.c +++ b/mrbgems/mruby-complex/src/complex.c @@ -300,7 +300,7 @@ complex_div(mrb_state *mrb, mrb_value self) b = complex_ptr(mrb, rhs); - /* Split floating point components into significand and exponent */ + /* Split floating-point components into significand and exponent */ ar.s = F(frexp)(a->real, &ar.x); ai.s = F(frexp)(a->imaginary, &ai.x); br.s = F(frexp)(b->real, &br.x); diff --git a/mrbgems/mruby-enum-ext/mrblib/enum.rb b/mrbgems/mruby-enum-ext/mrblib/enum.rb index f15511925..5f39235e0 100644 --- a/mrbgems/mruby-enum-ext/mrblib/enum.rb +++ b/mrbgems/mruby-enum-ext/mrblib/enum.rb @@ -428,7 +428,7 @@ module Enumerable max = min = val.__svalue max_cmp = min_cmp = block.call(*val) first = false - else + else if (cmp = block.call(*val)) > max_cmp max = val.__svalue max_cmp = cmp diff --git a/mrbgems/mruby-io/README.md b/mrbgems/mruby-io/README.md index 2c5d7a9ac..a518e6169 100644 --- a/mrbgems/mruby-io/README.md +++ b/mrbgems/mruby-io/README.md @@ -15,7 +15,7 @@ Add the line below to your build configuration. ### IO - - https://doc.ruby-lang.org/ja/1.9.3/class/IO.html +* <https://doc.ruby-lang.org/ja/1.9.3/class/IO.html> | method | mruby-io | memo | | ------------------------- | -------- | ---- | @@ -100,7 +100,7 @@ Add the line below to your build configuration. ### File - - https://doc.ruby-lang.org/ja/1.9.3/class/File.html +* <https://doc.ruby-lang.org/ja/1.9.3/class/File.html> | method | mruby-io | memo | | --------------------------- | -------- | ---- | diff --git a/mrbgems/mruby-kernel-ext/src/kernel.c b/mrbgems/mruby-kernel-ext/src/kernel.c index 2a0ca3a9d..7afa6fa5f 100644 --- a/mrbgems/mruby-kernel-ext/src/kernel.c +++ b/mrbgems/mruby-kernel-ext/src/kernel.c @@ -86,7 +86,7 @@ mrb_f_method(mrb_state *mrb, mrb_value self) * Integer(arg,base=0) -> integer * * Converts <i>arg</i> to a <code>Integer</code>. - * Numeric types are converted directly (with floating point numbers + * Numeric types are converted directly (with floating-point numbers * being truncated). <i>base</i> (0, or between 2 and 36) is a base for * integer string representation. If <i>arg</i> is a <code>String</code>, * when <i>base</i> is omitted or equals to zero, radix indicators diff --git a/mrbgems/mruby-kernel-ext/test/kernel.rb b/mrbgems/mruby-kernel-ext/test/kernel.rb index 2ac194dca..fc4402b3d 100644 --- a/mrbgems/mruby-kernel-ext/test/kernel.rb +++ b/mrbgems/mruby-kernel-ext/test/kernel.rb @@ -21,7 +21,7 @@ assert('Kernel.caller, Kernel#caller') do end end - skip "backtrace isn't available" if(c.new.baz(0)[0].include?("unknown")) + skip "backtrace isn't available" if (c.new.baz(0)[0].include?("unknown")) assert_equal "kernel.rb:#{caller_lineno}:in foo", c.new.baz(0)[0][-19..-1] assert_equal "bar", c.new.baz[0][-3..-1] diff --git a/mrbgems/mruby-method/README.md b/mrbgems/mruby-method/README.md index eef414c55..f299718df 100644 --- a/mrbgems/mruby-method/README.md +++ b/mrbgems/mruby-method/README.md @@ -23,38 +23,38 @@ end ## Kernel -- `Kernel#method` -- `Kernel#singleton_method` +* `Kernel#method` +* `Kernel#singleton_method` ## Module -- `Module#instance_method` +* `Module#instance_method` ## Method class -- `Method#name` -- `Method#call` -- `Method#super_method` -- `Method#arity` -- `Method#unbind` -- `Method#[]` -- `Method#owner` -- `Method#receiver` -- `Method#parameters` -- `Method#source_location` -- `Method#to_proc` +* `Method#name` +* `Method#call` +* `Method#super_method` +* `Method#arity` +* `Method#unbind` +* `Method#[]` +* `Method#owner` +* `Method#receiver` +* `Method#parameters` +* `Method#source_location` +* `Method#to_proc` ## UnboundMethod class -- `UnboundMethod#name` -- `UnboundMethod#bind` -- `UnboundMethod#super_method` -- `UnboundMethod#arity` -- `UnboundMethod#owner` -- `UnboundMethod#parameters` -- `UnboundMethod#source_location` +* `UnboundMethod#name` +* `UnboundMethod#bind` +* `UnboundMethod#super_method` +* `UnboundMethod#arity` +* `UnboundMethod#owner` +* `UnboundMethod#parameters` +* `UnboundMethod#source_location` # See also -- https://ruby-doc.org/core-2.3.3/Method.html -- https://ruby-doc.org/core-2.3.3/UnboundMethod.html +* <https://ruby-doc.org/core-2.3.3/Method.html> +* <https://ruby-doc.org/core-2.3.3/UnboundMethod.html> diff --git a/mrbgems/mruby-method/test/method.rb b/mrbgems/mruby-method/test/method.rb index 123ae34be..a7db20031 100644 --- a/mrbgems/mruby-method/test/method.rb +++ b/mrbgems/mruby-method/test/method.rb @@ -92,9 +92,9 @@ assert 'Method#call' do assert_equal 42, klass2.new.method(:foo).call i = Class.new { - def bar - yield 3 - end + def bar + yield 3 + end }.new assert_raise(LocalJumpError) { i.method(:bar).call } assert_equal 3, i.method(:bar).call { |i| i } diff --git a/mrbgems/mruby-proc-ext/test/proc.rb b/mrbgems/mruby-proc-ext/test/proc.rb index 73e02a021..06365b7d9 100644 --- a/mrbgems/mruby-proc-ext/test/proc.rb +++ b/mrbgems/mruby-proc-ext/test/proc.rb @@ -7,8 +7,8 @@ def enable_debug_info? raise rescue => e @enable_debug_info = !e.backtrace.empty? - if @enable_debug_info && e.backtrace[0].include?("(unknown)") - @enable_debug_info = false + if(@enable_debug_info && e.backtrace[0].include?("(unknown)")) + @enable_debug_info = false end return @enable_debug_info end diff --git a/mrbgems/mruby-sleep/README.md b/mrbgems/mruby-sleep/README.md index cddae7c13..ed9c2730a 100644 --- a/mrbgems/mruby-sleep/README.md +++ b/mrbgems/mruby-sleep/README.md @@ -2,9 +2,9 @@ mruby sleep module -## install by mrbgems +## Install by mrbgems -- add `conf.gem` line to your build configuration. +* add `conf.gem` line to your build configuration. ```ruby MRuby::Build.new do |conf| @@ -15,7 +15,7 @@ MRuby::Build.new do |conf| end ``` -## example +## Example ```ruby sleep(10) @@ -26,4 +26,4 @@ usleep(10000) under the MIT License: -* https://www.opensource.org/licenses/mit-license.php +* <https://www.opensource.org/licenses/mit-license.php> diff --git a/mrbgems/mruby-socket/README.md b/mrbgems/mruby-socket/README.md index fd20548aa..b727dc982 100644 --- a/mrbgems/mruby-socket/README.md +++ b/mrbgems/mruby-socket/README.md @@ -21,17 +21,17 @@ Date: Tue, 21 May 2013 04:31:30 GMT ## Requirement -- [mruby-io](https://github.com/mruby/mruby/tree/master/mrbgems/mruby-io) mrbgem -- [iij/mruby-mtest](https://github.com/iij/mruby-mtest) mrgbem to run tests -- system must have RFC3493 basic socket interface -- and some POSIX API... +* [mruby-io](https://github.com/mruby/mruby/tree/master/mrbgems/mruby-io) mrbgem +* [iij/mruby-mtest](https://github.com/iij/mruby-mtest) mrgbem to run tests +* system must have RFC3493 basic socket interface +* and some POSIX API... ## TODO -- add missing methods -- write more tests -- fix possible descriptor leakage (see XXX comments) -- `UNIXSocket#recv_io` `UNIXSocket#send_io` +* add missing methods +* write more tests +* fix possible descriptor leakage (see XXX comments) +* `UNIXSocket#recv_io` `UNIXSocket#send_io` ## License diff --git a/mrbgems/mruby-sprintf/src/sprintf.c b/mrbgems/mruby-sprintf/src/sprintf.c index f6dab159d..839ee4dc4 100644 --- a/mrbgems/mruby-sprintf/src/sprintf.c +++ b/mrbgems/mruby-sprintf/src/sprintf.c @@ -312,21 +312,21 @@ get_hash(mrb_state *mrb, mrb_value *hash, mrb_int argc, const mrb_value *argv) * * Field | Float Format * ------+-------------------------------------------------------------- - * e | Convert floating point argument into exponential notation + * e | Convert floating-point argument into exponential notation * | with one digit before the decimal point as [-]d.dddddde[+-]dd. * | The precision specifies the number of digits after the decimal * | point (defaulting to six). * E | Equivalent to 'e', but uses an uppercase E to indicate * | the exponent. - * f | Convert floating point argument as [-]ddd.dddddd, + * f | Convert floating-point argument as [-]ddd.dddddd, * | where the precision specifies the number of digits after * | the decimal point. - * g | Convert a floating point number using exponential form + * g | Convert a floating-point number using exponential form * | if the exponent is less than -4 or greater than or * | equal to the precision, or in dd.dddd form otherwise. * | The precision specifies the number of significant digits. * G | Equivalent to 'g', but use an uppercase 'E' in exponent form. - * a | Convert floating point argument as [-]0xh.hhhhp[+-]dd, + * a | Convert floating-point argument as [-]0xh.hhhhp[+-]dd, * | which is consisted from optional sign, "0x", fraction part * | as hexadecimal, "p", and exponential part as decimal. * A | Equivalent to 'a', but use uppercase 'X' and 'P'. diff --git a/mrbgems/mruby-test/README.md b/mrbgems/mruby-test/README.md index c0bceecd7..86b1ce05e 100644 --- a/mrbgems/mruby-test/README.md +++ b/mrbgems/mruby-test/README.md @@ -3,4 +3,6 @@ Running Tests To run the tests, execute the following from the project's root directory. - $ make test +``` +$ make test +``` diff --git a/mrblib/00class.rb b/mrblib/00class.rb index cbcca8610..d7a718ba1 100644 --- a/mrblib/00class.rb +++ b/mrblib/00class.rb @@ -9,7 +9,7 @@ class BasicObject end class Module - # 15.2.2.4.12 + # 15.2.2.4.12 def attr_accessor(*names) attr_reader(*names) attr_writer(*names) diff --git a/mrblib/hash.rb b/mrblib/hash.rb index 61ede8137..085536c6c 100644 --- a/mrblib/hash.rb +++ b/mrblib/hash.rb @@ -183,7 +183,7 @@ class Hash end ## # Return the contents of this hash as a string. - # + # # ISO 15.2.13.4.30 (x) def inspect self._inspect({}) diff --git a/src/fmt_fp.c b/src/fmt_fp.c index 448c20df8..d3fe97ce3 100644 --- a/src/fmt_fp.c +++ b/src/fmt_fp.c @@ -123,7 +123,7 @@ fmt_u(uint32_t x, char *s) return s; } -/* Do not override this check. The floating point printing code below +/* Do not override this check. The floating-point printing code below * depends on the float.h constants being right. If they are wrong, it * may overflow the stack. */ #if LDBL_MANT_DIG == 53 diff --git a/src/numeric.c b/src/numeric.c index edb5d28b2..504a7493d 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -232,7 +232,7 @@ coerce_step_counter(mrb_state *mrb, mrb_value self) * Document-class: Float * * <code>Float</code> objects represent inexact real numbers using - * the native architecture's double-precision floating point + * the native architecture's double-precision floating-point * representation. */ @@ -812,7 +812,7 @@ flo_ceil(mrb_state *mrb, mrb_value num) * flt.round([ndigits]) -> integer or float * * Rounds <i>flt</i> to a given precision in decimal digits (default 0 digits). - * Precision may be negative. Returns a floating point number when ndigits + * Precision may be negative. Returns a floating-point number when ndigits * is more than zero. * * 1.4.round #=> 1 diff --git a/src/string.c b/src/string.c index eb4136b10..74263098a 100644 --- a/src/string.c +++ b/src/string.c @@ -2570,7 +2570,7 @@ mrb_str_to_dbl(mrb_state *mrb, mrb_value str, mrb_bool badcheck) * str.to_f => float * * Returns the result of interpreting leading characters in <i>str</i> as a - * floating point number. Extraneous characters past the end of a valid number + * floating-point number. Extraneous characters past the end of a valid number * are ignored. If there is not a valid number at the start of <i>str</i>, * <code>0.0</code> is returned. This method never raises an exception. * diff --git a/super-linter.report/.keep b/super-linter.report/.keep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/super-linter.report/.keep diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake index 9328f0b99..4f24cfd93 100644 --- a/tasks/mrbgems.rake +++ b/tasks/mrbgems.rake @@ -67,7 +67,7 @@ MRuby.each_target do file "#{build_dir}/LEGAL" => [MRUBY_CONFIG, __FILE__] do |t| mkdir_p File.dirname t.name open(t.name, 'w+') do |f| - f.puts <<LEGAL + f.puts <<LEGAL Copyright (c) #{Time.now.year} mruby developers Permission is hereby granted, free of charge, to any person obtaining a diff --git a/test/assert.rb b/test/assert.rb index 73382fb1c..8cd2b375b 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -290,7 +290,7 @@ def assert_float(exp, act, msg = nil) if e.finite? && a.finite? && (n = (e - a).abs) > Mrbtest::FLOAT_TOLERANCE flunk(msg, " Expected |#{exp} - #{act}| (#{n}) to be <= #{Mrbtest::FLOAT_TOLERANCE}.") elsif (e.infinite? || a.infinite?) && e != a || - e.nan? && !a.nan? || !e.nan? && a.nan? + e.nan? && !a.nan? || !e.nan? && a.nan? flunk(msg, " Expected #{act} to be #{exp}.") else pass diff --git a/test/t/literals.rb b/test/t/literals.rb index b7b07cd9d..f93968650 100644 --- a/test/t/literals.rb +++ b/test/t/literals.rb @@ -90,7 +90,7 @@ assert('Literals Strings Here documents', '8.7.6.3.6') do a = <<AAA aaa AAA - b = <<b_b + b = <<b_b bbb b_b c = [<<CCC1, <<"CCC2", <<'CCC3'] @@ -250,7 +250,6 @@ ZZZ assert_equal ["1", "www\n", "3", "4", "5"], w assert_equal [1, "foo 222 333\n 444\n5\n bar\n6\n", 9], x assert_equal "", z - end diff --git a/test/t/module.rb b/test/t/module.rb index 07d550804..9aa018280 100644 --- a/test/t/module.rb +++ b/test/t/module.rb @@ -391,15 +391,15 @@ assert('Module#undef_method', '15.2.2.4.42') do class Parent def hello end - end + end - class Child < Parent + class Child < Parent def hello end - end + end - class GrandChild < Child - end + class GrandChild < Child + end end Test4UndefMethod::Child.class_eval{ undef_method :hello } @@ -736,9 +736,9 @@ assert('Issue 1467') do class C1 include M1 - def initialize() - super() - end + def initialize() + super() + end end class C2 diff --git a/test/t/nameerror.rb b/test/t/nameerror.rb index 28682bedc..9d2e2a470 100644 --- a/test/t/nameerror.rb +++ b/test/t/nameerror.rb @@ -20,9 +20,9 @@ assert('NameError#name', '15.2.31.2.1') do end assert('NameError#initialize', '15.2.31.2.2') do - e = NameError.new('a', :foo) + e = NameError.new('a', :foo) - assert_equal NameError, e.class - assert_equal 'a', e.message - assert_equal :foo, e.name + assert_equal NameError, e.class + assert_equal 'a', e.message + assert_equal :foo, e.name end diff --git a/test/t/string.rb b/test/t/string.rb index c1511de63..447493227 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -148,9 +148,9 @@ assert('String#[]=') do end if Object.const_defined?(:Float) - e = 'abc' - e[1.1] = 'X' - assert_equal 'aXc', e + e = 'abc' + e[1.1] = 'X' + assert_equal 'aXc', e end assert_raise(TypeError) { 'a'[0] = 1 } |
