Skip to content

feat: support base commit-based checks#210

Merged
daveshanley merged 1 commit intopb33f:mainfrom
lrstanley:feature/base-commit
Jun 12, 2025
Merged

feat: support base commit-based checks#210
daveshanley merged 1 commit intopb33f:mainfrom
lrstanley:feature/base-commit

Conversation

@lrstanley
Copy link
Contributor

@lrstanley lrstanley commented Jun 9, 2025

Changes in this commit

Adds a --base-commit flag, which is used as the oldest commit to compare against. This is particularly useful in a PR situation, where you want to compare against changes that occurred in the PR only.

Note that it doesn't check the differences inside of the base commit, rather, the base commit is considered the "start" of the history.

Examples:

$ openapi-changes summary \
	--limit 100 \
	--base-commit '89e8d64ac465dfd4cd11c20606df54a40943cca0' \
	./ sample-specs/petstorev3.json

$ openapi-changes summary \
	--limit 100 \
	--base-commit '89e8d64ac465dfd4cd11c20606df54a40943cca0' \
	'https://github.com/pb33f/openapi-changes/commits/main/sample-specs/petstorev3.json'

This is a simpler implementation of something like what golangci-lint does, with --new-from-rev. With the Git-directory based approach, you could probably also use the ref name, not just the commit.

Reviewer Notes

  • Almost all error reporting is currently broken, at least with openapi-changes summary
    • Errors from github checks aren't even returned, and it just hangs forever (unrelated to my changes)
    • Git related changes, though it attempts to send an "error update", still also hang forever (unrelated to my changes).
    • This might occur for commands other than summary too, I just noticed it with summary.
    • Looks like it's related to this line:
      • case update, ok := <-updateChan:
      • Because , ok is used, all other selects in that block will never be checked.
      • I'd try and fix, but this code is kind of a mess.
  • There are a lot of errors that are not checked correctly, an insane amount of code duplication, functions with too many arguments, etc. Was really hard to keep track of the changes, and feel like there needs to be a large refactoring to clean things up.

Signed-off-by: Liam Stanley <liam@liam.sh>
@daveshanley
Copy link
Member

The codebase is really a demo, it's not a production quality tool. It's a sketch so the codebase is pretty horrible. - which is why it's not made it to a feature release yet.

Most of the tool (except for the TUI) has been rebuilt by the doctor and will be backfed into this tool to bring it in line.

Copy link
Member

@daveshanley daveshanley left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for pushing through the poor code quality. It needs a complete re-do.

@daveshanley daveshanley merged commit c0c5422 into pb33f:main Jun 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments