Skip to content

Commit db87e92

Browse files
Merge pull request #56 from PostHog/v2.0.0-branch
2 parents 44b47bf + 6a15b5e commit db87e92

64 files changed

Lines changed: 4650 additions & 2703 deletions

Some content is hidden

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

.config/credo.exs

Lines changed: 0 additions & 12 deletions
This file was deleted.

.config/mix_audit.exs

Lines changed: 0 additions & 15 deletions
This file was deleted.

.credo.exs

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
# This file contains the configuration for Credo and you are probably reading
2+
# this after creating it with `mix credo.gen.config`.
3+
#
4+
# If you find anything wrong or unclear in this file, please report an
5+
# issue on GitHub: https://github.com/rrrene/credo/issues
6+
#
7+
%{
8+
#
9+
# You can have as many configs as you like in the `configs:` field.
10+
configs: [
11+
%{
12+
#
13+
# Run any config using `mix credo -C <name>`. If no config name is given
14+
# "default" is used.
15+
#
16+
name: "default",
17+
#
18+
# These are the files included in the analysis:
19+
files: %{
20+
#
21+
# You can give explicit globs or simply directories.
22+
# In the latter case `**/*.{ex,exs}` will be used.
23+
#
24+
included: [
25+
"lib/",
26+
"src/",
27+
"test/",
28+
"web/",
29+
"apps/*/lib/",
30+
"apps/*/src/",
31+
"apps/*/test/",
32+
"apps/*/web/"
33+
],
34+
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
35+
},
36+
#
37+
# Load and configure plugins here:
38+
#
39+
plugins: [],
40+
#
41+
# If you create your own checks, you must specify the source files for
42+
# them here, so they can be loaded by Credo before running the analysis.
43+
#
44+
requires: [],
45+
#
46+
# If you want to enforce a style guide and need a more traditional linting
47+
# experience, you can change `strict` to `true` below:
48+
#
49+
strict: false,
50+
#
51+
# To modify the timeout for parsing files, change this value:
52+
#
53+
parse_timeout: 5000,
54+
#
55+
# If you want to use uncolored output by default, you can change `color`
56+
# to `false` below:
57+
#
58+
color: true,
59+
#
60+
# You can customize the parameters of any check by adding a second element
61+
# to the tuple.
62+
#
63+
# To disable a check put `false` as second element:
64+
#
65+
# {Credo.Check.Design.DuplicatedCode, false}
66+
#
67+
checks: %{
68+
enabled: [
69+
#
70+
## Consistency Checks
71+
#
72+
{Credo.Check.Consistency.ExceptionNames, []},
73+
{Credo.Check.Consistency.LineEndings, []},
74+
{Credo.Check.Consistency.ParameterPatternMatching, []},
75+
{Credo.Check.Consistency.SpaceAroundOperators, []},
76+
{Credo.Check.Consistency.SpaceInParentheses, []},
77+
{Credo.Check.Consistency.TabsOrSpaces, []},
78+
79+
#
80+
## Design Checks
81+
#
82+
# You can customize the priority of any check
83+
# Priority values are: `low, normal, high, higher`
84+
#
85+
{Credo.Check.Design.AliasUsage,
86+
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 1]},
87+
{Credo.Check.Design.TagFIXME, []},
88+
# You can also customize the exit_status of each check.
89+
# If you don't want TODO comments to cause `mix credo` to fail, just
90+
# set this value to 0 (zero).
91+
#
92+
{Credo.Check.Design.TagTODO, [exit_status: 2]},
93+
94+
#
95+
## Readability Checks
96+
#
97+
{Credo.Check.Readability.AliasOrder, []},
98+
{Credo.Check.Readability.FunctionNames, []},
99+
{Credo.Check.Readability.LargeNumbers, []},
100+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
101+
{Credo.Check.Readability.ModuleAttributeNames, []},
102+
{Credo.Check.Readability.ModuleDoc, []},
103+
{Credo.Check.Readability.ModuleNames, []},
104+
{Credo.Check.Readability.ParenthesesInCondition, []},
105+
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
106+
{Credo.Check.Readability.PredicateFunctionNames, []},
107+
{Credo.Check.Readability.PreferImplicitTry, []},
108+
{Credo.Check.Readability.RedundantBlankLines, []},
109+
{Credo.Check.Readability.Semicolons, []},
110+
{Credo.Check.Readability.SpaceAfterCommas, []},
111+
{Credo.Check.Readability.StringSigils, []},
112+
{Credo.Check.Readability.TrailingBlankLine, []},
113+
{Credo.Check.Readability.TrailingWhiteSpace, []},
114+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
115+
{Credo.Check.Readability.VariableNames, []},
116+
{Credo.Check.Readability.WithSingleClause, []},
117+
118+
#
119+
## Refactoring Opportunities
120+
#
121+
{Credo.Check.Refactor.Apply, []},
122+
{Credo.Check.Refactor.CondStatements, []},
123+
{Credo.Check.Refactor.CyclomaticComplexity, []},
124+
{Credo.Check.Refactor.FilterCount, []},
125+
{Credo.Check.Refactor.FilterFilter, []},
126+
{Credo.Check.Refactor.FunctionArity, []},
127+
{Credo.Check.Refactor.LongQuoteBlocks, []},
128+
{Credo.Check.Refactor.MapJoin, []},
129+
{Credo.Check.Refactor.MatchInCondition, []},
130+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
131+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
132+
{Credo.Check.Refactor.Nesting, []},
133+
{Credo.Check.Refactor.RedundantWithClauseResult, []},
134+
{Credo.Check.Refactor.RejectReject, []},
135+
{Credo.Check.Refactor.UnlessWithElse, []},
136+
{Credo.Check.Refactor.WithClauses, []},
137+
138+
#
139+
## Warnings
140+
#
141+
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
142+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
143+
{Credo.Check.Warning.Dbg, []},
144+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
145+
{Credo.Check.Warning.IExPry, []},
146+
{Credo.Check.Warning.IoInspect, []},
147+
{Credo.Check.Warning.OperationOnSameValues, []},
148+
{Credo.Check.Warning.OperationWithConstantResult, []},
149+
{Credo.Check.Warning.RaiseInsideRescue, []},
150+
{Credo.Check.Warning.SpecWithStruct, []},
151+
{Credo.Check.Warning.UnsafeExec, []},
152+
{Credo.Check.Warning.UnusedEnumOperation, []},
153+
{Credo.Check.Warning.UnusedFileOperation, []},
154+
{Credo.Check.Warning.UnusedKeywordOperation, []},
155+
{Credo.Check.Warning.UnusedListOperation, []},
156+
{Credo.Check.Warning.UnusedPathOperation, []},
157+
{Credo.Check.Warning.UnusedRegexOperation, []},
158+
{Credo.Check.Warning.UnusedStringOperation, []},
159+
{Credo.Check.Warning.UnusedTupleOperation, []},
160+
{Credo.Check.Warning.WrongTestFileExtension, []}
161+
],
162+
disabled: [
163+
#
164+
# Checks scheduled for next check update (opt-in for now)
165+
{Credo.Check.Refactor.UtcNowTruncate, []},
166+
167+
#
168+
# Controversial and experimental checks (opt-in, just move the check to `:enabled`
169+
# and be sure to use `mix credo --strict` to see low priority checks)
170+
#
171+
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
172+
{Credo.Check.Consistency.UnusedVariableNames, []},
173+
{Credo.Check.Design.DuplicatedCode, []},
174+
{Credo.Check.Design.SkipTestWithoutComment, []},
175+
{Credo.Check.Readability.AliasAs, []},
176+
{Credo.Check.Readability.BlockPipe, []},
177+
{Credo.Check.Readability.ImplTrue, []},
178+
{Credo.Check.Readability.MultiAlias, []},
179+
{Credo.Check.Readability.NestedFunctionCalls, []},
180+
{Credo.Check.Readability.OneArityFunctionInPipe, []},
181+
{Credo.Check.Readability.OnePipePerLine, []},
182+
{Credo.Check.Readability.SeparateAliasRequire, []},
183+
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
184+
{Credo.Check.Readability.SinglePipe, []},
185+
{Credo.Check.Readability.Specs, []},
186+
{Credo.Check.Readability.StrictModuleLayout, []},
187+
{Credo.Check.Readability.WithCustomTaggedTuple, []},
188+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
189+
{Credo.Check.Refactor.ABCSize, []},
190+
{Credo.Check.Refactor.AppendSingleItem, []},
191+
{Credo.Check.Refactor.DoubleBooleanNegation, []},
192+
{Credo.Check.Refactor.FilterReject, []},
193+
{Credo.Check.Refactor.IoPuts, []},
194+
{Credo.Check.Refactor.MapMap, []},
195+
{Credo.Check.Refactor.ModuleDependencies, []},
196+
{Credo.Check.Refactor.NegatedIsNil, []},
197+
{Credo.Check.Refactor.PassAsyncInTestCases, []},
198+
{Credo.Check.Refactor.PipeChainStart, []},
199+
{Credo.Check.Refactor.RejectFilter, []},
200+
{Credo.Check.Refactor.VariableRebinding, []},
201+
{Credo.Check.Warning.LazyLogging, []},
202+
{Credo.Check.Warning.LeakyEnvironment, []},
203+
{Credo.Check.Warning.MapGetUnsafePass, []},
204+
{Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []},
205+
{Credo.Check.Warning.MixEnv, []},
206+
{Credo.Check.Warning.UnsafeToAtom, []}
207+
208+
# {Credo.Check.Refactor.MapInto, []},
209+
210+
#
211+
# Custom checks can be created using `mix credo.gen.check`.
212+
#
213+
]
214+
}
215+
}
216+
]
217+
}

