Skip to content

chore: adopt Nextcloud's coding standard, .editorconfig and NC 34 - #194

Merged
rubenvdlinde merged 7 commits into
developmentfrom
chore/nextcloud-coding-standard
Aug 12, 2026
Merged

rubenvdlinde merged 7 commits into
developmentfrom
chore/nextcloud-coding-standard

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Part of the fleet-wide move to Nextcloud's coding standard. Recipe proven on nextcloud-app-template#142; enforced from ConductionNL/.github@main by gate-65 coding-standard-adoption, which this app fails today and passes with this PR.

Policy: Conduction code must pass Nextcloud's own checks unchanged. We may be stricter, never different.

Three commits, deliberately separated

chore: config the whole review
style: reformat 397 files, whitespace only — not worth reading line by line
chore: blame-ignore .git-blame-ignore-revs naming the reformat

What changed

  • .php-cs-fixer.dist.php + conduction/coding-standard, which extends nextcloud/coding-standard and can only add to it — enforced by that package's invariant test, not by review.
  • cs:check / cs:fix now actually run php-cs-fixer. They were aliases for phpcs/phpcbf, so the documented Nextcloud command reformatted code away from Nextcloud's standard.
  • nextcloud/coding-standard dropped as a direct dependency — it arrives transitively at a tested version. Declared directly it was a dead dependency with no config file and no invocation anywhere.
  • phpcs.xml is a stub over the shared semantics-only ruleset; the local phpcs-custom-sniffs/ copy is gone. The fleet was carrying six divergent versions of NamedParametersSniff.php — a custom rule, not a setting.
  • .editorconfig, verbatim from nextcloud/server. No fleet app had one.
  • NC 34: nextcloud/ocp → ^34.0, PHPUnit → stable34. This app declared support for NC 34 while being analysed against 31, so a symbol removed in 32/33/34 was invisible to the type checker — which is why the NC 34 removal of \OC::$server needed a hand-written sniff.
  • stylelint glob quoted, so stylelint expands it rather than the shell. Unquoted, src/**/ matches exactly one directory level and nested components go unlinted.

Verification

Reformatted with a shared php-cs-fixer across all 18 apps: 9,656 files, 0 remaining findings anywhere. Every changed PHP file re-linted with php -l.

Expect red

This app's base branch already fails several quality jobs, and moving to NC 34 will surface more. That is intended — the point is to align with Nextcloud, not to keep the board green.

Configuration only. The reformat is the next commit on purpose, so
.git-blame-ignore-revs can name a revision containing nothing but whitespace.

- .php-cs-fixer.dist.php + conduction/coding-standard, which extends
  nextcloud/coding-standard and can only ADD to it — enforced by that package's
  invariant test, not by review.
- cs:check / cs:fix now run php-cs-fixer. They were aliases for phpcs/phpcbf,
  so the documented Nextcloud command reformatted code AWAY from Nextcloud's
  standard.
- nextcloud/coding-standard dropped as a direct dependency. It arrives
  transitively at a version conduction/coding-standard has tested against;
  declared directly it was a dead dependency with no config and no invocation.
- phpcs.xml is now a stub over the shared semantics-only ruleset, and the local
  phpcs-custom-sniffs/ copy is gone. The fleet was carrying six divergent
  versions of NamedParametersSniff.php — a custom RULE, not a setting.
- .editorconfig, verbatim from nextcloud/server. No fleet app had one, so an
  editor configured by someone's previous Nextcloud work defaulted to tabs,
  which the old ruleset then rejected.
- nextcloud/ocp -> ^34.0 and PHPUnit -> stable34. This app declared support for
  NC 34 while being analysed against 31, so a symbol REMOVED in 32/33/34 was
  invisible to the type checker. That is why the NC 34 removal of \OC::$server
  needed a hand-written PHPCS sniff.
- the stylelint glob is quoted, so stylelint expands it rather than the shell.
  Unquoted, src/**/ matches exactly one directory level and nested components
  are silently unlinted.

