diff options
| -rw-r--r-- | .editorconfig | 43 | ||||
| -rw-r--r-- | .github/workflows/lint.yml | 50 | ||||
| -rw-r--r-- | .github/workflows/spell-checker.yml | 17 | ||||
| -rw-r--r-- | build_config/clang-asan.rb | 2 | ||||
| -rw-r--r-- | build_config/dreamcast_shelf.rb | 2 | ||||
| -rw-r--r-- | doc/guides/mrbgems.md | 4 | ||||
| -rw-r--r-- | include/mruby/array.h | 2 | ||||
| -rw-r--r-- | mrbgems/mruby-bin-debugger/bintest/print.rb | 4 | ||||
| -rw-r--r-- | mrbgems/mruby-cmath/mrbgem.rake | 2 | ||||
| -rw-r--r-- | mrbgems/mruby-cmath/src/cmath.c | 2 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 2 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/y.tab.c | 4 | ||||
| -rw-r--r-- | src/array.c | 9 | ||||
| -rw-r--r-- | src/vm.c | 2 | ||||
| -rwxr-xr-x | test/check-for-trailing-whitespace.sh | 13 |
15 files changed, 90 insertions, 68 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..705b1f022 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,43 @@ +# About this file, see: +# Website: https://editorconfig.org/ +# For Emacs users: https://github.com/editorconfig/editorconfig-emacs +# For Vim users: https://github.com/editorconfig/editorconfig-vim + +root = true + +[*] +indent_style = tab +indent_size = 8 +tab_width = 8 +end_of_line = lf +charset = utf-8 +insert_final_newline = true + +[{Makefile,Makefile.*,makefile,*.mk}] +trim_trailing_whitespace = true +#max_line_length = 80 + +[*.{c,cc,C,cxx,cpp,h,hh,H,hxx,hpp,inc,y}] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +#max_line_length = 120 + +[{*.rb,Rakefile,rakefile,*.rake,*.gemspec,*.gembox}] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +#max_line_length = 120 + +[*.bat] +end_of_line = crlf +charset = latin1 +#max_line_length = 80 + +[*.{yaml,yml}] +indent_style = space +indent_size = 2 + +[*.md] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 48af6619f..474890010 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,23 +3,6 @@ name: โ๏ธ Lint on: [pull_request] jobs: - yamllint: - name: ๐ถ YAML - 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 . markdownlint: name: ๐ธ Markdown runs-on: ubuntu-latest @@ -31,12 +14,39 @@ jobs: node-version: '12.x' - run: npm install -g [email protected] - run: markdownlint '**/*.md' + misspell: + name: ๐ฅ Check Spelling + runs-on: ubuntu-latest + steps: + - name: ๐ Check Out + uses: actions/checkout@v2 + - name: ๐
Install + run: | + wget -O - -q https://git.io/misspell | sh -s -- -b . + - name: ๐ถ๏ธ Misspell + run: | + git ls-files --empty-directory | xargs ./misspell -error trailing-whitespace: - name: ๐ Trailing whitespace + name: ๐ง Trailing whitespace runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: ๐งน Check for trailing whitespace + run: "! git grep -EIn $'[ \t]+$'" + yamllint: + name: ๐ถ YAML + 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: | - cd test || exit - sh ./check-for-trailing-whitespace.sh || exit 1 + python -m pip install --upgrade pip + pip install yamllint + - name: ๐งน YAML Lint + run: | + # return non-zero exit code on warnings + yamllint --strict . diff --git a/.github/workflows/spell-checker.yml b/.github/workflows/spell-checker.yml deleted file mode 100644 index 7e86e0198..000000000 --- a/.github/workflows/spell-checker.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: ๐ Spellchecker - -on: [pull_request] - -jobs: - misspell: - name: ๐งน Check Spelling - runs-on: ubuntu-latest - steps: - - name: ๐ Check Out - uses: actions/checkout@v2 - - name: ๐
Install - run: | - wget -O - -q https://git.io/misspell | sh -s -- -b . - - name: ๐ถ๏ธ Misspell - run: | - git ls-files --empty-directory | xargs ./misspell -error diff --git a/build_config/clang-asan.rb b/build_config/clang-asan.rb index 5ee0d9129..19cc53bf0 100644 --- a/build_config/clang-asan.rb +++ b/build_config/clang-asan.rb @@ -1,7 +1,7 @@ MRuby::Build.new do |conf| conf.toolchain :clang # include the GEM box - conf.gembox 'default' + conf.gembox 'full-core' # Turn on `enable_debug` for better debugging conf.enable_sanitizer "address,undefined" diff --git a/build_config/dreamcast_shelf.rb b/build_config/dreamcast_shelf.rb index a92770070..7e7d6a52e 100644 --- a/build_config/dreamcast_shelf.rb +++ b/build_config/dreamcast_shelf.rb @@ -20,7 +20,7 @@ MRuby::CrossBuild.new("dreamcast") do |conf| # C compiler # Flags were extracted from KallistiOS environment files conf.cc do |cc| - cc.command = "#{BIN_PATH}/sh-elf-gcc" + cc.command = "#{BIN_PATH}/sh-elf-gcc" cc.include_paths << ["#{KOS_PATH}/include", "#{KOS_PATH}/kernel/arch/dreamcast/include", "#{KOS_PATH}/addons/include", "#{KOS_PATH}/../kos-ports/include"] cc.flags << ["-O2", "-fomit-frame-pointer", "-ml", "-m4-single-only", "-ffunction-sections", "-fdata-sections", "-Wall", "-g", "-fno-builtin", "-ml", "-m4-single-only", "-Wl,-Ttext=0x8c010000", "-Wl,--gc-sections", "-T#{KOS_PATH}/utils/ldscripts/shlelf.xc", "-nodefaultlibs"] cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] diff --git a/doc/guides/mrbgems.md b/doc/guides/mrbgems.md index 6dfe7c1a4..5a6396e97 100644 --- a/doc/guides/mrbgems.md +++ b/doc/guides/mrbgems.md @@ -1,7 +1,7 @@ # mrbgems mrbgems is a library manager to integrate C and Ruby extension in an easy and -standardised way into mruby. Conventinally, each mrbgem name is prefixed by +standardised way into mruby. Conventionally, each mrbgem name is prefixed by `mruby-`, e.g. `mruby-time` for a gem that provides `Time` class functionality. ## Usage @@ -372,7 +372,7 @@ See C and Ruby example. ## Binary gems Some gems can generate executables under `bin` directory. Those gems are called -binary gems. Names of binary gems are conventinally prefixed by `mruby-bin`, +binary gems. Names of binary gems are conventionally prefixed by `mruby-bin`, e.g. `mruby-bin-mirb` and `mruby-bin-strip`. To specify the name of executable, you need to specify `spec.bins` in the diff --git a/include/mruby/array.h b/include/mruby/array.h index 34b8cdcfa..16f78f773 100644 --- a/include/mruby/array.h +++ b/include/mruby/array.h @@ -107,7 +107,7 @@ MRB_API mrb_value mrb_ary_new(mrb_state *mrb); * Array[value1, value2, ...] * * @param mrb The mruby state reference. - * @param size The numer of values. + * @param size The number of values. * @param vals The actual values. * @return The initialized array. */ diff --git a/mrbgems/mruby-bin-debugger/bintest/print.rb b/mrbgems/mruby-bin-debugger/bintest/print.rb index 4a4339f5a..63ebded3e 100644 --- a/mrbgems/mruby-bin-debugger/bintest/print.rb +++ b/mrbgems/mruby-bin-debugger/bintest/print.rb @@ -264,7 +264,7 @@ SRC BinTest_MrubyBinDebugger.test(src, tc) end -assert('mruby-bin-debugger(print) same name:instance variabe') do +assert('mruby-bin-debugger(print) same name:instance variable') do # ruby source (bp is break point) src = <<"SRC" @iv = 'top' @@ -296,7 +296,7 @@ SRC BinTest_MrubyBinDebugger.test(src, tc) end -# Kernel#instance_eval(string) does't work const. +# Kernel#instance_eval(string) doesn't work const. =begin assert('mruby-bin-debugger(print) same name:const') do # ruby source (bp is break point) diff --git a/mrbgems/mruby-cmath/mrbgem.rake b/mrbgems/mruby-cmath/mrbgem.rake index e00725fef..00ac4b091 100644 --- a/mrbgems/mruby-cmath/mrbgem.rake +++ b/mrbgems/mruby-cmath/mrbgem.rake @@ -1,5 +1,5 @@ # This `mruby-cmath` gem uses C99 _Complex features -# You need C compler that support C99+ +# You need C compiler that support C99+ MRuby::Gem::Specification.new('mruby-cmath') do |spec| spec.license = 'MIT' spec.author = 'mruby developers' diff --git a/mrbgems/mruby-cmath/src/cmath.c b/mrbgems/mruby-cmath/src/cmath.c index 8e94d1563..03b181840 100644 --- a/mrbgems/mruby-cmath/src/cmath.c +++ b/mrbgems/mruby-cmath/src/cmath.c @@ -6,7 +6,7 @@ /* ** This `mruby-cmath` gem uses C99 _Complex features -** You need C compler that support C99+ +** You need C compiler that support C99+ */ #include <mruby.h> diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 56b9bb38a..1a07cc14b 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -1450,7 +1450,7 @@ heredoc_end(parser_state *p) %token <nd> tSTRING tSTRING_PART tSTRING_MID %token <nd> tNTH_REF tBACK_REF %token <num> tREGEXP_END -%token <num> tNUMPARAM "numbered paraemeter" +%token <num> tNUMPARAM "numbered parameter" %type <nd> singleton string string_fragment string_rep string_interp xstring regexp %type <nd> literal numeric cpath symbol defn_head defs_head diff --git a/mrbgems/mruby-compiler/core/y.tab.c b/mrbgems/mruby-compiler/core/y.tab.c index 0ba1c8d7f..3e5c6e116 100644 --- a/mrbgems/mruby-compiler/core/y.tab.c +++ b/mrbgems/mruby-compiler/core/y.tab.c @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -2085,7 +2085,7 @@ static const char *const yytname[] = "\"constant\"", "\"class variable\"", "\"label\"", "\"integer literal\"", "\"float literal\"", "\"character literal\"", "tXSTRING", "tREGEXP", "tSTRING", "tSTRING_PART", "tSTRING_MID", "tNTH_REF", "tBACK_REF", - "tREGEXP_END", "\"numbered paraemeter\"", "\"unary plus\"", + "tREGEXP_END", "\"numbered parameter\"", "\"unary plus\"", "\"unary minus\"", "\"<=>\"", "\"==\"", "\"===\"", "\"!=\"", "\">=\"", "\"<=\"", "\"&&\"", "\"||\"", "\"=~\"", "\"!~\"", "\"..\"", "\"...\"", "tBDOT2", "tBDOT3", "tAREF", "tASET", "\"<<\"", "\">>\"", "\"::\"", diff --git a/src/array.c b/src/array.c index a66ff8183..8ab30bd8e 100644 --- a/src/array.c +++ b/src/array.c @@ -56,18 +56,17 @@ mrb_ary_new(mrb_state *mrb) } /* - * to copy array, use this instead of memcpy because of portability + * To copy array, use this instead of memcpy because of portability * * gcc on ARM may fail optimization of memcpy - * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3934.html + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56620 * * gcc on MIPS also fail - * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39755 + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39755 * * memcpy doesn't exist on freestanding environment * * If you optimize for binary size, use memcpy instead of this at your own risk * of above portability issue. * - * see also http://togetter.com/li/462898 - * + * See also https://togetter.com/li/462898 (Japanese) */ static inline void array_copy(mrb_value *dst, const mrb_value *src, mrb_int size) @@ -1022,7 +1022,7 @@ mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *pc) const struct mrb_irep_catch_handler *ch; #ifdef DIRECT_THREADED - static void *optable[] = { + static const void * const optable[] = { #define OPCODE(x,_) &&L_OP_ ## x, #include "mruby/ops.h" #undef OPCODE diff --git a/test/check-for-trailing-whitespace.sh b/test/check-for-trailing-whitespace.sh deleted file mode 100755 index 00be038f3..000000000 --- a/test/check-for-trailing-whitespace.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -cd .. || exit -# print first -grep -EHInr '( +)$' ./* - -var=$(grep -EHInr '( +)$' ./*) -# then exit with fail if found -if test -z "$var"; then - exit 0 -else - exit 1 -fi |