.github/workflows/ci.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,14 @@ jobs:
1313
# This is a complicated set of strategies, but Elixir has a complicated set of supported versions.
1414
# See https://hexdocs.pm/elixir/compatibility-and-deprecations.html
1515
# See https://hexdocs.pm/elixir/compatibility-and-deprecations.html#between-elixir-and-erlang-otp
16-
#
17-
# NOTE: We're intentionally not including Elixir 1.14.x + OTP 23.x
18-
# because erlef/setup-beam@v1 doesn't support it.
1916
strategy:
2017
matrix:
21-
elixir: ["1.14.x", "1.15.x", "1.16.x", "1.17.x", "1.18.x"]
22-
otp: ["24.x", "25.x", "26.x", "27.x"]
18+
elixir: ["1.17.x", "1.18.x"]
19+
otp: ["25.x", "26.x", "27.x", "28.x"]
2320
exclude:
24-
# Elixir 1.17 and 1.18 don't support OTP 24
21+
# Elixir 1.17 doesn't support OTP 28
2522
- elixir: "1.17.x"
26-
otp: "24.x"
27-
- elixir: "1.18.x"
28-
otp: "24.x"
29-
# Elixir 1.14, 1.15 and 1.16 don't support OTP 27
30-
- elixir: "1.15.x"
31-
otp: "27.x"
32-
- elixir: "1.16.x"
33-
otp: "27.x"
34-
- elixir: "1.14.x"
35-
otp: "27.x"
23+
otp: "28.x"
3624