gate-65 (coding-standard-adoption) enforces all of the above from
ConductionNL/.github@main. This app failed it; with this commit it passes.
Applied by php-cs-fixer with conduction/coding-standard. Tabs, same-line braces,
(int)$x, single-space concatenation, ordered imports — Nextcloud's dialect, which
this app now passes unchanged. 397 file(s), no behaviour change.

Isolated from the configuration change so .git-blame-ignore-revs can name a
revision that touches nothing but formatting. Reviewing it line by line is not a
useful activity; the previous commit is the review.
b2af4be touches 397 files and changes no behaviour. Without this, every line it
reflowed attributes to it and the real author is one --skip away.

GitHub honours the file automatically; locally it needs
`git config blame.ignoreRevsFile .git-blame-ignore-revs` once.
The previous commit changed composer.json without touching the lock, so
`composer install` refused with exit 4 and EVERY PHP job failed:

    Required (in require-dev) package "conduction/coding-standard" is not
    present in the lock file.
    Required (in require-dev) package "conduction/hydra-gates" is not present
    in the lock file.
    Required (in require-dev) package "nextcloud/ocp" is in the lock file as
    "v31.0.9" but that does not satisfy your constraint "^34.0".

Nothing was wrong with the reformat or the ruleset — the jobs never got as far
as running a tool. Measured on larpingapp#313 before this fix: phpcs, psalm,
phpstan and both PHPUnit legs red, all of them at `composer install`. Hydra
Gates passed in the same run, because it does not install composer
dependencies.

Now locked at conduction/coding-standard v1.0.0, conduction/hydra-gates v1.7.0,
nextcloud/ocp v34.0.2 — the last of which is the point of the exercise: this app
declares support for NC 34 and is now analysed against it.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/hermiq @ b996170

Check PHP Vue Security License Tests
lint ❌
phpcs ❌
phpmd ❌
psalm ❌
phpstan ❌
phpmetrics ❌
eslint ✅
stylelint ❌
build ✅
check-specs ✅
check-manifest ✅
test-l10n ✅
composer ❌ ❌
npm ✅ ✅ 746/746
PHPUnit ❌
Newman ❌
Playwright ❌
Hydra gates ❌

Quality workflow — 2026-08-12 10:10 UTC

Download the full PDF report from the workflow artifacts.

@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/hermiq @ 868cf00

Check PHP Vue Security License Tests
lint ✅
phpcs ❌
phpmd ✅
psalm ✅
phpstan ❌
phpmetrics ✅
eslint ✅
stylelint ❌
build ✅
check-specs ✅
check-manifest ✅
test-l10n ✅
composer ✅ ✅ 119/119
npm ✅ ✅ 746/746
PHPUnit ✅
Newman ✅
Playwright ✅
Hydra gates ❌

Quality workflow — 2026-08-12 10:22 UTC

Download the full PDF report from the workflow artifacts.

…ruleset surfaces

composer install succeeds here, so unlike the other apps in this migration
the phpcs job actually reached the tool and reported real findings:

  FOUND 10 ERRORS ... PEAR.Commenting.FunctionComment.ParamCommentAlignmentExceeded
  Line exceeds maximum limit of 150 characters; contains 160 / 153 / 210 / 182 / 182

Two distinct causes.

1. Five over-length lines, all the same shape: a long @return type whose
   description continues on the next line, aligned past column 150. The
   descriptions move into the docblock body. Nothing about the contract
   changes; the text stops being pushed off the right edge.

2. Ten ParamCommentAlignmentExceeded on RunTokenService::mint(). The shared
   ruleset switches PEAR's alignment codes off individually — including
   ParamCommentAlignment — because alignment is php-cs-fixer's job now. It
   does not switch off the sibling code PEAR emits when the comment is
   aligned too FAR right: ParamCommentAlignmentExceeded. This block's
   continuation lines sit at 33 spaces where the sniff computes 29, so the
   only app in the fleet with a wide param-comment block is the only one
   that trips it. Re-indented to 29. The gap in the shared ruleset is
   reported separately; this app does not work around it locally.

