You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/11/05 14:33:06 UTC

[GitHub] [couchdb-erlfdb] kocolosk opened a new pull request #33: Format code using erlfmt

kocolosk opened a new pull request #33:
URL: https://github.com/apache/couchdb-erlfdb/pull/33


   *NOTE*: I'm stacking this PR on top of #27 and #29 to avoid issues merging. I also merged changes from `main` into this PR to avoid a couple of small conflicts with #32 .
   
   This PR adds `erlfmt` as a plugin so you can execute `rebar3 fmt` and then applies the results of `rebar3 fmt -w`. I put an `%% erlfmt-ignore` over a couple of functions where I felt that the hand-crafted style was much better (e.g. places where we had dozens of function clauses, and the extra line between each clause significantly improved readability).
   
   I checked that `erlfmt` did not change the actual compiled output by manually running the following command for every source file. After temporarily adjusting `?NOT_LOADED` in `erlfdb_nif` to omit the `?LINE` info I got agreement across the board in src/:
   
   > compile:file("old_src/erlfdb.erl", [deterministic, binary]) =:= compile:file("src/erlfdb.erl", [deterministic, binary]).
   
   ### Reviewer Guidance
   
   The only commit I'm looking for a review on at the moment is a6ac293. I may update this PR to check code formatting automatically in a GitHub Action as well.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-erlfdb] kocolosk merged pull request #33: Format code using erlfmt

Posted by GitBox <gi...@apache.org>.
kocolosk merged pull request #33:
URL: https://github.com/apache/couchdb-erlfdb/pull/33


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-erlfdb] nickva commented on a change in pull request #33: Format code using erlfmt

Posted by GitBox <gi...@apache.org>.
nickva commented on a change in pull request #33:
URL: https://github.com/apache/couchdb-erlfdb/pull/33#discussion_r745251680



##########
File path: src/erlfdb_nif.erl
##########
@@ -61,257 +61,246 @@
     error_predicate/2
 ]).
 
-
 -define(DEFAULT_API_VERSION, 620).
 
-
--type error() :: {erlfdb_error, Code::integer()}.
+-type error() :: {erlfdb_error, Code :: integer()}.
 -type future() :: {erlfdb_future, reference(), reference()}.
 -type database() :: {erlfdb_database, reference()}.
 -type transaction() :: {erlfdb_transaction, reference()}.
 
 -type option_value() :: integer() | binary().
 
 -type key_selector() ::
-    {Key::binary(), lt | lteq | gt | gteq} |
-    {Key::binary(), OrEqual::boolean(), Offset::integer()}.
+    {Key :: binary(), lt | lteq | gt | gteq}
+    | {Key :: binary(), OrEqual :: boolean(), Offset :: integer()}.
 
 -type future_result() ::
-    database() |
-    integer() |
-    binary() |
-    {[{binary(), binary()}], integer(), boolean()} |
-    not_found |
-    {error, invalid_future_type}.
+    database()
+    | integer()
+    | binary()
+    | {[{binary(), binary()}], integer(), boolean()}
+    | not_found
+    | {error, invalid_future_type}.
 
 -type network_option() ::
-    local_address |
-    cluster_file |
-    trace_enable |
-    trace_format |
-    trace_roll_size |
-    trace_max_logs_size |
-    trace_log_group |
-    knob |
-    tls_plugin |
-    tls_cert_bytes |
-    tls_cert_path |
-    tls_key_bytes |
-    tls_key_path |
-    tls_verify_peers |
-    client_buggify_enable |
-    client_buggify_disable |
-    client_buggify_section_activated_probability |
-    client_buggify_section_fired_probability |
-    tls_ca_bytes |
-    tls_ca_path |
-    tls_password |
-    disable_multi_version_client_api |
-    callbacks_on_external_threads |
-    external_client_library |
-    external_client_directory |
-    disable_local_client |
-    disable_client_statistics_logging |
-    enable_slow_task_profiling.
+    local_address
+    | cluster_file
+    | trace_enable
+    | trace_format
+    | trace_roll_size
+    | trace_max_logs_size
+    | trace_log_group
+    | knob
+    | tls_plugin
+    | tls_cert_bytes
+    | tls_cert_path
+    | tls_key_bytes
+    | tls_key_path
+    | tls_verify_peers
+    | client_buggify_enable
+    | client_buggify_disable
+    | client_buggify_section_activated_probability
+    | client_buggify_section_fired_probability
+    | tls_ca_bytes
+    | tls_ca_path
+    | tls_password
+    | disable_multi_version_client_api
+    | callbacks_on_external_threads
+    | external_client_library
+    | external_client_directory
+    | disable_local_client
+    | disable_client_statistics_logging
+    | enable_slow_task_profiling.

Review comment:
       The `|` in front style actually looks pretty good




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb-erlfdb] nickva commented on a change in pull request #33: Format code using erlfmt

Posted by GitBox <gi...@apache.org>.
nickva commented on a change in pull request #33:
URL: https://github.com/apache/couchdb-erlfdb/pull/33#discussion_r745250747



##########
File path: include/erlfdb.hrl
##########
@@ -54,6 +55,7 @@
 % include ?TRANSACTION_TIMED_OUT. In some cases it may make sense to also
 % consider that error as retryable.
 %
+%% erlfmt-ignore

Review comment:
       good call




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org