Skip to content

Commit 8d8b347

Browse files
committed
Initial commit
0 parents  commit 8d8b347

File tree

267 files changed

+61161
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+61161
-0
lines changed

.formatter.exs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# Copyright (c) WhatsApp LLC
3+
#
4+
# This source code is licensed under the MIT license found in the
5+
# LICENSE.md file in the root directory of this source tree.
6+
7+
# Used by "mix format"
8+
[
9+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
10+
line_length: 132
11+
]

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
MIX_ENV: test
7+
8+
jobs:
9+
test:
10+
name: Test
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- elixir: 1.15.4
18+
otp: 26.0.2
19+
rebar3: 3.22.0
20+
lint: true
21+
22+
- elixir: 1.14.5
23+
otp: 25.2.3
24+
rebar3: 3.22.0
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Setup Beam
30+
uses: erlef/setup-beam@v1
31+
with:
32+
elixir-version: ${{ matrix.elixir }}
33+
otp-version: ${{ matrix.otp }}
34+
rebar3-version: ${{ matrix.rebar3 }}
35+
36+
- name: Erlang Tests
37+
run: |
38+
rebar3 ct
39+
40+
- name: Retrieve Mix Dependencies Cache
41+
uses: actions/cache@v3
42+
id: mix-cache
43+
with:
44+
path: deps
45+
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
46+
47+
- name: Install Mix Dependencies
48+
if: steps.mix-cache.outputs.cache-hit != 'true'
49+
run: |
50+
mix local.rebar --force
51+
mix local.hex --force
52+
mix deps.get
53+
54+
- name: Check Formatting
55+
if: ${{ matrix.lint }}
56+
run: mix format --check-formatted
57+
58+
- name: Elixir Tests
59+
run: mix test
60+
61+
- name: Logs
62+
uses: actions/upload-artifact@v3
63+
if: failure()
64+
with:
65+
name: ct-logs-${{ matrix.otp }}-${{ matrix.elixir }}
66+
path: _build/test/logs/

