Skip to content

Commit

Permalink
Generate doc versions
Browse files Browse the repository at this point in the history
  • Loading branch information
brunvez committed May 5, 2022
1 parent 1def664 commit 456663e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/scapa.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ defmodule Scapa do
"""
@spec hello() :: world()
@doc version: "59627563"
def hello do
:world
end
Expand Down
1 change: 1 addition & 0 deletions lib/scapa/cli.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defmodule Scapa.CLI do
@doc """
Receives a pattern for files to look into and generates versions for those
"""
@doc version: "124861924"
def generate_versions(files_pattern) do
files_to_versionate(files_pattern)
|> Enum.map(&{&1, add_versions_to_file(&1)})
Expand Down
3 changes: 3 additions & 0 deletions lib/scapa/code.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule Scapa.Code do
@doc tag.
"""
@spec functions_with_doc(source()) :: [FunctionDefinition.t()]
@doc version: "74559578"
def functions_with_doc({:module, module, module_source}) do
docs = function_docs(module)
ast = Code.string_to_quoted!(module_source, columns: true)
Expand All @@ -33,6 +34,7 @@ defmodule Scapa.Code do
"""
@spec upsert_doc_version(source_code(), FunctionDefinition.t(), FunctionDefinition.version()) ::
source_code()
@doc version: "88390810"
def upsert_doc_version(module_string, function_definition, new_version)

def upsert_doc_version(
Expand Down Expand Up @@ -60,6 +62,7 @@ defmodule Scapa.Code do
[Scapa.Insider, Scapa]
"""
@spec defined_modules(Macro.t()) :: [atom()]
@doc version: "84273486"
def defined_modules(ast) do
ast
|> Macro.prewalk([], fn
Expand Down
1 change: 1 addition & 0 deletions lib/scapa/function_definition.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ defmodule Scapa.FunctionDefinition do
42
"""
@spec line_number(t()) :: line()
@doc version: "63656950"
def line_number(%__MODULE__{position: {line, _column}}), do: line
end
1 change: 1 addition & 0 deletions lib/scapa/version_calculator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule Scapa.VersionCalculator do
"47674823"
"""
@spec calculate(FunctionDefinition.t()) :: version()
@doc version: "98757687"
def calculate(%FunctionDefinition{signature: signature}) do
Integer.to_string(:erlang.phash2(signature))
end
Expand Down

0 comments on commit 456663e

Please sign in to comment.