Skip to content

Implement a possibility to create a build without starting server#44

Open
xhujerr wants to merge 2 commits intoRodrigoGonzalez:mainfrom
xhujerr:no-server
Open

Implement a possibility to create a build without starting server#44
xhujerr wants to merge 2 commits intoRodrigoGonzalez:mainfrom
xhujerr:no-server

Conversation

@xhujerr
Copy link

@xhujerr xhujerr commented Jul 11, 2025

Intro

This is to address the issue #43

Implementation

There is added an option --no-server. The code starting the server is now wrapped in an if and is skipped when the --no-server is passed.
It is attempted as a minimal change to the code. Some formatting changes were added automatically by the Python Black.

Summary by Sourcery

Add a --no-server option to allow building documentation without starting the MkDocs server.

New Features:

  • Introduce a CLI flag --no-server to skip starting the server after building

Enhancements:

  • Conditionally wrap the server startup logic based on the --no-server flag

Documentation:

  • Document the --no-server option in README
  • Add the --no-server entry to CHANGELOG for version 1.2.0

@sourcery-ai
Copy link

sourcery-ai bot commented Jul 11, 2025

Reviewer's Guide

This PR introduces a --no-server flag to conditionally skip the MkDocs server startup after building, adjusts the main execution flow accordingly, and updates documentation and changelog entries to reflect the new option.

Sequence diagram for build process with and without --no-server flag

sequenceDiagram
    actor User
    participant CLI as check_mkdocs CLI
    participant MkDocs as MkDocs
    User->>CLI: Run check_mkdocs [--no-server]
    CLI->>CLI: Parse arguments
    CLI->>MkDocs: Build documentation
    MkDocs-->>CLI: Build result
    alt --no-server flag is NOT set
        CLI->>CLI: Start MkDocs server
        CLI->>MkDocs: mkdocs serve
        MkDocs-->>CLI: Server runs briefly
        CLI->>MkDocs: Terminate server
    else --no-server flag is set
        CLI->>CLI: Skip starting server
    end
    CLI-->>User: Return status
Loading

File-Level Changes

Change Details Files
Add --no-server CLI option
  • Define new --no-server argument in argparse setup
  • Expose args.no_server with default False
src/check_mkdocs/check_mkdocs.py
Conditionalize server startup logic
  • Wrap subprocess-based server launch in if not args.no_server block
  • Retain existing error handling and shutdown sequence within the conditional
src/check_mkdocs/check_mkdocs.py
Update documentation and changelog
  • Add --no-server entry and description to README
  • Insert new version entry in CHANGELOG with the --no-server note
README.md
CHANGELOG.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @xhujerr - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `CHANGELOG.md:2` </location>
<code_context>
+## v1.2.0 (2025-07-11)
+- adedd --no-server option
+
 ## v1.2.0 (2023-08-22)
</code_context>

<issue_to_address>
Typo: 'adedd' should be 'added'.

Please change 'adedd' to 'added'.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
- adedd --no-server option
=======
- added --no-server option
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
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.

1 participant