Skip to content

Psr12#45

Open
bmfmancini wants to merge 12 commits intoCacti:developfrom
bmfmancini:PSR12
Open

Psr12#45
bmfmancini wants to merge 12 commits intoCacti:developfrom
bmfmancini:PSR12

Conversation

@bmfmancini
Copy link
Member

@bmfmancini bmfmancini commented Feb 28, 2026

This pull request introduces several improvements and refactorings to the Cacti Audit plugin, focusing on code modernization, coding standards, and enhanced developer guidance. The most significant changes include enforcing PSR-12 coding standards, renaming functions to camelCase, updating documentation, improving JavaScript variable declarations, and adding PHPUnit test support.

Code Modernization and Standards

  • Refactored all function names in setup.php from snake_case to camelCase to comply with PSR-12 standards, updated hook registrations accordingly, and added docblocks for better code clarity. [1] [2] [3] [4] [5] [6]
  • Updated references to core functions in documentation and code comments to use camelCase (e.g., auditConfigInsert, auditProcessPageData). [1] [2]

Documentation and Developer Guidance

  • Added explicit mention of PSR-12 coding standards and PHP 8.1+ requirement in the developer instructions.
  • Removed outdated or redundant instruction templates (copilot-instructions.md, opilot-instructions.md) and consolidated guidance into a single, up-to-date file.
  • Added a "Testing" section to README.md with instructions for running PHPUnit tests.

Testing and CI Improvements

  • Added a phpunit.xml.dist configuration file and a tests directory to enable PHPUnit testing for the plugin.
  • Updated GitHub Actions workflow to install PHPUnit and run tests as part of the CI pipeline. [1] [2]

JavaScript Modernization

  • Replaced var with let and const in js/functions.js for better variable scoping and code clarity. [1] [2] [3] [4]

These changes collectively improve code quality, maintainability, and developer experience for the Cacti Audit plugin.

Copy link
Member

@TheWitness TheWitness left a comment

Choose a reason for hiding this comment

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

This will not pass phpcsfixer test I don't think. Not that you have to change it, but why did you use the $create variable vs using the builtin db functions. It still works as it, just seemed unorthidox.

Beyond that it looks great. Test fails of course. We were supposed to use Pest for testing, yea I let Thomas slip one in through the cracks. But we have to fix that.

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.

2 participants