<commit_before>%% -*- mode: Erlang; fill-column: 132; comment-column: 118; -*-
%%%-------------------------------------------------------------------
%%% Copyright (c) 2007 Erlware
%%%
%%% Permission is hereby granted, free of charge, to any
%%% person obtaining a copy of this software and associated
%%% documentation files (the "Software"), to deal in the
%%% Software without restriction, including without limitation
%%% the rights to use, copy, modify, merge, publish, distribute,
%%% sublicense, and/or sell copies of the Software, and to permit
%%% persons to whom the Software is furnished to do so, subject to
%%% the following conditions:
%%%
%%% The above copyright notice and this permission notice shall
%%% be included in all copies or substantial portions of the Software.
%%%
%%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
%%% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
%%% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
%%% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
%%% HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
%%% WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
%%% OTHER DEALINGS IN THE SOFTWARE.
%%%---------------------------------------------------------------------------
%%% @author <NAME> <<EMAIL>>
%%% @doc
%%%  The module provides a simple api for the sinan system.
%%%  Two possible arguments may be passed in. The start dir that should
%%%  be somewhere inside a project and a list of args for the system.
%%%
%%%  @type buildref() = string(). A globally unique id for the build
%%%  @type startdir() = string(). A dir that is somewhere in a project
%%%  @type args() = {[{TaskName, args}]}
%%%    TaskName = string(). The name of the task the args apply too.
%%% @end
%%% @copyright (C) 2007, Erlware
%%% Created :  8 Dec 2007 by <NAME> <<EMAIL>>
%%%-------------------------------------------------------------------
-module(sinan).

%% API
-export([gen_build_ref/0,
         build/2, build/3,
         analyze/3, analyze/2,
         doc/3, doc/2,
         shell/2, shell/3,
         gen/3, gen/2,
         clean/2, clean/3,
         help/2, help/3,
         depends/2, depends/3,
         test/2, test/3,
         release/2, release/3,
         dist/2, dist/3,
         do_task/4,
         do_task/5,
         start/0]).

%%====================================================================
%% API
%%====================================================================
%%--------------------------------------------------------------------
%% @doc
%%  Run the build task. {@link sin_erl_builder}
%% @spec build(BuildRef::buildRef(), StartDir::startdir()) -> ok
%% @end
%%--------------------------------------------------------------------
build(BuildRef, StartDir) -><commit_msg>support for handler add method, good event docs<commit_after>%% -*- mode: Erlang; fill-column: 132; comment-column: 118; -*-
%%%-------------------------------------------------------------------
%%% Copyright (c) 2007 Erlware
%%%
%%% Permission is hereby granted, free of charge, to any
%%% person obtaining a copy of this software and associated
%%% documentation files (the "Software"), to deal in the
%%% Software without restriction, including without limitation
%%% the rights to use, copy, modify, merge, publish, distribute,
%%% sublicense, and/or sell copies of the Software, and to permit
%%% persons to whom the Software is furnished to do so, subject to
%%% the following conditions:
%%%
%%% The above copyright notice and this permission notice shall
%%% be included in all copies or substantial portions of the Software.
%%%
%%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
%%% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
%%% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
%%% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
%%% HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
%%% WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
%%% OTHER DEALINGS IN THE SOFTWARE.
%%%---------------------------------------------------------------------------
%%% @author <NAME> <<EMAIL>>
%%% @doc
%%%  The module provides a simple api for the sinan system.
%%%  Two possible arguments may be passed in. The start dir that should
%%%  be somewhere inside a project and a list of args for the system.
%%%
%%%  @type buildref() = string(). A globally unique id for the build
%%%  @type startdir() = string(). A dir that is somewhere in a project
%%%  @type args() = {[{TaskName, args}]}
%%%    TaskName = string(). The name of the task the args apply too.
%%% @end
%%% @copyright (C) 2007, Erlware
%%% Created :  8 Dec 2007 by <NAME> <<EMAIL>>
%%%-------------------------------------------------------------------
-module(sinan).

%% API
-export([gen_build_ref/0,
         build/2, build/3,
         analyze/3, analyze/2,
         doc/3, doc/2,
         shell/2, shell/3,
         gen/3, gen/2,
         clean/2, clean/3,
         help/2, help/3,
         depends/2, depends/3,
         test/2, test/3,
         release/2, release/3,
         dist/2, dist/3,
         do_task/4,
         do_task/5,
         start/0]).

%%====================================================================
%% API
%%====================================================================
%%--------------------------------------------------------------------
%% @doc
%%  Add a handler to the build system. Handler should filter for
%%  its own tasks.
%%
%%  Possible events are as follows
%%  ```
%%   {meta_event, fault, Event, Desc} :: Meta Event Fault
%%   {run_event, RunRef, Event}  :: Run (Build) Event
%%   {run_event, RunRef, start}  :: Start of a build run
%%   {run_event, RunRef, stop}   :: Stop of a build run
%%   {run_event, RunRef, fault}  :: A build fault (equiv to a stop)
%%   {run_event, RunRef, fault, Reason} :: A build fault with reason (string)
%%   {task_event, RunRef, Task, Event}  :: an event generated by a task
%%   {task_event, RunRef, Task, Event, Desc} :: A task event with description
%%   {task_event, RunRef, Task, start}       :: indicates a task start
%%   {task_event, RunRef, Task, start, Desc} :: Task start with desc
%%   {task_event, RunRef, Task, stop} :: A task stop
%%   {task_event, RunRef, Task, stop, Desc} :: A task stop with desc
%%   {task_event, RunRef, Task, fault} :: A task fault (equiv to stop)
%%   {task_event, RunRef, Task, fault, Reason} :: A task fault with reason
%%  ```
%%
%% @spec add_build_event_handler(Handler, Args) -> ok
%% @end
%%--------------------------------------------------------------------
add_build_event_handler(Handler, Args) ->
    eta_event:add_handler(Handler, Args).

%%--------------------------------------------------------------------
%% @doc
%%  Run the build task. {@link sin_erl_builder}
%% @spec build(BuildRef::buildRef(), StartDir::startdir()) -> ok
%% @end
%%--------------------------------------------------------------------
build(BuildRef, StartDir) ->
{'fraction_non_alphanumeric': 0.2701911005719068, 'fraction_numerical': 0.012554052169061235, 'mean_word_length': 2.2874828060522696, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4792970', 'n_tokens_mistral': 1955, 'n_tokens_neox': 1868, 'n_words': 765}