nit.git
4 years agocontracts: fix usage of contract with `--erasure`
Florian Deljarry [Tue, 1 Oct 2019 19:37:52 +0000 (15:37 -0400)]
contracts: fix usage of contract with `--erasure`

Moving the check if a contract is needed in the visitor to avoid the property creation without definition.

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agotests: Add tests for generic and virtual types
Florian Deljarry [Mon, 30 Sep 2019 15:48:33 +0000 (11:48 -0400)]
tests: Add tests for generic and virtual types

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agosrc/contracts: Fix contracts on virtual and generic type
Florian Deljarry [Mon, 30 Sep 2019 02:17:53 +0000 (22:17 -0400)]
src/contracts: Fix contracts on virtual and generic type

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agosrc/toolcontext: Provide contract options
Florian Deljarry [Wed, 29 May 2019 20:49:55 +0000 (16:49 -0400)]
src/toolcontext: Provide contract options

`--no-contract` option to disable the contracts usage
`--full-contract` option to enable the contracts usage in all classes

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agoshare/man/nitc: Adding the man explication to disable contracts
Florian Deljarry [Wed, 29 May 2019 20:04:06 +0000 (16:04 -0400)]
share/man/nitc: Adding the man explication to disable contracts

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agocontracts: Adding all contract generation mechanism
Florian Deljarry [Fri, 19 Apr 2019 21:41:23 +0000 (17:41 -0400)]
contracts: Adding all contract generation mechanism

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agotests: adding contract testing files
Florian Deljarry [Sat, 27 Apr 2019 21:46:35 +0000 (17:46 -0400)]
tests: adding contract testing files

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agocheck_annotation: adding no_contract
Florian Deljarry [Sun, 26 May 2019 17:17:09 +0000 (13:17 -0400)]
check_annotation: adding no_contract

Adding option to remove contract on a specific annotated method

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agocheck_annotation: Adding ensures annotation
Florian Deljarry [Thu, 25 Apr 2019 20:24:03 +0000 (16:24 -0400)]
check_annotation: Adding ensures annotation

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agocheck_annotation: Adding expects annotation
Florian Deljarry [Fri, 19 Apr 2019 21:39:24 +0000 (17:39 -0400)]
check_annotation: Adding expects annotation

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agocode_gen: Adding contracts phase
Florian Deljarry [Fri, 19 Apr 2019 21:38:42 +0000 (17:38 -0400)]
code_gen: Adding contracts phase

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agoscope: Adding variable verification
Florian Deljarry [Fri, 19 Apr 2019 21:32:27 +0000 (17:32 -0400)]
scope: Adding variable verification

If the variable already exists it will be used

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

4 years agomodelize_property: Adding unsafe method to register an mpropdef
Florian Deljarry [Fri, 19 Apr 2019 21:25:02 +0000 (17:25 -0400)]
modelize_property: Adding unsafe method to register an mpropdef

Add method to register an MPropDef with an APropdef without verification

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

5 years agoMoving the astvalidation module in astbuilder
Florian Deljarry [Wed, 27 Feb 2019 16:31:02 +0000 (11:31 -0500)]
Moving the astvalidation module in astbuilder

Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

5 years agoMerge: Ci more
Jean Privat [Fri, 22 Feb 2019 19:38:03 +0000 (14:38 -0500)]
Merge: Ci more

some fix up and improvements on gitlab-ci

Pull-Request: #2738