3725
steps:
3826
- uses: actions/checkout@v3

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ posthog-*.tar
2828

2929
# Ignore .DS_Store
3030
.DS_Store
31+
32+
# Local Config
33+
config/integration.exs
34+
config/dev.override.exs

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
elixir 1.18.3
1+
elixir 1.18.3-otp-27
22
erlang 27.3.3

CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
## 2.0.0 - 2025-09-30
2+
3+
### Major Release
4+
5+
`posthog-elixir` was fully reworked. Check [migration guide](MIGRATION.md#v1-v2)
6+
for some tips on how to upgrade.
7+
8+
Huge thanks to community member [@martosaur](https://github.com/martosaur) for contributing this new version.
9+
10+
### What's new
11+
12+
- Elixir v1.17+ required
13+
- Event capture is now offloaded to background workers with automatic batching
14+
- [Context](README.md#context) mechanism for easier property propagation
15+
- [Error Tracking](README.md#error-tracking) support
16+
- New `PostHog.FeatureFlags` module for working with feature flags
17+
- [Test mode](`PostHog.Test`) for easier testing
18+
- Customizable [HTTP client](`PostHog.API.Client`) with Req as the default
19+
- [Plug integration](`PostHog.Integrations.Plug`) for automatically capturing common HTTP properties
20+
121
## 1.1.0 - 2025-07-01
222

323
- Expose `capture/2` `b077aba849126c63f1c7a82b6ad9d21945871a4a`
@@ -27,7 +47,7 @@
2747
- PostHog now requires you to initialize `Posthog.Application` alongside your supervisor tree. This is required because of our `Cachex` system to properly track your FF usage.
2848
- We'll also include local evaluation in the near term, which will also require a GenServer, therefore, requiring us to use a Supervisor.
2949
- Added `enabled_capture` configuration option to disable PostHog tracking in development/test environments
30-
- `Posthog.capture` now requires `distinct_id` as a required second argument
50+
- `PostHog.capture` now requires `distinct_id` as a required second argument
3151

3252
## 0.4.4 - 2025-04-14
3353

0 commit comments

Comments
 (0)