Skip to content

Conversation

pfitzseb
Copy link
Member

@pfitzseb pfitzseb commented May 16, 2025

image

Fixes #17. Fixes #73.

@@ -1,5 +1,6 @@
module FlexSearch
import Gumbo, JSON, AbstractTrees, NodeJS
import Gumbo, JSON, AbstractTrees
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
Loading an entire module instead of only the necessary identifiers might clutter the namespace unnecessarily.

To resolve this comment:

✨ Commit Assistant fix suggestion

Suggested change
import Gumbo, JSON, AbstractTrees
import Gumbo: parsehtml
import JSON: parse
import AbstractTrees: children
View step-by-step instructions
  1. Update the import statement to only import the specific functions, types, or identifiers you need from each module. For example, replace import Gumbo, JSON, AbstractTrees with something like import Gumbo: parsehtml, JSON: parse, AbstractTrees: children, depending on what you use in this file.
  2. Scan the current file and note down which functions or types are referenced from Gumbo, JSON, or AbstractTrees.
  3. Replace each module in the import statement with only the identifiers you actually use, using the syntax import Module: identifier1, identifier2.
  4. Save the updated import line and remove the general import Module form.

This helps keep the namespace clean and makes it clear which parts of each module your code depends on.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186022405) to ignore the finding created by unspecific-using-or-import.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186022405) in the Semgrep AppSec Platform.

pushfirst!(custom_scripts, joinpath("pagefind", "pagefind.js"))
pushfirst!(
custom_scripts,
Docs.HTML("window.MULTIDOCUMENTER_ROOT_PATH = '$(rootpath)'"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue, but thinks it may be safe to ignore.
Keyword arguments should be preceded by a semicolon.

Why this might be safe to ignore:

The code is simply passing a string containing an '=' and is not misusing keyword arguments. The semgrep rule's regex incorrectly matches the string literal content, so there's no meaningful code quality issue here.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186022408) to ignore the finding created by semicolon-before-keyword-arguments.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186022408) in the Semgrep AppSec Platform.

function build_search_index(root, docs, config, rootpath)
if !success(Cmd(`$(npx) pagefind -V`; dir=root))
@info "Installing pagefind into $root."
if !success(Cmd(`$(npm) install pagefind`; dir=root))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue, but thinks it may be safe to ignore.
Detected execution of OS commands.
Executing untrusted programs might result in a command injection vulnerability.
While Julia avoids some pitfalls around quoting and shemetacharacters,
when possible, you should use libraries with safe wrappers instead.

Why this might be safe to ignore:

This finding is detecting OS command execution that is part of an internal dependency management/build routine without untrusted input, so it is not currently introducing a command injection risk.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186022410) to ignore the finding created by cmd-execution.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186022410) in the Semgrep AppSec Platform.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ar

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave a comment to ignore this finding, for example:
/ar this is an acceptable risk because it's low business impact

Comment on lines +10 to +11
Docs.HTML("window.MULTIDOCUMENTER_ROOT_PATH = '$(rootpath)'"),
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue, but thinks it may be safe to ignore.
Avoid unnecessary whitespace padding inside brackets.

Why this might be safe to ignore:

The Semgrep rule was intended to catch extra whitespace padding inside parentheses, but in this context the code does not exhibit unnecessary whitespace inside the brackets as described in the rule's examples. Hence, fixing this false positive would not meaningfully improve the code.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186022409) to ignore the finding created by no-whitespace-padding.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186022409) in the Semgrep AppSec Platform.

@pfitzseb pfitzseb marked this pull request as ready for review May 16, 2025 22:56
Comment on lines 471 to +480
function inject_styles_and_global_navigation(
dir,
docs::Vector,
brand_image,
custom_stylesheets,
custom_scripts,
search_engine,
prettyurls,
rootpath,
)
dir,
docs::Vector,
brand_image,
custom_stylesheets,
custom_scripts,
search_engine,
prettyurls,
rootpath,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
Functions signatures that span multiple lines should indent each parameter line by one level.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054885) to ignore the finding created by indent-multiline-signature-params.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054885) in the Semgrep AppSec Platform.