5 years agoci-gitlab: contrib android-release (but not signed)
Jean Privat [Fri, 22 Feb 2019 04:19:24 +0000 (23:19 -0500)]
ci-gitlab: contrib android-release (but not signed)

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: remove remaining allow_failure
Jean Privat [Fri, 22 Feb 2019 04:16:26 +0000 (23:16 -0500)]
gitlab-ci: remove remaining allow_failure

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agoci: do not run nitc with `--colors-are-symbols`: it seems broken
Jean Privat [Fri, 22 Feb 2019 04:14:40 +0000 (23:14 -0500)]
ci: do not run nitc with `--colors-are-symbols`: it seems broken

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: inject key for github.oauthtoken
Jean Privat [Wed, 20 Feb 2019 15:51:40 +0000 (10:51 -0500)]
gitlab-ci: inject key for github.oauthtoken

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: do not test in `build_tools`
Jean Privat [Wed, 20 Feb 2019 15:51:12 +0000 (10:51 -0500)]
gitlab-ci: do not test in `build_tools`

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agoci: dont fail on empty check_signedoff_list
Jean Privat [Wed, 20 Feb 2019 01:10:47 +0000 (20:10 -0500)]
ci: dont fail on empty check_signedoff_list

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agoMerge: Ci: move services to specific hostnames
Jean Privat [Thu, 21 Feb 2019 23:38:28 +0000 (18:38 -0500)]
Merge: Ci: move services to specific hostnames

Testing nit with various services is a PITA.

The previous solution was to test them on localhost and requires that the services are available and configured on each test node (it is not always as easy as it seems).
Another problem with `localhost` is that testing within docker is complex as running multiple services in a single container is discouraged.

Here, we propose to simply move the service from localhost to specific hostnames.
This is to be the current "good" practice and is supported out-of-the-box bu various CI infrastructure including gitlab-ci.

Pull-Request: #2737

5 years agoMerge: gitlab-ci: add android
Jean Privat [Thu, 21 Feb 2019 23:38:03 +0000 (18:38 -0500)]
Merge: gitlab-ci: add android

Add android test and build to gitlab-ci. This also fixes some issues.

Note: the version of the android tools are not the most recent. Trying to update the android toolchain to a more modern one should be done in another PR.

Prof of concept: https://gitlab.com/nit/nit-ci/-/jobs/164255403/artifacts/browse/apk/

Pull-Request: #2736

5 years agoMerge: curl: fix concurrent requests and intro shortcut services for scripts
Jean Privat [Thu, 21 Feb 2019 23:38:01 +0000 (18:38 -0500)]
Merge: curl: fix concurrent requests and intro shortcut services for scripts

This PR brings 2 main changes:

* The handle to a Curl request is now kept by the `CurlRequest` instances, instead of being shared by all requests. This makes it possible to execute concurrent HTTP requests.

* Intro two new services on `Text` to execute simple HTTP requests. While these new services are useful to simple scripts, if more control is needed you should still use `CurlHTTPRequest`.

  `Text::http_get` makes a GET request and returns the response body.

  `Text::http_download` makes a GET request and saves the response body to a file.

Pull-Request: #2731
Reviewed-by: Jean Privat <jean@pryen.org>

5 years agodocker/ci: need netcat and killall for some test scripts
Jean Privat [Wed, 20 Feb 2019 15:44:40 +0000 (10:44 -0500)]
docker/ci: need netcat and killall for some test scripts

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agodocker/ci: do not need postgresql server
Jean Privat [Wed, 20 Feb 2019 15:44:12 +0000 (10:44 -0500)]
docker/ci: do not need postgresql server

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agoci: propose a docker-compose to handle services tests locally
Jean Privat [Wed, 20 Feb 2019 13:45:19 +0000 (08:45 -0500)]
ci: propose a docker-compose to handle services tests locally

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: enable neo4j
Jean Privat [Wed, 20 Feb 2019 03:39:10 +0000 (22:39 -0500)]
gitlab-ci: enable neo4j

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: enable postgres
Jean Privat [Wed, 20 Feb 2019 03:17:40 +0000 (22:17 -0500)]
gitlab-ci: enable postgres

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: add mongo as service
Jean Privat [Wed, 20 Feb 2019 02:41:42 +0000 (21:41 -0500)]
gitlab-ci: add mongo as service

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: enable mongo
Jean Privat [Wed, 20 Feb 2019 02:39:57 +0000 (21:39 -0500)]
gitlab-ci: enable mongo

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agomongo: use `mongo` instead of `localhost` by default
Jean Privat [Wed, 20 Feb 2019 02:39:33 +0000 (21:39 -0500)]
mongo: use `mongo` instead of `localhost` by default

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: contrib android
Jean Privat [Wed, 20 Feb 2019 00:42:36 +0000 (19:42 -0500)]
gitlab-ci: contrib android

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: add .gradle to the cache
Jean Privat [Tue, 19 Feb 2019 20:30:35 +0000 (15:30 -0500)]
gitlab-ci: add .gradle to the cache

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab-ci: don't abort if grep select nothing
Jean Privat [Tue, 19 Feb 2019 20:17:42 +0000 (15:17 -0500)]
gitlab-ci: don't abort if grep select nothing

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab_ci: basic test for android
Jean Privat [Tue, 19 Feb 2019 19:59:34 +0000 (14:59 -0500)]
gitlab_ci: basic test for android

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agoantroid/README.md: add raw (for nitunit)
Jean Privat [Tue, 19 Feb 2019 21:02:24 +0000 (16:02 -0500)]
antroid/README.md: add raw (for nitunit)

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agogitlab_ci: unblacklist android
Jean Privat [Tue, 19 Feb 2019 19:59:17 +0000 (14:59 -0500)]
gitlab_ci: unblacklist android

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agodocker/nit-ci: add imagemagick
Jean Privat [Wed, 20 Feb 2019 01:29:36 +0000 (20:29 -0500)]
docker/nit-ci: add imagemagick

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agodocker/ci: install android sdk&ndk
Jean Privat [Tue, 19 Feb 2019 19:56:16 +0000 (14:56 -0500)]
docker/ci: install android sdk&ndk

