Skip to content

CI: Add docbook-cs linting#5524

Open
jordikroon wants to merge 12 commits into
php:masterfrom
jordikroon:feature/docbook-cs
Open

CI: Add docbook-cs linting#5524
jordikroon wants to merge 12 commits into
php:masterfrom
jordikroon:feature/docbook-cs

Conversation

@jordikroon
Copy link
Copy Markdown
Member

@jordikroon jordikroon commented Apr 29, 2026

As announced here: https://news-web.php.net/php.doc/969388652
See for test implementation: #5510

The sniffer includes:

This also makes check-whitespaces.xml obsolete, as the sniffer will check for that as well.

The sniffer also covers #5445

  • <simpara> should be used instead of <para>
  • Exception or error class names wrapped in <classname> that should use <exceptionname> instead.
  • Whitespace checks (.github/workflows/check-whitespace.yml became obsolete)
  • Ensuring that when an element has both xml and xmlns attributes or xmlns variants, xml appears first (covers Add CI warning for xml:id before xmlns attribute order #5445)

Copy link
Copy Markdown
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

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

Some remarks for the workflow definition. Didn't look at the tool itself, but the premise sounds good to me.

Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml
@TimWolla TimWolla requested a review from Girgias April 29, 2026 19:15
Copy link
Copy Markdown
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

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

Some more quick GHA comments. Will need to think about the git / checkout usage more at a later point.

Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml
Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread docbookcs.xml Outdated
@jordikroon
Copy link
Copy Markdown
Member Author

I am planning to merge Docbook-cs in a few days as all feedback has been addressed. Please let me know if there are comments, objections or concerns regarding this new tool. So to say any feedback is welcome.

Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml Outdated
Comment thread .github/workflows/docbook-cs.yml Outdated
@jordikroon jordikroon force-pushed the feature/docbook-cs branch from c598aa5 to a3acc00 Compare June 1, 2026 19:17
@jordikroon jordikroon force-pushed the feature/docbook-cs branch from a3acc00 to 281502f Compare June 1, 2026 19:20
Comment thread .github/workflows/docbook-cs.yml Outdated
- name: "Fetch base branch with merge-base"
working-directory: "${{ matrix.language }}"
run: |
git fetch origin ${{ github.base_ref }} --depth=50
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wanted to double-check what github.base_ref does. It is documented as:

The base_ref or target branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is either pull_request or pull_request_target.

This means that it doesn't do the right thing for the push: trigger. Can you double-check on your fork with by removing the branch restriction on the push: trigger and observing the CI for the feature/docbook-cs branch in your fork?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I have been doing some tested and that variable is indeed empty on push.

Any thoughts on this commit before I implement it in this PR?
jordikroon@ba77f57

In short. It fallbacks to github.event.before. And github.event.pull_request.base.sha also seems a little bit better as it will just pick the hash instead of the branch name. On push it will compare against the previous commit hash. On PR it will compare against the base sha.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you try ${{ case(github.event_name == 'pull_request', github.event.pull_request.base.sha, github.event_name == 'push', github.event.before, 'INVALID') }} or similar for clarity? Other than that it looks good to me, I particularly add the added shell quoting (that would've been a follow-up request, depending on how your solution would've looked).

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.

4 participants