Skip to content

Commit

Permalink
lint all the files
Browse files Browse the repository at this point in the history
so that the `lint.yml` workflow passes
  • Loading branch information
etpinard committed Jun 27, 2023
1 parent 052bd98 commit 8f82834
Show file tree
Hide file tree
Showing 97 changed files with 117 additions and 122 deletions.
5 changes: 0 additions & 5 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,3 @@ CI:
enhancement:
- "src/*.jl"
- "./*"





2 changes: 1 addition & 1 deletion .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
run: julia -e 'using CompatHelper; CompatHelper.main()'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ docs/build
venv
*.pyc
tmp
gen_resources/build
gen_resources/build
2 changes: 1 addition & 1 deletion gen_resources/generate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ build_dir = joinpath(@__DIR__, "build")

artifact_file = joinpath(@__DIR__, "..", "Artifacts.toml")

generate(ARGS, sources, build_dir, artifact_file)
generate(ARGS, sources, build_dir, artifact_file)
2 changes: 1 addition & 1 deletion gen_resources/generator/components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ function arg_docstring(prop_name, type_object, required, description, indent_num
")",
isempty(description) ? "" : string(": ", description)
)
end
end
2 changes: 1 addition & 1 deletion gen_resources/generator/dash.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ function components_module_resources(module_name; name, prefix, metadata_file)
)

return meta
end
end
2 changes: 1 addition & 1 deletion gen_resources/generator/deploy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ function upload_to_releases(repo_name, tag, tarball_path; attempts = 3)
end
end
error("Unable to upload $(tarball_path) to GitHub repo $(repo_name) on tag $(tag)")
end
end
2 changes: 1 addition & 1 deletion gen_resources/generator/generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ function generate(ARGS, sources, build_dir, artifact_file)
end
@info "resource generation done!"

end
end
2 changes: 1 addition & 1 deletion gen_resources/generator/github.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ function obtain_token(; outs=stdout, github_api=GitHub.DEFAULT_API)

return token
end
end
end
2 changes: 1 addition & 1 deletion gen_resources/generator/gitutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ function with_gitcreds(f, username::AbstractString, password::AbstractString)
finally
Base.shred!(creds)
end
end
end
2 changes: 1 addition & 1 deletion src/Components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ function _validate(non_comp, ids::Set{Symbol}) end

function validate(comp::Component)
_validate(comp, Set{Symbol}())
end
end
2 changes: 1 addition & 1 deletion src/Contexts/Contexts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ function get_context(context::TaskContextStorage)
end
end

end
end
2 changes: 1 addition & 1 deletion src/Dash.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ function __init__()
end


end # module
end # module
16 changes: 8 additions & 8 deletions src/HttpHelpers/router.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct DynamicRoute{ST,VT} <: AbstractRoute
static_segments ::ST
variables ::VT
tailed::Bool

DynamicRoute(segments_length, static_segments::ST, variables::VT, tailed) where {ST, VT} = new{ST, VT}(segments_length, static_segments, variables, tailed)
end