Note: android-ndk is downloaded in the google archive

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agoandroid-bdwgc: remove --depth=1 to avoid missing commits
Jean Privat [Tue, 19 Feb 2019 19:55:19 +0000 (14:55 -0500)]
android-bdwgc: remove --depth=1 to avoid missing commits

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agoMerge: tests.sh: special case when running in gitlab_ci
Jean Privat [Mon, 18 Feb 2019 16:26:57 +0000 (11:26 -0500)]
Merge: tests.sh: special case when running in gitlab_ci

When run is a containerized environment, some tests may behave differently.
This prepares some special cases for them.

Cf #2732

Pull-Request: #2735

5 years agoMerge: lib&contrib: add some raw and nitish in READMEs
Jean Privat [Mon, 18 Feb 2019 16:26:54 +0000 (11:26 -0500)]
Merge: lib&contrib: add some raw and nitish in READMEs

nitunit in jenkins did not test READMEs (cf #2313)
In order to test them, first fix them!

Pull-Request: #2734

5 years agoMerge: tests/base_autocast: workaround a gcc bug
Jean Privat [Mon, 18 Feb 2019 16:26:50 +0000 (11:26 -0500)]
Merge: tests/base_autocast: workaround a gcc bug

Versions of gcc between bellow 6.4.1 and 7.3.1 failed to compile
correctly the generated C.
So this changes the Nit, so the C can be compiled with buggy gcc versions.

Cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85244 for details

Pull-Request: #2733

5 years agoMerge: docker: add image for continuous integration (without nit)
Jean Privat [Mon, 18 Feb 2019 16:26:44 +0000 (11:26 -0500)]
Merge: docker: add image for continuous integration (without nit)

This prepares a new image that we will use for continuous integration.

Basically, it is a lot of stuff required by tests, libs and contribs of nit, but without nit

Pull-Request: #2732

5 years agoMerge: Makefile: fix make clean
Jean Privat [Mon, 18 Feb 2019 16:25:11 +0000 (11:25 -0500)]
Merge: Makefile: fix make clean

make clean errors out without cleaning everything. Fixes the make file to use rm -f when appropriate and -cmd otherwise.
Added cleaned message at the end to show it completed successfully (otherwise it ends in what can seem like an error message at first glance).
Signed-off-by: Hugo Leblanc <dullin@hololink.org>

Pull-Request: #2730
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agoMerge: lib/core: handling of plus (+) sign when using to_i with Text objects
Jean Privat [Mon, 18 Feb 2019 16:25:04 +0000 (11:25 -0500)]
Merge: lib/core: handling of plus (+) sign when using to_i with Text objects

While doing the Advent of Code 2018 in Nit, I encountered a file with numbers prefaced with a plus (+) sign. The to_i of Text wasn't able to handle that kind of input so I added it.

The PR add handling of prefacing + signs with the current - sign implementation. Also added the same logic to is_int so that assert can work. Added new tests in the documentation to show normal usage.

Signed-off-by: Hugo Leblanc <dullin@hololink.org>

Pull-Request: #2729
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolib: add some nitish to avoid service configuration issues
Jean Privat [Mon, 18 Feb 2019 15:56:02 +0000 (10:56 -0500)]
lib: add some nitish to avoid service configuration issues

docunits should not require specifics like a token or a server

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agotests.sh: special case when running in gitlab_ci
Jean Privat [Mon, 18 Feb 2019 15:41:34 +0000 (10:41 -0500)]
tests.sh: special case when running in gitlab_ci

When run is a containerized environment, some tests may behave differently.
This prepares some special cases for them.

Cf #2732

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agotests/base_autocast: workaround a gcc bug
Jean Privat [Mon, 18 Feb 2019 15:29:01 +0000 (10:29 -0500)]
tests/base_autocast: workaround a gcc bug

Versions of gcc between bellow 6.4.1 and 7.3.1 failed to compile
correctly the generated C.
So this changes the Nit, so the C can be compiled with buggy gcc versions.

Cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85244 for details

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agolib&contrib: add some raw and nitish in READMEs
Jean Privat [Mon, 18 Feb 2019 15:20:38 +0000 (10:20 -0500)]
lib&contrib: add some raw and nitish in READMEs

nitunit in jenkins did not test READMEs (cf #2313)
In order to test them, first fix them!

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agoadd .gitlab-ci.yml
Jean Privat [Mon, 18 Feb 2019 15:06:21 +0000 (10:06 -0500)]
add .gitlab-ci.yml

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agodocker: add image for continuous integration (without nit)
Jean Privat [Mon, 18 Feb 2019 14:54:25 +0000 (09:54 -0500)]
docker: add image for continuous integration (without nit)

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agocurl: update test for latest changes
Alexis Laferrière [Fri, 15 Feb 2019 13:10:06 +0000 (08:10 -0500)]
curl: update test for latest changes

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agoneo4j: remove unused curl handle (using a now private class)
Alexis Laferrière [Fri, 15 Feb 2019 13:09:21 +0000 (08:09 -0500)]
neo4j: remove unused curl handle (using a now private class)

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agopopcorn: there's no more a global curl handle, so this should be fixed
Alexis Laferrière [Fri, 15 Feb 2019 13:08:38 +0000 (08:08 -0500)]
popcorn: there's no more a global curl handle, so this should be fixed

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agocurl: intro shortcut methods `http_get` and `http_download` on `Text`
Alexis Laferrière [Sat, 12 Jan 2019 04:12:50 +0000 (23:12 -0500)]
curl: intro shortcut methods `http_get` and `http_download` on `Text`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agocurl: the libcurl handle is initiated once per request object, closed by GC or hand
Alexis Laferrière [Sat, 12 Jan 2019 04:12:10 +0000 (23:12 -0500)]
curl: the libcurl handle is initiated once per request object, closed by GC or hand

This should fix the problem with concurrent HTTP requests on different threads.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agocurl: add some more doc
Alexis Laferrière [Sat, 26 Jan 2019 20:04:41 +0000 (12:04 -0800)]
curl: add some more doc

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agocompiler: fix make clean for makefile generation
Hugo Leblanc [Thu, 3 Jan 2019 22:22:08 +0000 (17:22 -0500)]
compiler: fix make clean for makefile generation

Add -f option to rm so that the clean doesn't error if the files are absent
Signed-off-by: Hugo Leblanc <dullin@hololink.org>

5 years agoMakefile: fix make clean
Hugo Leblanc [Fri, 28 Dec 2018 17:49:05 +0000 (12:49 -0500)]
Makefile: fix make clean

make clean errors out without cleaning everything. Fixes the make file to use rm -f when appropriate and -cmd otherwise.
Added cleaned message at the end to show it completed successfully (otherwise it ends in what can seem like an error message at first glance).
Signed-off-by: Hugo Leblanc <dullin@hololink.org>

5 years agolib/core: handling of plus (+) sign when using to_i with Text objects
Hugo Leblanc [Fri, 28 Dec 2018 17:27:50 +0000 (12:27 -0500)]
lib/core: handling of plus (+) sign when using to_i with Text objects

Signed-off-by: Hugo Leblanc <dullin@hololink.org>

5 years agopostmerge: fix error_class_glob.res
Jean Privat [Tue, 14 Aug 2018 12:59:52 +0000 (08:59 -0400)]
postmerge: fix error_class_glob.res

Signed-off-by: Jean Privat <jean@pryen.org>

5 years agoMerge: src/model/model_index: model index uses BKTree
Jean Privat [Mon, 13 Aug 2018 19:25:30 +0000 (15:25 -0400)]
Merge: src/model/model_index: model index uses BKTree

This PR makes ModelIndex use a BKTree (#2718) to speed up Nitweb name similarity search queries on large code corpora.

Levenstein names comparison with 300k+ entities took a bit long (up to 10s for Nitweb with `contrib` and `src` for some queries). The use of BKTree speeds things up and brings those queries under 0.1s.

Pull-Request: #2724
Reviewed-by: Jean Privat <jean@pryen.org>

5 years agoMerge: libevent: support UNIX domain sockets and add a test and an example
Jean Privat [Mon, 13 Aug 2018 19:24:43 +0000 (15:24 -0400)]
Merge: libevent: support UNIX domain sockets and add a test and an example

Libevent server can now listen on UNIX domain sockets by calling `ConnectionFactory::bind_unix`. The method to listen on TCP ports was renamed to `bind_tcp` for clarity.

This PR intro two new supporting programs in the form of a parallel test for a libevent server and a minimal usage example. If we already had these let me know, because otherwise these two were long overdue.

This PR is built on the work of @matthmsl in #2708, thank you!

Close #2679

Pull-Request: #2726

5 years agoMerge: nitunit: Use markdown2
Jean Privat [Mon, 13 Aug 2018 19:24:41 +0000 (15:24 -0400)]
Merge: nitunit: Use markdown2

This PR makes nitunit use the new `markdown2` parser.

Changes:
* clean the warnings in `test_doc`
* migrate `nitunit` to `markdown2`
* fix some tests about indented Nit code blocks according to the CommonMark spec
* fix some tests about error location

This PR should close the bug signaled in #1394.

Pull-Request: #2725

5 years agolib: fix unrecognized code blocks in doc units
Alexandre Terrasa [Wed, 30 May 2018 14:14:20 +0000 (10:14 -0400)]
lib: fix unrecognized code blocks in doc units

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agonitunit: give exact location of fenced block in tests
Alexandre Terrasa [Wed, 30 May 2018 14:13:27 +0000 (10:13 -0400)]
nitunit: give exact location of fenced block in tests

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agonitunit: fix code blocks in tests
Alexandre Terrasa [Wed, 30 May 2018 14:13:10 +0000 (10:13 -0400)]
nitunit: fix code blocks in tests

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agocore: fix typos in doc of CircularArray
Alexis Laferrière [Tue, 24 Jul 2018 22:02:28 +0000 (18:02 -0400)]
core: fix typos in doc of CircularArray

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agocore: fix typos in union_find
Alexis Laferrière [Tue, 24 Jul 2018 17:52:41 +0000 (13:52 -0400)]
core: fix typos in union_find

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: update package.ini tags
Alexis Laferrière [Wed, 18 Jul 2018 21:22:49 +0000 (17:22 -0400)]
libevent: update package.ini tags

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: intro minimal usage example
Alexis Laferrière [Wed, 18 Jul 2018 20:16:40 +0000 (16:16 -0400)]
libevent: intro minimal usage example

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: add parallel test with TCP and UNIX domain sockets
Alexis Laferrière [Wed, 18 Jul 2018 19:16:27 +0000 (15:16 -0400)]
libevent: add parallel test with TCP and UNIX domain sockets

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: rename `bind_to` to the more precise `bind_tcp`
Alexis Laferrière [Wed, 18 Jul 2018 18:20:39 +0000 (14:20 -0400)]
libevent: rename `bind_to` to the more precise `bind_tcp`

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: code style tweaks and cleanup
Alexis Laferrière [Wed, 18 Jul 2018 18:05:43 +0000 (14:05 -0400)]
libevent: code style tweaks and cleanup

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: add UNIX domain socket support to addrin_to_address
Alexis Laferrière [Wed, 18 Jul 2018 18:06:59 +0000 (14:06 -0400)]
libevent: add UNIX domain socket support to addrin_to_address

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agolibevent: add UNIX domain socket support to libevent
Matthieu Le Guellaut [Mon, 4 Jun 2018 15:01:03 +0000 (11:01 -0400)]
libevent: add UNIX domain socket support to libevent

Signed-off-by: Matthieu Le Guellaut <leguellaut.matthieu@gmail.com>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

5 years agoMerge: src/model/model_index: model index uses BKTree
Jean Privat [Thu, 5 Jul 2018 12:22:25 +0000 (08:22 -0400)]
Merge: src/model/model_index: model index uses BKTree

This PR makes ModelIndex use a BKTree (#2718) to speed up Nitweb name similarity search queries on large code corpora.

Levenstein names comparison with 300k+ entities took a bit long (up to 10s for Nitweb with `contrib` and `src` for some queries). The use of BKTree speeds things up and brings those queries under 0.1s.

Pull-Request: #2724
Reviewed-by: Jean Privat <jean@pryen.org>

5 years agonitweb: compute model index at startup
Alexandre Terrasa [Thu, 14 Jun 2018 19:57:22 +0000 (15:57 -0400)]
nitweb: compute model index at startup

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/model/model_index: fix tests
Alexandre Terrasa [Thu, 14 Jun 2018 20:20:12 +0000 (16:20 -0400)]
src/model/model_index: fix tests

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/model/model_index: use BKTree for similarity matches
Alexandre Terrasa [Thu, 14 Jun 2018 19:53:08 +0000 (15:53 -0400)]
src/model/model_index: use BKTree for similarity matches

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/model/model_index: name and full_name queries does not search prefix by default
Alexandre Terrasa [Thu, 14 Jun 2018 17:27:01 +0000 (13:27 -0400)]
src/model/model_index: name and full_name queries does not search prefix by default

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/test_model_index: add query time in interactive mode
Alexandre Terrasa [Thu, 14 Jun 2018 16:53:42 +0000 (12:53 -0400)]
src/test_model_index: add query time in interactive mode

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/test_model_index: add interactive mode
Alexandre Terrasa [Thu, 14 Jun 2018 16:34:01 +0000 (12:34 -0400)]
src/test_model_index: add interactive mode

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/test_model_index: expect `-q` option for query
Alexandre Terrasa [Thu, 14 Jun 2018 16:20:17 +0000 (12:20 -0400)]
src/test_model_index: expect `-q` option for query

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agonitunit: use the new markdown parser
Alexandre Terrasa [Wed, 30 May 2018 14:12:37 +0000 (10:12 -0400)]
nitunit: use the new markdown parser

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/nitunit: remove warnings from `testing_doc`
Alexandre Terrasa [Wed, 30 May 2018 02:49:26 +0000 (22:49 -0400)]
src/nitunit: remove warnings from `testing_doc`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agoMerge: src/doc/commands: clean commands hierarchy
Jean Privat [Tue, 26 Jun 2018 13:30:47 +0000 (09:30 -0400)]
Merge: src/doc/commands: clean commands hierarchy

This PR does some cleaning around commands hierarchy to prepare for the merge with new-markdown (#2720).

Pull-Request: #2723

5 years agoMerge: src/doc/commands: use filters
Jean Privat [Tue, 26 Jun 2018 13:29:48 +0000 (09:29 -0400)]
Merge: src/doc/commands: use filters

This PR allows the DocCommands to use ModelFilter.

With this, one can setup the filter used by a command from:
* The commands programmatic Nit interface
   ~~~nit
   var filter = new ModelFilter(accept_test = false)
   var cmd = new CmdParents(model, main, filter, mentity_name = "MyEntity")
   ~~~
* The string interface through the CommandParser
   ~~~raw
   [[parents: MyEntity | no-test]]
   ~~~
* The HTTP interface
   ~~~raw
   /children/MyEntity?no-test=true
   ~~~

Pull-Request: #2722
Reviewed-by: Jean Privat <jean@pryen.org>

5 years agoMerge: lib/markdown2: introduce a new Markdown engine
Jean Privat [Tue, 26 Jun 2018 13:28:20 +0000 (09:28 -0400)]
Merge: lib/markdown2: introduce a new Markdown engine

This PR introduces a new Markdown engine called `markdown2`.

The current Markdown implementation is functional but does not follows the [CommonMark](http://commonmark.org/) specification as it passes only 273 tests of the 627 from the [CommonMark test suite](https://github.com/CommonMark/CommonMark).

Also there is a few issues with it as stated in #791, #1394, #1525 and #2507.

This new implementation aims at resolving these issues and follow the CommonMark specification.

Features:
* Markdown AST creation and rendering
* Rendering to HTML
* Rendering to Markdown
* Rendering to Man format
* Rendering to LaTeX
* Parsing of Github extended mode
* Parsing of wikilinks
* Parsing of LaTeX/Maths expression (upcoming in next PR)
* Respect of the CommonMark specification with only 10 tests failed (UTF-8 related)
* Extensive testing with a total of 980 test units...

I didn't remove the old markdown implementation since the benchmarks are not really good for now. Since `markdown2` uses a lot of regular expressions, performances can be an issue compared to `markdown`:

![screenshot from 2018-06-20 19 21 08](https://user-images.githubusercontent.com/583144/41689548-1a8bc5d0-74bf-11e8-899e-52b0eb093d57.png)

In the following PR some Nit tools will be migrated to the new implementation:
* nitunit
* nitiwiki
* nitdoc
* nitweb

Pull-Request: #2720

5 years agosrc/doc/commands/templates: move `commands_json` to `json_commands`
Alexandre Terrasa [Fri, 22 Jun 2018 04:05:13 +0000 (00:05 -0400)]
src/doc/commands/templates: move `commands_json` to `json_commands`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: move `commands_json` to `json_commands`
Alexandre Terrasa [Fri, 22 Jun 2018 04:01:30 +0000 (00:01 -0400)]
src/doc/commands/templates: move `commands_json` to `json_commands`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: move `commands_html` to `html_commands`
Alexandre Terrasa [Fri, 22 Jun 2018 03:59:09 +0000 (23:59 -0400)]
src/doc/commands/templates: move `commands_html` to `html_commands`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: rename `templates_json` in `json_model`
Alexandre Terrasa [Fri, 22 Jun 2018 03:54:06 +0000 (23:54 -0400)]
src/doc/commands/templates: rename `templates_json` in `json_model`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: rename `templates_term` in `term_model`
Alexandre Terrasa [Fri, 22 Jun 2018 03:49:38 +0000 (23:49 -0400)]
src/doc/commands/templates: rename `templates_term` in `term_model`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands/templates: rename `templates_html` in `html_model`
Alexandre Terrasa [Fri, 22 Jun 2018 03:48:20 +0000 (23:48 -0400)]
src/doc/commands/templates: rename `templates_html` in `html_model`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: clean `commands_docdown`
Alexandre Terrasa [Tue, 12 Jun 2018 16:23:39 +0000 (12:23 -0400)]
src/doc/commands: clean `commands_docdown`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: move cmd processing to `commands_html`
Alexandre Terrasa [Tue, 12 Jun 2018 16:07:28 +0000 (12:07 -0400)]
src/doc/commands: move cmd processing to `commands_html`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

5 years agosrc/doc/commands: merge `doc_down` intro `templates_html`
Alexandre Terrasa [Tue, 12 Jun 2018 16:02:28 +0000 (12:02 -0400)]
src/doc/commands: merge `doc_down` intro `templates_html`

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>