Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add codespell action #4556

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
18 changes: 18 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Run codespell on source files

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
ignore_words_list: indexin,doubleclick,Heros
skip: '*.js,*.vert,*.ai,*.frag,*.geom'
only_warn: 1
2 changes: 1 addition & 1 deletion .github/workflows/enforce_news.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Enforce changelog"
name: Enforce changelog
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

## [0.21.13] - 2024-10-07

- Optimize SpecApi, re-use Blocks better and add API to access the created block objects [#4354](https://github.com/MakieOrg/Makie.jl/pull/4354).
- Optimize SpecApi, reuse Blocks better and add API to access the created block objects [#4354](https://github.com/MakieOrg/Makie.jl/pull/4354).
- Fixed `merge(attr1, attr2)` modifying nested attributes in `attr1` [#4416](https://github.com/MakieOrg/Makie.jl/pull/4416)
- Fixed issue with CairoMakie rendering scene backgrounds at the wrong position [#4425](https://github.com/MakieOrg/Makie.jl/pull/4425)
- Fixed incorrect inverse transformation in `position_on_plot` for lines, causing incorrect tooltip placement in DataInspector [#4402](https://github.com/MakieOrg/Makie.jl/pull/4402)
Expand Down Expand Up @@ -247,7 +247,7 @@

## [0.20.5] - 2024-01-25

- Use plot plot instead of scene transform functions in CairoMakie, fixing missplaced h/vspan. [#3552](https://github.com/MakieOrg/Makie.jl/pull/3552)
- Use plot plot instead of scene transform functions in CairoMakie, fixing misplaced h/vspan. [#3552](https://github.com/MakieOrg/Makie.jl/pull/3552)
- Fix error printing on shader error [#3530](https://github.com/MakieOrg/Makie.jl/pull/3530).
- Update pagefind to 1.0.4 for better headline search [#3534](https://github.com/MakieOrg/Makie.jl/pull/3534).
- Remove unnecessary deps, e.g. Setfield [3546](https://github.com/MakieOrg/Makie.jl/pull/3546).
Expand Down Expand Up @@ -623,7 +623,7 @@ All other changes are collected [in this PR](https://github.com/MakieOrg/Makie.j

## [0.15.2] - 2021-08-26

- Reenabled Julia 1.3 support.
- Re-enabled Julia 1.3 support.
- Use [MathTexEngine v0.2](https://github.com/Kolaru/MathTeXEngine.jl/releases/tag/v0.2.0).
- Depend on new GeometryBasics, which changes all the Vec/Point/Quaternion/RGB/RGBA - f0 aliases to just f. For example, `Vec2f0` is changed to `Vec2f`. Old aliases are still exported, but deprecated and will be removed in the next breaking release. For more details and an upgrade script, visit [GeometryBasics#97](https://github.com/JuliaGeometry/GeometryBasics.jl/pull/97).
- Added `hspan!` and `vspan!` functions [#1264](https://github.com/MakieOrg/Makie.jl/pull/1264).
Expand Down
2 changes: 1 addition & 1 deletion CairoMakie/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ to_uint32_color(c) = reinterpret(UInt32, convert(ARGB32, premultiplied_rgba(c)))

# handle patterns
function Cairo.CairoPattern(color::Makie.AbstractPattern)
# the Cairo y-coordinate are fliped
# the Cairo y-coordinate are flipped
bitmappattern = reverse!(ARGB32.(Makie.to_image(color)); dims=2)
cairoimage = Cairo.CairoImageSurface(bitmappattern)
cairopattern = Cairo.CairoPattern(cairoimage)
Expand Down
6 changes: 3 additions & 3 deletions GLMakie/experiments/shaderabstr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ disp = display(Makie.mesh(m, show_axis=false));
mesh_normals = GeometryBasics.normals(positions, triangles)
coords = meta(positions, color=xyz_vertex_color, normals=mesh_normals)
vertexcolor_mesh = GeometryBasics.Mesh(coords, triangles)
scren = mesh(vertexcolor_mesh, show_axis=false) |> display
screen = mesh(vertexcolor_mesh, show_axis=false) |> display


function getter_function(io::IO, ::Fragment, sampler::Sampler, name::Symbol)
Expand Down Expand Up @@ -116,13 +116,13 @@ texsampler = Makie.sampler(rand(RGBf, 4, 4), uv)
coords = meta(positions, color=texsampler, normals=mesh_normals)
texture_mesh = GeometryBasics.Mesh(coords, triangles)

scren = mesh(texture_mesh, show_axis=false) |> display
screen = mesh(texture_mesh, show_axis=false) |> display

texsampler = Makie.sampler(:viridis, rand(length(positions)))
coords = meta(positions, color=texsampler, normals=mesh_normals)
texture_mesh = GeometryBasics.Mesh(coords, triangles)

scren = mesh(texture_mesh, show_axis=false) |> display
screen = mesh(texture_mesh, show_axis=false) |> display



Expand Down
2 changes: 1 addition & 1 deletion GLMakie/src/GLAbstraction/GLInfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function getAttributesInfo(p::GLProgram)
@show activeAttr = glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES)
# get location and type for each attrib
for i=0:activeAttr-1
@show name, typ, siz = glGetActiveAttrib(program, i)
@show name, typ, size = glGetActiveAttrib(program, i)
@show loc = glGetAttribLocation(program, name)
end
end
Expand Down
8 changes: 4 additions & 4 deletions GLMakie/src/GLAbstraction/GLTexture.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function Texture(
texture::Texture{T, NDim}
end
export resize_nocopy!
function resize_nocopy!(t::Texture{T, ND}, newdims::NTuple{ND, Int}) where {T, ND}
function resize_nocopy!(t::Texture{T, NDim}, newdims::NTuple{NDim, Int}) where {T, NDim}
bind(t)
glTexImage(t.texturetype, 0, t.internalformat, newdims..., 0, t.format, t.pixeltype, C_NULL)
t.size = newdims
Expand Down Expand Up @@ -324,8 +324,8 @@ function gpu_setindex!{T}(target::Texture{T, 2}, source::Texture{T, 2}, fbo=glGe
end
=#
# Implementing the GPUArray interface
function gpu_data(t::Texture{T, ND}) where {T, ND}
result = Array{T, ND}(undef, size(t))
function gpu_data(t::Texture{T, NDim}) where {T, NDim}
result = Array{T, NDim}(undef, size(t))
unsafe_copy!(result, t)
return result
end
Expand Down Expand Up @@ -370,7 +370,7 @@ function gpu_resize!(t::TextureBuffer{T}, newdims::NTuple{1, Int}) where T
t
end
# Resize Texture
function gpu_resize!(t::Texture{T, ND}, newdims::NTuple{ND, Int}) where {T, ND}
function gpu_resize!(t::Texture{T, NDim}, newdims::NTuple{NDim, Int}) where {T, NDim}
# dangerous code right here...Better write a few tests for this
newtex = similar(t, newdims)
old_size = size(t)
Expand Down
4 changes: 2 additions & 2 deletions GLMakie/src/screen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ function singleton_screen(debugging::Bool)
close(screen; reuse=false)
else
@debug("new singleton screen")
# reuse=false, because we "manually" re-use the singleton screen!
# reuse=false, because we "manually" reuse the singleton screen!
screen = empty_screen(debugging; reuse=false)
push!(SINGLETON_SCREEN, screen)
end
Expand Down Expand Up @@ -656,7 +656,7 @@ end
close(screen::Screen; reuse=true)

Closes screen and empties it.
Doesn't destroy the screen and instead frees it to be re-used again, if `reuse=true`.
Doesn't destroy the screen and instead frees it to be reused again, if `reuse=true`.
"""
function Base.close(screen::Screen; reuse=true)
@debug("Close screen!")
Expand Down
2 changes: 1 addition & 1 deletion ReferenceTests/src/tests/generic_components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
end

#=
For Verfication
For Verification
Note that the text only marks the index in the picking list. The position
that is closest (that pick_sorted used) is somewhere else in the marked
element. Check scene2 to see the pickable regions if unsure
Expand Down
2 changes: 1 addition & 1 deletion ReferenceTests/src/tests/updating.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ end
save(path, vso)
compare_videos(reference, path, dir)
end
# We re-use ramstepper, to add our array of frames to the reference image comparison
# We reuse ramstepper, to add our array of frames to the reference image comparison
return Makie.RamStepper(fig, Makie.current_backend().Screen(fig.scene), reference, :png)
end
end
Expand Down
2 changes: 1 addition & 1 deletion WGLMakie/src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ end

function render_with_init(screen::Screen, session::Session, scene::Scene)
# Reference to three object which gets set once we serve this to a browser
# Make sure it's a new Channel, since we may re-use the screen.
# Make sure it's a new Channel, since we may reuse the screen.
screen.plot_initialized = Channel{Any}(1)
screen.session = session
Makie.push_screen!(scene, screen)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/explanations/conversion_pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ The viewers position and orientation is set by either the the camera controller
## Coordinate spaces

Currently `Makie` defines 4 coordinate spaces: :data, :clip, :relative and :pixel.
The example above shows te conversion pipeline for `space = :data`.
The example above shows the conversion pipeline for `space = :data`.

For `space = :clip` we consider `plot.converted` to be in clip space, meaning that `transform_func`, `model`, `view` and `projection` can be skipped, and `Float32Convert` only does a cast to Float32.
The x and y direction correspond to right and up, with z increasing towards the viewer.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/explanations/specapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ ax.then() do actual_axis_object
end
end
```
Note, that the callback must be pure, since the objects will get re-used and the callback will be called again.
Note, that the callback must be pure, since the objects will get reused and the callback will be called again.
To allow `on` or `onany`, one can return an array of `ObserverFunctions` or single one as in the above example.
```julia
ax.then() do ax
Expand All @@ -334,7 +334,7 @@ ax.then() do ax
obs_array = onany(f3, some_obs1, some_obs2)
return [obs1, obs2, obs_array...]
end
This allows the SpecApi to clean up the callbacks on re-use.
This allows the SpecApi to clean up the callbacks on reuse.
Note that things like `hidedecorations!(axis)` is not yet supported, since we will need some better book keeping of what got mutated by that call.
One of the few functions that's already supported is `linkaxes!`:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/reference/blocks/axis.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ You can check which interactions are currently active by calling `interactions(a

#### Activating and deactivating interactions

Often, you don't want to remove an interaction entirely but only disable it for a moment, then reenable it again.
Often, you don't want to remove an interaction entirely but only disable it for a moment, then re-enable it again.
You can use the functions `activate_interaction!(ax, name::Symbol)` and `deactivate_interaction!(ax, name::Symbol)` for that.

#### `Function` interaction
Expand Down
2 changes: 1 addition & 1 deletion docs/src/reference/plots/datashader.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ hidedecorations!(ax)
fig
```

We can also re-use the previous NYC example for a categorical plot:
We can also reuse the previous NYC example for a categorical plot:
```julia
@time begin
f = Figure(figure_padding=0, size=(1200, 600))
Expand Down
4 changes: 2 additions & 2 deletions metrics/ttfp/run-benchmark.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#= TODOs
1) Use one GH-Action job in the end to merge all results and comment in one go (instead of merging with existing comment)
2) Improve analysis of benchmark resutls to account for the variance in the benchmarks.
2) Improve analysis of benchmark results to account for the variance in the benchmarks.
3) Upload raw benchmark data as artifacts to e.g. create plots from It
=#

Expand Down Expand Up @@ -43,7 +43,7 @@ end

function make_project_folder(name)
result = "$name-benchmark.json"
isfile(result) && rm(result) # remove old benchmark resutls
isfile(result) && rm(result) # remove old benchmark results
project = joinpath(@__DIR__, "benchmark-projects", name)
# It seems, that between julia versions, the manifest must be deleted to not get problems
isdir(project) && rm(project; force=true, recursive=true)
Expand Down
2 changes: 1 addition & 1 deletion src/colorsampler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ function ColorMapping(
T = _array_value_type(color)
color_tight = Observable{T}(color)
# We need to copy, to check for changes
# Since users may re-use the array when pushing updates
# Since users may reuse the array when pushing updates
last_colors = copy(color)
on(colors_obs) do new_colors
if new_colors !== last_colors
Expand Down
2 changes: 1 addition & 1 deletion src/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ function convert_arguments(
end

function convert_arguments(::Type{<:Mesh}, geom::GeometryPrimitive{N, T}) where {N, T <: Real}
# we convert to UV mesh as default, because otherwise the uv informations get lost
# we convert to UV mesh as default, because otherwise the uv information gets lost
# - we can still drop them, but we can't add them later on
m = GeometryBasics.mesh(geom; pointtype=Point{N,float_type(T)}, uv=Vec2f, normaltype=Vec3f, facetype=GLTriangleFace)
return (m,)
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"""
expand_dimensions(trait, args...) = nothing

expand_dimensions(::PointBased, y::VecTypes) = nothing # VecTypes are nd points
expand_dimensions(::PointBased, y::VecTypes) = nothing # VecTypes are n dimensional points

Check warning on line 135 in src/interfaces.jl

View check run for this annotation

Codecov / codecov/patch

src/interfaces.jl#L135

Added line #L135 was not covered by tests
expand_dimensions(::PointBased, y::RealVector) = (keys(y), y)
expand_dimensions(::PointBased, y::OffsetVector{<:Real}) =
(OffsetArrays.no_offset_view(keys(y)), OffsetArrays.no_offset_view(y))
Expand Down
4 changes: 2 additions & 2 deletions src/makielayout/lineaxis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function update_ticklabel_node(
else
Point2f(flipped ? ticklabelgap : -ticklabelgap, 0f0)
end
# re-use already allocated array
# reuse already allocated array
result = ticklabel_annotation_obs[]
empty!(result)
for i in 1:min(length(tickstrings), length(tickpositions))
Expand All @@ -168,7 +168,7 @@ end

function update_tick_obs(tick_obs, horizontal::Observable{Bool}, flipped::Observable{Bool}, tickpositions, tickalign, ticksize, spinewidth)
result = tick_obs[]
empty!(result) # re-use allocated array
empty!(result) # reuse allocated array
sign::Int = flipped[] ? -1 : 1
if horizontal[]
for tp in tickpositions
Expand Down
4 changes: 2 additions & 2 deletions src/scenes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ end
function center!(scene::Scene, padding=0.01, exclude = not_in_data_space)
bb = boundingbox(scene, exclude)
w = widths(bb)
padd = w .* padding
bb = Rect3d(minimum(bb) .- padd, w .+ 2padd)
pad = w .* padding
bb = Rect3d(minimum(bb) .- pad, w .+ 2pad)
update_cam!(scene, bb)
scene
end
Expand Down
18 changes: 9 additions & 9 deletions src/specapi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
const Layoutable = Union{GridLayout,Block}
const LayoutableSpec = Union{GridLayoutSpec,BlockSpec}
const LayoutEntry = Pair{GridLayoutPosition,LayoutableSpec}
# We use this to decide if we can re-use a plot.
# We use this to decide if we can reuse a plot.
# (nesting_level_in_layout, position_in_layout, spec)
const LayoutableKey = Tuple{Int,GridLayoutPosition,LayoutableSpec}

Expand Down Expand Up @@ -357,7 +357,7 @@
function find_reusable_plot(scene::Scene, plotspec::PlotSpec, plots::IdDict{PlotSpec,Plot}, scores)
function penalty(key, score)
# penalize plots with different parents
# needs to be implemented via this penalty function, since parent scenes arent part of the spec

Check failure on line 360 in src/specapi.jl

View workflow job for this annotation

GitHub Actions / check

arent ==> aren't
plot = plots[key]
move_to_penalty = ((!Makie.supports_move_to(plot)) * 100) + 1
return norm(Float64[plot.parent !== scene, score]) * move_to_penalty
Expand Down Expand Up @@ -456,8 +456,8 @@
end
end
# Cycling needs to be handled separately sadly,
# since they're implicitly mutating attributes, e.g. if I re-use a plot
# that has been on cycling position 2, and now I re-use it for the first plot in the list
# since they're implicitly mutating attributes, e.g. if I reuse a plot
# that has been on cycling position 2, and now I reuse it for the first plot in the list
# it will need to change to the color of cycling position 1
if haskey(plot, :cycle)
cycle = get_cycle_for_plottype(plot.cycle[])
Expand Down Expand Up @@ -610,7 +610,7 @@
new_plots[plotspec] = plot_obj
else
@debug("updating old plot with spec")
# Delete the plots from reusable_plots, so that we don't re-use it multiple times!
# Delete the plots from reusable_plots, so that we don't reuse it multiple times!
delete!(reusable_plots, old_spec)
if reused_plot.parent !== scene
@assert Makie.supports_move_to(reused_plot)
Expand Down Expand Up @@ -642,7 +642,7 @@
# Updating them all at once in the end avoids problems with triggering updates while updating
# And at some point we may be able to optimize notify(list_of_observables)
empty!(scene.cycler.counters) # Reset Cycler
# diff_plotlist! deletes all plots that get re-used from unused_plots
# diff_plotlist! deletes all plots that get reused from unused_plots
# so, this will become our list of unused plots!
diff_plotlist!(scene, plotspecs, obs_to_notify, plotlist, unused_plots, new_plots)
# Next, delete all plots that we haven't used
Expand Down Expand Up @@ -903,7 +903,7 @@
push!(new_layoutables, (nesting, position, spec) => (new_layoutable, obs))
else
@debug("updating old block with spec")
# Make sure we don't double re-use a layoutable
# Make sure we don't double reuse a layoutable
splice!(previous_contents, idx)
(_, _, old_spec) = old_key
(layoutable, plot_obs) = layoutable_obs
Expand Down Expand Up @@ -936,8 +936,8 @@

function update_gridlayout!(target_layout::GridLayout, layout_spec::GridLayoutSpec, unused_layoutables,
new_layoutables, unused_plots, new_plots)
# For each update we look into `unused_layoutables` to see if we can re-use a layoutable (GridLayout/Block).
# Every re-used layoutable and every newly created gets pushed into `new_layoutables`,
# For each update we look into `unused_layoutables` to see if we can reuse a layoutable (GridLayout/Block).
# Every reused layoutable and every newly created gets pushed into `new_layoutables`,
# while it gets removed from `unused_layoutables`.
empty!(new_layoutables)
update_gridlayout!(
Expand Down Expand Up @@ -982,7 +982,7 @@
# return
# end
# Finally transfer all new_layoutables into reusable_layoutables,
# since in the next update they will be the once we re-use
# since in the next update they will be the once we reuse
append!(unused_layoutables, new_layoutables)
unique!(unused_layoutables)
return
Expand Down
6 changes: 3 additions & 3 deletions src/utilities/texture_atlas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ function write_array(io::IO, array::AbstractArray)
end

function read_array(io::IO, T)
nd = read(io, Int32)
size = Vector{Int32}(undef, nd)
ndims = read(io, Int32)
size = Vector{Int32}(undef, ndims)
read!(io, size)
array = Array{T}(undef, size...)
read!(io, array)
Expand Down Expand Up @@ -325,7 +325,7 @@ The padding is in units after downscaling!
function sdistancefield(img, downsample, pad)
# we pad before downsampling, so we need to have `downsample` as much padding
pad = downsample * pad
# padd the image
# pad the image
padded_size = size(img) .+ 2pad

# for the downsampling, we need to make sure that
Expand Down
4 changes: 2 additions & 2 deletions test/specapi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ end
@test first(ax.then_observers).f === println

pl[1] = S.GridLayout(S.Axis(title="interaction"))
@test real_ax === f.content[1] # re-use axis
@test real_ax === f.content[1] # reuse axis
@test length(mpos.listeners) == 1
@test mpos.listeners[1][2] !== println
end

@testset "Blockspec re-use" begin
@testset "Blockspec reuse" begin
ax1 = S.Axis(; title="Title 1")
ax2 = S.Axis(; title="Title 2")
ax3 = S.Axis(; title="Title 3")
Expand Down
Loading