Measured locally on php 8.3.33 with the branch's own vendor tree:
`phpcs --standard=phpcs.xml` exits 0 (3 @SPEC warnings remain, which
ignore_warnings_on_exit deliberately does not fail on), and
`php-cs-fixer fix --dry-run` finds 0 of 396 files to fix — so the
re-indent is stable and the two tools are not arguing.
The App Store's info.xsd declares <info> and its children as xs:sequence, so
element ORDER is significant. This file was rejected by
`xmllint --noout --schema info.xsd appinfo/info.xml`. Nextcloud's
lint-info-xml workflow validates against exactly that schema, and
ConductionNL/.github#383 adds the same check to the shared pipeline.

Elements were moved into the schema's order. Nothing was added, removed or
reworded; <version> and the <nextcloud> min/max-version declaration are
unchanged.

Verified: `xmllint --noout --schema info.xsd appinfo/info.xml` reports
"validates" (libxml2 2.12.10). The pre-change file failed the same command.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/hermiq @ 4255112

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ❌
phpmetrics ✅
eslint ✅
stylelint ❌
build ✅
check-specs ✅
check-manifest ✅
test-l10n ✅
composer ✅ ✅ 119/119
npm ✅ ✅ 746/746
PHPUnit ✅
Newman ✅
Playwright ❌
Hydra gates ❌

Quality workflow — 2026-08-12 10:44 UTC

Download the full PDF report from the workflow artifacts.

@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/hermiq @ fb6fef9

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ❌
phpmetrics ✅
eslint ✅
stylelint ❌
build ✅
check-specs ✅
check-manifest ✅
test-l10n ✅
composer ✅ ✅ 119/119
npm ✅ ✅ 746/746
PHPUnit ✅
Newman ✅
Playwright ✅
Hydra gates ❌

Quality workflow — 2026-08-12 10:55 UTC

Download the full PDF report from the workflow artifacts.

PHPStan (12 errors). OCP 34 rewrote OCP\Server::get()'s docblock: v31.0.9
carried a plain '@return T|mixed', which PHPStan resolves to mixed, so
Server::get(self::BROKER_CLASS) produced an untyped object. v34.0.2 drops
the plain @return and keeps only the conditional
'@psalm-return ($serviceName is class-string<T> ? T : mixed)', so PHPStan
now resolves the literal class-string constant to the real class and reads
our own tests/Stubs CredentialBrokerService. Two stub-fidelity gaps then
surfaced:
- request() promised array{status: int, headers: ..., body: string} with
  all keys required, making the callers' '?? ' fallbacks look redundant.
  The keys are now optional. The broker is a SOFT boundary reached through
  a class_exists() probe, so hermiq runs against whatever openregister
  version is installed and cannot promise a key is present; the callers
  defend each one, and the stub should not contradict them.
- resolveInjectable() was missing entirely. Added with the signature
  ProviderFactory::resolveCliToken() already documents (string|null, where
  null is a routing signal rather than a denial).

No application code changed; both fixes are in the analysis stub.

stylelint: 16 rule-empty-line-before errors, all auto-fixed. They were
never linted before because the glob was unquoted, so the shell expanded
'src/**/*.vue' to 'src/*/*.vue' and never reached
src/components/<dir>/<file>.vue. The check script was quoted in the config
commit; the stylelint-fix script is now quoted to match, so fix and check
cover the same set.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/hermiq @ 8a348bc

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-specs ✅
check-manifest ✅
test-l10n ✅
composer ✅ ✅ 119/119
npm ✅ ✅ 746/746
app:check-code ⏭️
info.xml ✅
REUSE ❌
PHPUnit ✅
Newman ✅
Playwright ✅
Hydra gates ❌

Quality workflow — 2026-08-12 12:44 UTC

Download the full PDF report from the workflow artifacts.

@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/hermiq @ 8a348bc

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-specs ✅
check-manifest ✅
test-l10n ✅
composer ✅ ✅ 119/119
npm ✅ ✅ 746/746
app:check-code ⏭️
info.xml ✅
REUSE ❌
PHPUnit ✅
Newman ✅
Playwright ✅
Hydra gates ❌

Quality workflow — 2026-08-12 13:10 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit bfc7cea into development Aug 12, 2026
64 of 68 checks passed
@rubenvdlinde
rubenvdlinde deleted the chore/nextcloud-coding-standard branch August 12, 2026 23: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.

1 participant