From: Junio C Hamano <gitster@pobox.com>
To: Sergius Nyah <sergiusnyah@gmail.com>
Cc: git@vger.kernel.org, christian.couder@gmail.com, pk@pks.im
Subject: Re: [GSOC][PATCH v2]userdiff: improve code quality and add JavaScript language driver.
Date: Tue, 19 Mar 2024 14:02:10 -0700 [thread overview]
Message-ID: <xmqqh6h2lyul.fsf@gitster.g> (raw)
In-Reply-To: <20240319101000.76767-1-sergiusnyah@gmail.com> (Sergius Nyah's message of "Tue, 19 Mar 2024 11:10:00 +0100")
Sergius Nyah <sergiusnyah@gmail.com> writes:
> This commit introduces several improvements to the codebase:
>
> - replace the use of `test_i18ngrep` with `test_grep` in
> `t/t4018-diff-funcname.sh` for better pattern matching and improved
> performance.
> - add a JavaScript language driver to enhance the functionality of the
> application.
> - clean up the code by removing trailing whitespaces and fix multiline
> comments in `t/t4034-diff-words.sh` and `userdiff.c`.
Doing too many unrelated things that may appear semi-related only
because they are about the same files? Don't.
>
> Signed-off-by: Sergius Nyah <sergiusnyah@gmail.com>
> ---
> t/t4018-diff-funcname.sh | 14 +++++++-------
> t/t4034-diff-words.sh | 1 +
> userdiff.c | 23 ++++++++++++-----------
> 3 files changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
> index d35cce18a0..e6d2f1c215 100755
> --- a/t/t4018-diff-funcname.sh
> +++ b/t/t4018-diff-funcname.sh
> @@ -119,8 +119,6 @@ do
> "
> done
>
> -test_done
> -
> test_expect_success 'identify builtin patterns in JavaScript' '
> # setup
> echo "function myFunction() { return true; }" > test.js &&
> @@ -136,9 +134,11 @@ test_expect_success 'identify builtin patterns in JavaScript' '
> git diff >output &&
>
> # check results
> - test_i18ngrep "function myFunction() { return true; }" output &&
> - test_i18ngrep "function myFunction() { return false; }" output &&
> - test_i18ngrep "var myVar = function() { return false; }" output &&
> - test_i18ngrep "var myVar = function() { return true; }" output
> + test_grep "function myFunction() { return true; }" output &&
> + test_grep "function myFunction() { return false; }" output &&
> + test_grep "var myVar = function() { return false; }" output &&
> + test_grep "var myVar = function() { return true; }" output
> '
> -test_done
> \ No newline at end of file
> +
> +test_done
> +
To which version of Git source code are the above hunks meant to
apply? Hopefully we do not have a test that says "test_done"
followed by another "test_expect_success" in our tree.
> diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
> index 74586f3813..cf2374af2c 100755
> --- a/t/t4034-diff-words.sh
> +++ b/t/t4034-diff-words.sh
> @@ -328,6 +328,7 @@ test_language_driver dts
> test_language_driver fortran
> test_language_driver html
> test_language_driver java
> +test_language_driver javascript
> test_language_driver kotlin
> test_language_driver matlab
> test_language_driver objc
It is unclear what "clean-up" was done to this file, as claimed in
the proposed log message. Puzzled...
> diff --git a/userdiff.c b/userdiff.c
> index bbe2bcb9a3..15342c8662 100644
> --- a/userdiff.c
> +++ b/userdiff.c
>
> PATTERNS("javascript",
> - /* Looks for lines that start with optional whitespace, followed
> - * by 'function'* and any characters (for function declarations),
> - * or valid JavaScript identifiers, equals sign '=', 'function' keyword
> - * and any characters (for function expressions).
> - * Also considers functions defined inside blocks with '{...}'.
> - */
> - "^[ \t]*(function[ \t]*.*|[a-zA-Z_$][0-9a-zA-Z_$]*[ \t]*=[ \t]*function[ \t]*.*|(\\{[ \t]*)?)\n",
> - /* This pattern matches JavaScript identifiers */
> - "[a-zA-Z_$][0-9a-zA-Z_$]*"
> - "|[-+0-9.eE]+|0[xX][0-9a-fA-F]+"
> - "|[-+*/<>%&^|=!:]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\|"),
> + /*
> + * Look for lines that start with optional whitespace, followed
> + * by 'function' and any characters (for function declarations),
> + * or valid JavaScript identifiers, equals sign '=', 'function' keyword
> + * and any characters (for function expressions).
> + * Also consider functions defined inside blocks with '{...}'.
> + */
> + "^[ \t]*(function[ \t]*.*|[a-zA-Z_$][0-9a-zA-Z_$]*[ \t]*=[ \t]*function[ \t]*.*|(\\{[ \t]*)?)\n",
> + /* Match JavaScript identifiers with this pattern */
> + "[a-zA-Z_$][0-9a-zA-Z_$]*"
> + "|[-+0-9.eE]+|0[xX][0-9a-fA-F]+"
> + "|[-+*/<>%&^|=!:]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\|"),
I do not see trailing whitespaces getting fixed, as claimed in the
proposed log message. Puzzled, again...
prev parent reply other threads:[~2024-03-19 21:02 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 19:55 [GSOC][RFC] Add more builtin patterns for userdiff, as Mircroproject Sergius Nyah
2024-01-10 11:33 ` Christian Couder
[not found] ` <CANAnif90Bqp2pWCn_71t-Fss6wspo+==vMdYsX+Wt5m=4Ocpng@mail.gmail.com>
[not found] ` <CAP8UFD0ELy2WegVYdxi_O5UpHS4MyOPp4tuAQK+XvvNmABc2ZA@mail.gmail.com>
[not found] ` <CAP8UFD3e=Zv2wkx5tswCz05Vwn3vD68Vw-TD6SoENWK+norYsw@mail.gmail.com>
2024-01-11 14:23 ` Fwd: " Sergius Nyah
2024-01-11 15:11 ` Christian Couder
2024-01-11 15:42 ` Sergius Nyah
2024-02-27 14:19 ` [GSOC][PATCH 0/2] Add builtin patterns for userdiff in JavaScript, as Microproject Sergius Nyah
2024-02-27 14:19 ` [PATCH 1/2] Subject: [GSOC][RFC PATCH 1/2] Add builtin patterns for JavaScript function detection in userdiff Sergius Nyah
2024-02-27 14:19 ` [PATCH 2/2] Subject:[GSOC] [RFC PATCH 2/2] Add test for JavaScript function detection in Git diffs Sergius Nyah
2024-02-27 14:21 ` [GSOC][PATCH 0/2] Add builtin patterns for userdiff in JavaScript, as Microproject Sergius Nyah
2024-02-27 14:21 ` [PATCH 1/2] Subject: [GSOC][RFC PATCH 1/2] Add builtin patterns for JavaScript function detection in userdiff Sergius Nyah
2024-02-27 14:21 ` [PATCH 2/2] Subject:[GSOC] [RFC PATCH 2/2] Add test for JavaScript function detection in Git diffs Sergius Nyah
2024-02-27 14:25 ` [GSOC][PATCH 0/2] Add builtin patterns for userdiff in JavaScript, as Microproject Sergius Nyah
2024-02-27 14:25 ` [PATCH 1/2] Subject: [GSOC][RFC PATCH 1/2] Add builtin patterns for JavaScript function detection in userdiff Sergius Nyah
2024-02-27 14:25 ` [PATCH 2/2] Subject:[GSOC] [RFC PATCH 2/2] Add test for JavaScript function detection in Git diffs Sergius Nyah
2024-02-27 16:02 ` [GSOC][PATCH 0/2] Add builtin patterns for userdiff in JavaScript, as Microproject Sergius Nyah
2024-02-27 16:02 ` [PATCH 1/2] Subject: [GSOC][RFC PATCH 1/2] Add builtin patterns for JavaScript function detection in userdiff Sergius Nyah
2024-02-27 19:06 ` Ghanshyam Thakkar
2024-02-27 21:05 ` Sergius Nyah
2024-02-27 16:02 ` [PATCH 2/2] Subject:[GSOC] [RFC PATCH 2/2] Add test for JavaScript function detection in Git diffs Sergius Nyah
2024-02-28 15:00 ` [GSOC][PATCH] Userdiff: add builtin patterns for JavaScript Sergius Nyah
2024-02-28 18:19 ` Junio C Hamano
2024-02-29 10:11 ` [GSOC][PATCH] userdiff: " Sergius Nyah
2024-02-29 12:01 ` Ghanshyam Thakkar
2024-03-01 7:40 ` [GSOC][PATCH] userdiff: Add JavaScript function patterns Sergius Nyah
2024-03-02 10:28 ` Christian Couder
2024-03-02 10:54 ` Christian Couder
2024-03-02 17:13 ` Junio C Hamano
2024-03-04 9:04 ` Patrick Steinhardt
2024-03-12 13:14 ` [GSOC][PATCH v2 1/3]t4018-diff-funcname: use test_grep instead of test_i18ngrep Sergius Nyah
2024-03-12 13:14 ` [GSOC][PATCH v2 2/3]t4034-diff-words: add javascript language driver Sergius Nyah
2024-03-12 13:14 ` [GSOC][PATCH v2 3/3]userdiff: remove trailing whitespaces, fix multiline comments Sergius Nyah
2024-03-19 10:10 ` [GSOC][PATCH v2]userdiff: improve code quality and add JavaScript language driver Sergius Nyah
2024-03-19 21:02 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqh6h2lyul.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=pk@pks.im \
--cc=sergiusnyah@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).