Expand All @@ -31,7 +31,7 @@ function DynamicRoute(url::AbstractString)
tailed = false
if url[end] != '/' && (isempty(segments_vector) || segments_vector[end][1] != length(parts))
tailed = true
end
end
return DynamicRoute(
segments_count,
(segments_vector...,),
Expand Down Expand Up @@ -62,7 +62,7 @@ function try_handle(route_handler::RouteHandler{<:DynamicRoute, FT}, path::Abstr
length(parts) != parts_length && return nothing
for segment in route.static_segments
parts[segment[1]] != segment[2] && return nothing
end
end
return route_handler.handler(request, args...;args_tuple(route, parts)...)
end

Expand All @@ -80,8 +80,8 @@ struct Route{RH}
method ::Union{Nothing,String}
route_handler ::RH
Route(method, route_handler::RH) where {RH} = new{RH}(method, route_handler)
end
function Route(handler::Function, method, path::AbstractString)
end
function Route(handler::Function, method, path::AbstractString)
return Route(
method,
RouteHandler(
Expand All @@ -97,14 +97,14 @@ function try_handle(route::Route, path::AbstractString, request::HTTP.Request, a
return try_handle(route.route_handler, path, request, args...)
end

@inline function _handle(route_tuple::Tuple, path::AbstractString, request::HTTP.Request, args...)
@inline function _handle(route_tuple::Tuple, path::AbstractString, request::HTTP.Request, args...)
res = try_handle(route_tuple[1], path, request, args...)
return !isnothing(res) ?
return !isnothing(res) ?
res :
_handle(Base.tail(route_tuple), path, request, args...)
end

@inline function _handle(route_tuple::Tuple{}, path::AbstractString, request::HTTP.Request, args...)
@inline function _handle(route_tuple::Tuple{}, path::AbstractString, request::HTTP.Request, args...)
return HTTP.Response(404)
end

Expand Down
2 changes: 1 addition & 1 deletion src/app/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ function check_callback_func(func::Function, args_count)
!hasmethod(func, NTuple{args_count, Any}) && error("The arguments of the specified callback function do not align with the currently defined callback; please ensure that the arguments to `func` are properly defined.")
end
function check_callback_func(func, args_count)
end
end
2 changes: 1 addition & 1 deletion src/components_utils/_components_utils.jl
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include("express.jl")
include("table_format.jl")
include("table_format.jl")
2 changes: 1 addition & 1 deletion src/components_utils/express.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ function dcc_send_string(writer::Function, data, filename; type = nothing)
io = IOBuffer()
writer(io, data)
return dcc_send_string(String(take!(io)), filename, type = type)
end
end
2 changes: 1 addition & 1 deletion src/components_utils/table_format.jl
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,4 @@ module TableFormat
scheme = rounded ? Scheme.percentage_rounded : Scheme.percentage
return Format(scheme = scheme, precision = decimals)
end
end
end
2 changes: 1 addition & 1 deletion src/exceptions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ end

function Base.showerror(io::IO, ex::InvalidCallbackReturnValue)
Base.write(io, "Invalid callback return value: ", ex.msg)
end
end
2 changes: 1 addition & 1 deletion src/handler/callback_context.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ function _item_to_dict!(target::Dict{String, Any}, item)
target["$(dep_id_string(item.id)).$(item.property)"] = get(item, :value, nothing)
end

_item_to_dict!(target::Dict{String, Any}, item::AbstractVector) = _item_to_dict!.(Ref(target), item)
_item_to_dict!(target::Dict{String, Any}, item::AbstractVector) = _item_to_dict!.(Ref(target), item)
2 changes: 1 addition & 1 deletion src/handler/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ function mime_by_path(path)
endswith(path, ".css") && return "text/css"
endswith(path, ".map") && return "application/json"
return nothing
end
end
2 changes: 1 addition & 1 deletion src/handler/processors/assets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ function process_assets(request::HTTP.Request, state::HandlerState; file_path::A
return HTTP.Response(404)
end

end
end
2 changes: 1 addition & 1 deletion src/handler/processors/callback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ function validate_return_item(callback_id, i, value, spec::Vector)
"""
))
end
validate_return_item(callback_id, i, value, spec) = nothing
validate_return_item(callback_id, i, value, spec) = nothing
2 changes: 1 addition & 1 deletion src/handler/processors/default_favicon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ function process_default_favicon(request::HTTP.Request, state::HandlerState)
["Content-Type" => "image/x-icon"],
body = ico_contents
)
end
end
2 changes: 1 addition & 1 deletion src/handler/processors/dependecies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ function process_dependencies(request::HTTP.Request, state::HandlerState)
["Content-Type" => "application/json"],
body = state.cache.dependencies_json
)
end
end
2 changes: 1 addition & 1 deletion src/handler/processors/index.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ function process_index(request::HTTP.Request, state::HandlerState)
["Content-Type" => "text/html"],
body = state.cache.index_string
)
end
end
2 changes: 1 addition & 1 deletion src/handler/processors/layout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ function process_layout(request::HTTP.Request, state::HandlerState)
["Content-Type" => "application/json"],
body = JSON3.write(layout_data(state.app.layout))
)
end
end
2 changes: 1 addition & 1 deletion src/handler/processors/reload_hash.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ function process_reload_hash(request::HTTP.Request, state::HandlerState)
state.reload.changed_assets = []
return HTTP.Response(200, ["Content-Type" => "application/json"], body = JSON3.write(reload_tuple))

end
end
8 changes: 4 additions & 4 deletions src/handler/processors/resource.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ function process_resource(request::HTTP.Request, state::HandlerState; namespace:
file_contents = read(joinpath(namespace_files.base_path, relative_path))
mimetype = mime_by_path(relative_path)
!isnothing(mimetype) && push!(headers, "Content-Type" => mimetype)
if is_fp
push!(headers,
if is_fp
push!(headers,
"Cache-Control" => "public, max-age=31536000" # 1 year
)
else
Expand All @@ -29,10 +29,10 @@ function process_resource(request::HTTP.Request, state::HandlerState; namespace:
request_etag == etag && return HTTP.Response(304)
end
return HTTP.Response(200, headers; body = file_contents)

catch e
!(e isa SystemError) && rethrow(e)
#TODO print to log
return HTTP.Response(404)
end
end
end
2 changes: 1 addition & 1 deletion src/init.jl
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include("init/resources.jl")
include("init/components.jl")
include("init/components.jl")
2 changes: 1 addition & 1 deletion src/init/components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ macro place_embedded_components()
return esc(
generate_embeded_components()
)
end
end
2 changes: 1 addition & 1 deletion src/init/resources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ function setup_dash_resources()
)
)
end
end
end
2 changes: 1 addition & 1 deletion src/plotly_base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ function DashBase.to_dash(p::PlotlyBase.Plot)
data = JSON.lower(p)
pop!(data, :config, nothing)
return data
end
end
2 changes: 1 addition & 1 deletion src/server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ function run_server(app::DashApp,
end
end
get_inetaddr(host::String, port::Integer) = Sockets.InetAddr(parse(IPAddr, host), port)
get_inetaddr(host::IPAddr, port::Integer) = Sockets.InetAddr(host, port)
get_inetaddr(host::IPAddr, port::Integer) = Sockets.InetAddr(host, port)
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ include("utils/paths.jl")
include("utils/fingerprint.jl")
include("utils/parse_includes.jl")
include("utils/poll.jl")
include("utils/hot_restart.jl")
include("utils/hot_restart.jl")
6 changes: 3 additions & 3 deletions src/utils/fingerprint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ const fp_version_clean = r"[^\w-]"
const fp_cache_regex = r"^v[\w-]+m[0-9a-fA-F]+$"

function build_fingerprint(path::AbstractString, version, hash_value)
path_parts = split(path, '/')
path_parts = split(path, '/')
(filename, extension) = split(path_parts[end], '.', limit = 2)
return string(
join(vcat(path_parts[1:end-1], filename), '/'),
join(vcat(path_parts[1:end-1], filename), '/'),
".v", replace(string(version), fp_version_clean=>"_"),
'm', hash_value,
'.', extension
)
end

function parse_fingerprint_path(path::AbstractString)
path_parts = split(path, '/')
path_parts = split(path, '/')
name_parts = split(path_parts[end], '.')
if length(name_parts) > 2 && occursin(fp_cache_regex, name_parts[2])
origin_path = string(
Expand Down
4 changes: 2 additions & 2 deletions src/utils/hot_restart.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function is_hot_restart_available()
return !isinteractive() && !isempty(Base.PROGRAM_FILE)
return !isinteractive() && !isempty(Base.PROGRAM_FILE)
end
function hot_restart(func::Function; check_interval = 1., env_key = "IS_HOT_RELOADABLE", suppress_warn = false)
if !is_hot_restart_available()
Expand All @@ -23,7 +23,7 @@ function hot_restart(func::Function; check_interval = 1., env_key = "IS_HOT_RELO
wait(task)
end
catch e
if e isa InterruptException
if e isa InterruptException
println("finished")
return
else
Expand Down
2 changes: 1 addition & 1 deletion src/utils/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ end

sort_by_keys(data) = (;sort!(collect(pairs(data)), by = (x)->x[1])...,)

sorted_json(data) = JSON3.write(sort_by_keys(data))
sorted_json(data) = JSON3.write(sort_by_keys(data))
2 changes: 1 addition & 1 deletion src/utils/parse_includes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ function parse_includes(file::AbstractString)
result = Set{String}()
parse_includes!(file, result)
return result
end
end
2 changes: 1 addition & 1 deletion src/utils/paths.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ function pathname_configs(url_base_pathname, requests_pathname_prefix, routes_pa
error("requests_pathname_prefix` needs to end with `routes_pathname_prefix`")

return (url_base_pathname, requests_pathname_prefix, routes_pathname_prefix)
end
end
2 changes: 1 addition & 1 deletion src/utils/poll.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ function poll_folders(on_change, folders, initial_watched; interval = 1.)
end
sleep(interval)
end
end
end
2 changes: 1 addition & 1 deletion test/aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ using Aqua
# ideally we get both these tests to work, but:
# stale_deps is ignored to help transition from DashCoreComponents
# amiguities is ignored because they originate outside the package
Aqua.test_all(Dash; ambiguities=false, stale_deps=false)
Aqua.test_all(Dash; ambiguities=false, stale_deps=false)
2 changes: 1 addition & 1 deletion test/assets_compressed/bootstrap.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/ci_prepare.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Pkg.add("HTTP")
Pkg.instantiate()
Pkg.build("Dash")
Pkg.build("HTTP")
Pkg.test("Dash", coverage=true)
Pkg.test("Dash", coverage=true)
Loading

0 comments on commit 8f82834

Please sign in to comment.