Comment on lines 388 to +395
function make_global_nav(
dir,
docs::Vector,
thispagepath,
brand_image,
search_engine,
prettyurls,
)
dir,
docs::Vector,
thispagepath,
brand_image,
search_engine,
prettyurls,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
Functions signatures that span multiple lines should indent each parameter line by one level.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054886) to ignore the finding created by indent-multiline-signature-params.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054886) in the Semgrep AppSec Platform.

Comment on lines 178 to +194
function make(
outdir,
docs::Vector;
assets_dir = nothing,
brand_image::Union{Nothing,BrandImage} = nothing,
custom_stylesheets = [],
custom_scripts = [],
search_engine = DEFAULT_ENGINE,
prettyurls = true,
rootpath = "/",
hide_previews = true,
canonical_domain::Union{AbstractString,Nothing} = nothing,
sitemap::Bool = false,
sitemap_filename::AbstractString = "sitemap.xml",
# This keyword is for internal test use only:
_override_windows_isinteractive_check::Bool = false,
)
outdir,
docs::Vector;
assets_dir = nothing,
brand_image::Union{Nothing, BrandImage} = nothing,
custom_stylesheets = [],
custom_scripts = [],
search_engine = DEFAULT_ENGINE,
prettyurls = true,
rootpath = "/",
hide_previews = true,
canonical_domain::Union{AbstractString, Nothing} = nothing,
sitemap::Bool = false,
sitemap_filename::AbstractString = "sitemap.xml",
# This keyword is for internal test use only:
_override_windows_isinteractive_check::Bool = false,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
Functions signatures that span multiple lines should indent each parameter line by one level.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054888) to ignore the finding created by indent-multiline-signature-params.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054888) in the Semgrep AppSec Platform.

Comment on lines 18 to +21
function update_canonical_links_for_version(
docs_directory::AbstractString;
canonical::AbstractString,
)
docs_directory::AbstractString;
canonical::AbstractString,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
Functions signatures that span multiple lines should indent each parameter line by one level.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054884) to ignore the finding created by indent-multiline-signature-params.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054884) in the Semgrep AppSec Platform.

