From 6ccc77f6a2bde854dabdbf52beace4f836407c90 Mon Sep 17 00:00:00 2001 From: AlexHaxe Date: Sat, 18 Apr 2020 01:38:28 +0200 Subject: [PATCH] fixed a NPE in tokentree (#584) * fixed a NPE in tokentree * updated README --- .gitignore | 5 +++-- CHANGELOG.md | 4 ++++ README.md | 4 +++- haxe3_libraries/tokentree.hxml | 6 +++--- haxe_libraries/tokentree.hxml | 6 +++--- haxelib.json | 4 ++-- package-lock.json | 2 +- package.json | 2 +- src/formatter/marker/Indenter.hx | 1 - .../other/private_final_class.hxtest | 20 +++++++++++++++++++ 10 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 test/testcases/other/private_final_class.hxtest diff --git a/.gitignore b/.gitignore index 67b3956f..3444b0bb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,10 +11,11 @@ *.zip .haxelib/ out/ -node_modules -.DS_Store +node_modules/ log/ +dump/ target/ +haxe3/ callgrind.* ./debug lcov.info diff --git a/CHANGELOG.md b/CHANGELOG.md index e99a8dfd..77e5612c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## dev branch / next version (1.x.x) +## version 1.10.2 (2020-04-18) + +- Fixed a null pointer exception in tokentree ([#584](https://github.com/HaxeCheckstyle/haxe-formatter/issues/584)) + ## version 1.10.1 (2020-04-12) - Fixed broken indentation after case with OpOr pattern, fixes [#576](https://github.com/HaxeCheckstyle/haxe-formatter/issues/576) ([#581](https://github.com/HaxeCheckstyle/haxe-formatter/issues/581)) diff --git a/README.md b/README.md index a2f685c6..b036aa3f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Haxelib Version](https://img.shields.io/github/tag/HaxeCheckstyle/haxe-formatter.svg?label=haxelib)](http://lib.haxe.org/p/formatter) [![Build Status](https://travis-ci.org/HaxeCheckstyle/haxe-formatter.svg?branch=master)](https://travis-ci.org/HaxeCheckstyle/haxe-formatter) -[![Haxe-Formatter Linux](https://github.com/HaxeCheckstyle/haxe-formatter/workflows/Haxe-Formatter%20Linux/badge.svg)](https://github.com/HaxeCheckstyle/haxe-formatter/actions) +[![Haxe-Formatter](https://github.com/HaxeCheckstyle/haxe-formatter/workflows/Haxe-Formatter/badge.svg)](https://github.com/HaxeCheckstyle/haxe-formatter/actions) [![codecov](https://codecov.io/gh/HaxeCheckstyle/haxe-formatter/branch/master/graph/badge.svg)](https://codecov.io/gh/HaxeCheckstyle/haxe-formatter) [![Gitter chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/HaxeCheckstyle/haxe-formatter) @@ -74,6 +74,8 @@ Sample call: `haxelib run formatter --stdin -s src/Main.hx < /tmp/code.txt > src Formatter uses `hxformat.json` files for configuration. It searches for a `hxformat.json` file closest to the file being formatted, starting with the file's folder and moving upward all the way to your root folder. A configuration file in a subfolder will always overwrite any settings from a top or higher level folder. +You can test different configuration settings in our [Formatter code samples / playground / documentation](https://haxecheckstyle.github.io/haxe-formatter-docs/#codesamples.CommonSamples.allman_curlies) website. + The VSCode extension comes with a JSON schema providing completion and limited documentation for edition `hxformat.json` files: ![JSON schema for hxformat.json in VSCode](resources/schema.png) diff --git a/haxe3_libraries/tokentree.hxml b/haxe3_libraries/tokentree.hxml index 77727f9a..68180720 100644 --- a/haxe3_libraries/tokentree.hxml +++ b/haxe3_libraries/tokentree.hxml @@ -1,3 +1,3 @@ -# @install: lix --silent download "haxelib:/tokentree#1.0.26" into tokentree/1.0.26/haxelib --cp ${HAXE_LIBCACHE}/tokentree/1.0.26/haxelib/src --D tokentree=1.0.26 +# @install: lix --silent download "haxelib:/tokentree#1.0.27" into tokentree/1.0.27/haxelib +-cp ${HAXE_LIBCACHE}/tokentree/1.0.27/haxelib/src +-D tokentree=1.0.27 diff --git a/haxe_libraries/tokentree.hxml b/haxe_libraries/tokentree.hxml index 77727f9a..68180720 100644 --- a/haxe_libraries/tokentree.hxml +++ b/haxe_libraries/tokentree.hxml @@ -1,3 +1,3 @@ -# @install: lix --silent download "haxelib:/tokentree#1.0.26" into tokentree/1.0.26/haxelib --cp ${HAXE_LIBCACHE}/tokentree/1.0.26/haxelib/src --D tokentree=1.0.26 +# @install: lix --silent download "haxelib:/tokentree#1.0.27" into tokentree/1.0.27/haxelib +-cp ${HAXE_LIBCACHE}/tokentree/1.0.27/haxelib/src +-D tokentree=1.0.27 diff --git a/haxelib.json b/haxelib.json index 42bc0cc3..4b463226 100644 --- a/haxelib.json +++ b/haxelib.json @@ -8,8 +8,8 @@ "style" ], "description": "A code formatter for Haxe", - "version": "1.10.1", - "releasenote": "fixed some regressions of 1.10.0 - see CHANGELOG for details.", + "version": "1.10.2", + "releasenote": "fixed a null pointer exception in tokentree - see CHANGELOG for details.", "contributors": [ "AlexHaxe", "Gama11" diff --git a/package-lock.json b/package-lock.json index cb7747f6..ecd94f33 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "haxe-formatter", - "version": "1.10.1", + "version": "1.10.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 92cbf5d7..41224ce3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "haxe-formatter", - "version": "1.10.1", + "version": "1.10.2", "description": "A code formatter for Haxe", "repository": { "type": "git", diff --git a/src/formatter/marker/Indenter.hx b/src/formatter/marker/Indenter.hx index 7785961f..d05500a2 100644 --- a/src/formatter/marker/Indenter.hx +++ b/src/formatter/marker/Indenter.hx @@ -1,6 +1,5 @@ package formatter.marker; -import formatter.config.Config; import formatter.config.IndentationConfig; #if debugIndent import sys.io.File; diff --git a/test/testcases/other/private_final_class.hxtest b/test/testcases/other/private_final_class.hxtest new file mode 100644 index 00000000..ecf77980 --- /dev/null +++ b/test/testcases/other/private_final_class.hxtest @@ -0,0 +1,20 @@ +{ + "emptyLines": { + "maxAnywhereInFile": 0 + } +} + +--- + +package; +private final class Test { + public function new() { + } +} + +--- + +package; +private final class Test { + public function new() {} +}