.gitignore

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
/apps/erldist_filter/_build/
4+
/apps/erldist_filter_test/_build/
5+
6+
# If you run "mix test --cover", coverage assets end up here.
7+
/cover/
8+
9+
# The directory Mix downloads your dependencies sources to.
10+
/deps/
11+
/apps/erldist_filter/deps/
12+
/apps/erldist_filter_test/deps/
13+
14+
# Where third-party dependencies like ExDoc output generated docs.
15+
/doc/
16+
/apps/erldist_filter/doc/
17+
/apps/erldist_filter_test/doc/
18+
19+
# Ignore .fetch files in case you like to edit your project deps locally.
20+
/.fetch
21+
22+
# If the VM crashes, it generates a dump, let's ignore it too.
23+
erl_crash.dump
24+
25+
# Also ignore archive artifacts (built via "mix archive.build").
26+
*.ez
27+
28+
# Ignore package tarball (built via "mix hex.build").
29+
erldist_filter-*.tar
30+
erldist_filter_test-*.tar
31+
32+
# Temporary files, for example, from tests.
33+
/tmp/
34+
35+
# rebar3 and erlang.mk related files.
36+
.rebar3
37+
_*
38+
.eunit
39+
*.o
40+
*.beam
41+
*.plt
42+
*.swp
43+
*.swo
44+
.erlang.cookie
45+
ebin
46+
log
47+
erl_crash.dump
48+
.rebar
49+
logs
50+
_build
51+
.idea
52+
.vscode
53+
*.iml
54+
rebar3.crashdump
55+
*~
56+
/.elixir_ls/
57+
/.erlang.mk/
58+
/apps/erldist_filter/c_src/env.mk
59+
/apps/erldist_filter/priv/*.dll
60+
/apps/erldist_filter/priv/*.dylib
61+
/apps/erldist_filter/priv/*.so
62+
/erlfmt
63+
/rebar3

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 1.0.0 (2023-??-??)
4+
5+
* Initial release.

CODE_OF_CONDUCT.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to make participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all project spaces, and it also applies when
49+
an individual is representing the project or its community in public spaces.
50+
Examples of representing a project or community include using an official
51+
project e-mail address, posting via an official social media account, or acting
52+
as an appointed representative at an online or offline event. Representation of
53+
a project may be further defined and clarified by project maintainers.
54+
55+
This Code of Conduct also applies outside the project spaces when there is a
56+
reasonable belief that an individual's behavior may have a negative impact on
57+
the project or its community.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported by contacting the project team at <opensource-conduct@meta.com>. All
63+
complaints will be reviewed and investigated and will result in a response that
64+
is deemed necessary and appropriate to the circumstances. The project team is
65+
obligated to maintain confidentiality with regard to the reporter of an incident.
66+
Further details of specific enforcement policies may be posted separately.
67+
68+
Project maintainers who do not follow or enforce the Code of Conduct in good
69+
faith may face temporary or permanent repercussions as determined by other
70+
members of the project's leadership.
71+
72+
## Attribution
73+
74+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
75+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
76+
77+
[homepage]: https://www.contributor-covenant.org
78+
79+
For answers to common questions about this code of conduct, see
80+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Contributing to `erldist_filter`
2+
3+
We want to make contributing to this project as easy and transparent as possible.
4+
5+
## Our Development Process
6+
7+
`erldist_filter` is currently developed in Meta's internal repositories and then exported out to GitHub by a Meta team member; however, we invite you to submit pull requests as described below.
8+
9+
## Pull Requests
10+
11+
We actively welcome your pull requests.
12+
13+
1. Fork the repo and create your branch from `main`.
14+
2. If you've added code that should be tested, add tests.
15+
3. If you've changed APIs, update the documentation.
16+
4. Ensure the test suite passes.
17+
5. Make sure your code lints.
18+
6. If you haven't already, complete the Contributor License Agreement ("CLA").
19+
20+
## Contributor License Agreement ("CLA")
21+
22+
In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of Meta's open source projects.
23+
24+
Complete your CLA here: <https://code.facebook.com/cla>
25+
26+
## Issues
27+
28+
We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue.
29+
30+
Meta has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue.
31+
32+
## Coding Style
33+
34+
Please run `make format` before submitting your changes.
35+
36+
## License
37+
38+
By contributing to `erldist_filter`, you agree that your contributions will be licensed under the MIT license found in the LICENSE.md file in the root directory of this source tree.

LICENSE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
MIT License
2+
===========
3+
4+
Copyright (c) Meta Platforms, Inc. and affiliates.
5+
6+
Copyright (c) WhatsApp LLC
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
SOFTWARE.

Makefile

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# Copyright (c) WhatsApp LLC
3+
#
4+
# This source code is licensed under the MIT license found in the
5+
# LICENSE.md file in the root directory of this source tree.
6+
7+
PROJECT = erldist_filter
8+
PROJECT_DESCRIPTION = erldist_filter
9+
PROJECT_VERSION = 1.0.0
10+
11+
include erlang.mk
12+
13+
.PHONY: erlfmt erlfmt-check distclean-erlfmt format
14+
15+
# Configuration.
16+
ERLFMT_VERSION ?= 1.2.0
17+
18+
ERLFMT ?= $(CURDIR)/erlfmt
19+
export ERLFMT
20+
21+
ERLFMT_URL ?= https://github.com/WhatsApp/erlfmt/archive/refs/tags/v$(ERLFMT_VERSION).tar.gz
22+
ERLFMT_OPTS ?=
23+
ERLFMT_BUILD_DIR ?= $(CURDIR)/_erlfmt_build
24+
ERLFMT_CODE_ARCHIVE = $(ERLFMT_VERSION).tar.gz
25+
26+
ERLFMT_REBAR3_URL ?= https://s3.amazonaws.com/rebar3/rebar3
27+
ERLFMT_REBAR3 ?= rebar3
28+
29+
# Core targets.
30+
31+
help::
32+
$(verbose) printf "%s\n" "" \
33+
"erlfmt targets:" \
34+
" erlfmt Run erlfmt or download the default otherwise" \
35+
" elrfmt-check Run erlfmt --check"
36+
37+
distclean:: distclean-erlfmt
38+
39+
# Plugin-specific targets.
40+
41+
$(ERLFMT):
42+
$(verbose) mkdir -p $(ERLFMT_BUILD_DIR)
43+
ifeq ($(shell command -v $(ERLFMT_REBAR3)),)
44+
$(verbose) echo "Downloading Rebar3 from: "$(ERLFMT_REBAR3_URL)
45+
$(verbose) $(call core_http_get,$(ERLFMT_BUILD_DIR)/rebar3,$(ERLFMT_REBAR3_URL))
46+
$(verbose) chmod +x $(ERLFMT_BUILD_DIR)/rebar3
47+
$(eval ERLFMT_REBAR3 := $(ERLFMT_BUILD_DIR)/rebar3)
48+
else
49+
$(verbose) echo "Using Rebar3: "$(ERLFMT_REBAR3)
50+
endif
51+
$(verbose) echo "Downloading erlfmt from: "$(ERLFMT_URL)
52+
$(verbose) $(call core_http_get,$(ERLFMT_BUILD_DIR)/$(ERLFMT_CODE_ARCHIVE),$(ERLFMT_URL))
53+
$(verbose) cd $(ERLFMT_BUILD_DIR) && \
54+
tar -xzf $(ERLFMT_CODE_ARCHIVE) && \
55+
cd erlfmt-$(ERLFMT_VERSION) && \
56+
$(ERLFMT_REBAR3) as release escriptize
57+
$(gen_verbose) cp $(ERLFMT_BUILD_DIR)/erlfmt-$(ERLFMT_VERSION)/_build/release/bin/erlfmt $(ERLFMT)
58+
$(verbose) chmod +x $(ERLFMT)
59+
$(verbose) rm -rf $(ERLFMT_BUILD_DIR)/erlfmt-$(ERLFMT_VERSION)
60+
$(verbose) rm $(ERLFMT_BUILD_DIR)/$(ERLFMT_CODE_ARCHIVE)
61+
$(verbose) rm -f $(ERLFMT_BUILD_DIR)/rebar3
62+
$(verbose) rm -rf $(ERLFMT_BUILD_DIR)
63+
64+
erlfmt: $(ERLFMT)
65+
$(verbose) $(ERLFMT) --verbose --write --require-pragma --print-width=120 'apps/**/{src,include,test}/**/*.{hrl,erl,app.src}' 'apps/**/rebar.config' rebar.config
66+
67+
erlfmt-check: $(ERLFMT)
68+
$(verbose) $(ERLFMT) --check --require-pragma --print-width=120 'apps/**/{src,include,test}/**/*.{hrl,erl,app.src}' 'apps/**/rebar.config' rebar.config
69+
70+
distclean-erlfmt:
71+
$(gen_verbose) rm -rf $(ERLFMT)
72+
73+
format: $(ERLFMT)
74+
$(verbose) $(MAKE) -C $(CURDIR)/apps/erldist_filter/c_src format
75+
$(verbose) $(MAKE) erlfmt
76+
$(verbose) mix format

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# `erldist_filter`
2+
3+
[![Build Status](https://github.com/WhatsApp/erldist_filter/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/WhatsApp/erldist_filter/actions)
4+
5+
`erldist_filter` NIF for filtering and logging [Erlang Dist Protocol](https://www.erlang.org/doc/apps/erts/erl_dist_protocol.html) messages.
6+
7+
See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.
8+
9+
## License
10+
11+
`erldist_filter` is MIT licensed, as found in the [LICENSE](LICENSE.md) file.

0 commit comments

Comments
 (0)