Comment on lines 34 to +35
Gumbo.hasattr(el, "id") && (
Gumbo.tag(el) in (:h1, :h2, :h3, :h4, :h5, :h6, :h7, :h8) || (
Gumbo.tag(el) == :a &&
Gumbo.tag(el) in (:h1, :h2, :h3, :h4, :h5, :h6, :h7, :h8) || (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
Avoid unnecessary whitespace padding inside brackets.

To resolve this comment:

✨ Commit Assistant fix suggestion

Suggested change
Gumbo.hasattr(el, "id") && (
Gumbo.tag(el) in (:h1, :h2, :h3, :h4, :h5, :h6, :h7, :h8) || (
Gumbo.tag(el) == :a &&
Gumbo.tag(el) in (:h1, :h2, :h3, :h4, :h5, :h6, :h7, :h8) || (
Gumbo.hasattr(el, "id") && (
Gumbo.tag(el) in (:h1, :h2, :h3, :h4, :h5, :h6, :h7, :h8) || (
Gumbo.tag(el) == :a &&
Gumbo.hasattr(el, "href") &&
Gumbo.getattr(el, "class", "") == "docstring-binding"
)
)
View step-by-step instructions
  1. Remove any unnecessary whitespace immediately after opening parentheses ( and before closing parentheses ) in your code to comply with the rule.

  2. For the code snippet provided, change:

    Gumbo.hasattr(el, "id") && (
    Gumbo.tag(el) in (:h1, :h2, :h3, :h4, :h5, :h6, :h7, :h8) || (
        Gumbo.tag(el) == :a &&
            Gumbo.hasattr(el, "href") &&
            Gumbo.getattr(el, "class", "") == "docstring-binding"
    )
    )
    

    to:

    Gumbo.hasattr(el, "id") && (
        Gumbo.tag(el) in (:h1, :h2, :h3, :h4, :h5, :h6, :h7, :h8) || (
            Gumbo.tag(el) == :a &&
            Gumbo.hasattr(el, "href") &&
            Gumbo.getattr(el, "class", "") == "docstring-binding"
        )
    )
    

    Ensure that there are no leading or trailing spaces directly inside the parentheses for all function calls and expressions.

  3. Check the remaining code for other places where there is whitespace padding directly inside parentheses and remove them. For example, change ( 1, 2 ) to (1, 2) and ( value ) to (value ) or (value) as needed.
    Whitespace inside brackets does not impact execution but can cause style and linting errors.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054857) to ignore the finding created by no-whitespace-padding.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054857) in the Semgrep AppSec Platform.

Comment on lines 255 to 256
$(versions_js_content)"""
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue, but thinks it may be safe to ignore.
Avoid unnecessary whitespace padding inside brackets.

Why this might be safe to ignore:

The matched code is inside a multi-line string/argument where the extra whitespace is part of formatting rather than a logic error. The Semgrep rule's intent is to catch unnecessary padding in simple bracket use, and this instance does not warrant a fix.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054858) to ignore the finding created by no-whitespace-padding.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054858) in the Semgrep AppSec Platform.

Comment on lines 244 to 245
$(versions_js_content)"""
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue, but thinks it may be safe to ignore.
Avoid unnecessary whitespace padding inside brackets.

Why this might be safe to ignore:

The matched code is part of string interpolation and formatting in a multi-line error message, so the extra whitespace is intentional and does not impact code quality. The regex match was a false positive.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054859) to ignore the finding created by no-whitespace-padding.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054859) in the Semgrep AppSec Platform.

Comment on lines 34 to +40
Gumbo.hasattr(el, "id") && (
Gumbo.tag(el) in (:h1, :h2, :h3, :h4, :h5, :h6, :h7, :h8) || (
Gumbo.tag(el) == :a &&
Gumbo.tag(el) in (:h1, :h2, :h3, :h4, :h5, :h6, :h7, :h8) || (
Gumbo.tag(el) == :a &&
Gumbo.hasattr(el, "href") &&
Gumbo.getattr(el, "class", "") == "docstring-binding"
)
)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
Always include a trailing comma when working with arrays, tuples or
functions arguments that span multiple lines. This allows future edits to
easily move around or add additional elements.
The trailing comma shouldn't be written when the collection is in a single line.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054883) to ignore the finding created by trailing-comma.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054883) in the Semgrep AppSec Platform.

Comment on lines 348 to +353
function make_output_structure(
docs::Vector{DropdownComponent},
prettyurls,
hide_previews;
canonical::Union{AbstractString,Nothing},
)
docs::Vector{DropdownComponent},
prettyurls,
hide_previews;
canonical::Union{AbstractString, Nothing},
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semgrep identified an issue in your code:
Functions signatures that span multiple lines should indent each parameter line by one level.

To resolve this comment:

🔧 No guidance has been designated for this issue. Fix according to your organization's approved methods.

💬 Ignore this finding

Reply with Semgrep commands to ignore this finding.

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

Alternatively, triage in [Semgrep AppSec Platform](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054887) to ignore the finding created by indent-multiline-signature-params.

You can view more details about [this finding](https://semgrep.dev/orgs/JuliaHub, Inc/findings/186054887) in the Semgrep AppSec Platform.

@semgrep-code-juliacomputing-new
Copy link
Contributor

Semgrep found 22 no-empty-return findings:

When using the return keyword always explicitly write the return value.

@pfitzseb pfitzseb merged commit 2444a00 into main May 19, 2025
8 of 11 checks passed
@ChrisRackauckas ChrisRackauckas deleted the sp/pagefind branch May 20, 2025 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with Slow Loading pagefind search
2 participants