Fix code quality violations and enhance ROUTE-EXISTS-01 rule
Implement JQHTML function cache ID system and fix bundle compilation Implement underscore prefix for system tables Fix JS syntax linter to support decorators and grant exception to Task system SPA: Update planning docs and wishlists with remaining features SPA: Document Navigation API abandonment and future enhancements Implement SPA browser integration with History API (Phase 1) Convert contacts view page to SPA action Convert clients pages to SPA actions and document conversion procedure SPA: Merge GET parameters and update documentation Implement SPA route URL generation in JavaScript and PHP Implement SPA bootstrap controller architecture Add SPA routing manual page (rsx:man spa) Add SPA routing documentation to CLAUDE.md Phase 4 Complete: Client-side SPA routing implementation Update get_routes() consumers for unified route structure Complete SPA Phase 3: PHP-side route type detection and is_spa flag Restore unified routes structure and Manifest_Query class Refactor route indexing and add SPA infrastructure Phase 3 Complete: SPA route registration in manifest Implement SPA Phase 2: Extract router code and test decorators Rename Jqhtml_Component to Component and complete SPA foundation setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,12 @@ class DefensiveCoding_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
|
||||
foreach ($lines as $line_num => $line) {
|
||||
$line_number = $line_num + 1;
|
||||
|
||||
|
||||
// Skip if line has exception comment
|
||||
if (str_contains($line, '@' . $this->get_id() . '-EXCEPTION')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip comments
|
||||
$trimmed_line = trim($line);
|
||||
if (str_starts_with($trimmed_line, '//') || str_starts_with($trimmed_line, '*')) {
|
||||
@@ -174,7 +179,7 @@ class DefensiveCoding_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
" if (result && result.redirect) // OK - result may have optional redirect\n" .
|
||||
" if (error && error.message) // OK - polymorphic error handling\n" .
|
||||
" if (options && options.callback) // OK - optional configuration\n\n" .
|
||||
"NOTE: Core guaranteed classes (Rsx, Modal, Jqhtml_Component, etc.) should NEVER be checked - let failures happen loudly during development.";
|
||||
"NOTE: Core guaranteed classes (Rsx, Modal, Component, etc.) should NEVER be checked - let failures happen loudly during development.";
|
||||
|
||||
$this->add_violation(
|
||||
$file_path,
|
||||
|
||||
@@ -39,7 +39,7 @@ class DirectAjaxApi_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
* Should use:
|
||||
* await Controller.action(params)
|
||||
* Or:
|
||||
* await Ajax.call(Rsx.Route('Controller', 'action'), params)
|
||||
* await Ajax.call(Rsx.Route('Controller::action'), params)
|
||||
*/
|
||||
public function check(string $file_path, string $contents, array $metadata = []): void
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ use App\RSpade\CodeQuality\RuntimeChecks\YoureDoingItWrongException;
|
||||
use App\RSpade\Core\Cache\RsxCache;
|
||||
|
||||
/**
|
||||
* Check Jqhtml_Component implementations for common AI agent mistakes
|
||||
* Check Component implementations for common AI agent mistakes
|
||||
* Validates that components follow correct patterns
|
||||
*/
|
||||
class JqhtmlComponentImplementation_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
@@ -24,7 +24,7 @@ class JqhtmlComponentImplementation_CodeQualityRule extends CodeQualityRule_Abst
|
||||
|
||||
public function get_description(): string
|
||||
{
|
||||
return 'Validates Jqhtml_Component subclasses follow correct patterns';
|
||||
return 'Validates Component subclasses follow correct patterns';
|
||||
}
|
||||
|
||||
public function get_file_patterns(): array
|
||||
@@ -47,8 +47,8 @@ class JqhtmlComponentImplementation_CodeQualityRule extends CodeQualityRule_Abst
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip if not a Jqhtml_Component subclass
|
||||
if (!isset($metadata['extends']) || $metadata['extends'] !== 'Jqhtml_Component') {
|
||||
// Skip if not a Component subclass
|
||||
if (!isset($metadata['extends']) || $metadata['extends'] !== 'Component') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,10 +91,10 @@ class JqhtmlComponentImplementation_CodeQualityRule extends CodeQualityRule_Abst
|
||||
$error_message .= "Class: {$class_name}\n\n";
|
||||
$error_message .= "Jqhtml components should not define a render() method.\n\n";
|
||||
$error_message .= "PROBLEM:\n";
|
||||
$error_message .= "The render() method is not part of the Jqhtml_Component lifecycle.\n";
|
||||
$error_message .= "The render() method is not part of the Component lifecycle.\n";
|
||||
$error_message .= "Jqhtml components use template files (.jqhtml) for rendering.\n\n";
|
||||
$error_message .= "INCORRECT:\n";
|
||||
$error_message .= " class My_Component extends Jqhtml_Component {\n";
|
||||
$error_message .= " class My_Component extends Component {\n";
|
||||
$error_message .= " render() {\n";
|
||||
$error_message .= " return '<div>...</div>';\n";
|
||||
$error_message .= " }\n";
|
||||
@@ -105,7 +105,7 @@ class JqhtmlComponentImplementation_CodeQualityRule extends CodeQualityRule_Abst
|
||||
$error_message .= " <%= content() %>\n";
|
||||
$error_message .= " </div>\n\n";
|
||||
$error_message .= " // JavaScript class handles logic:\n";
|
||||
$error_message .= " class My_Component extends Jqhtml_Component {\n";
|
||||
$error_message .= " class My_Component extends Component {\n";
|
||||
$error_message .= " on_ready() {\n";
|
||||
$error_message .= " // Component logic here\n";
|
||||
$error_message .= " }\n";
|
||||
@@ -136,13 +136,13 @@ class JqhtmlComponentImplementation_CodeQualityRule extends CodeQualityRule_Abst
|
||||
$error_message .= "The method '{$method_name}()' should be 'on_{$method_name}()'.\n";
|
||||
$error_message .= "Jqhtml components use specific lifecycle method names.\n\n";
|
||||
$error_message .= "INCORRECT:\n";
|
||||
$error_message .= " class My_Component extends Jqhtml_Component {\n";
|
||||
$error_message .= " class My_Component extends Component {\n";
|
||||
$error_message .= " create() { ... } // Wrong\n";
|
||||
$error_message .= " load() { ... } // Wrong\n";
|
||||
$error_message .= " ready() { ... } // Wrong\n";
|
||||
$error_message .= " }\n\n";
|
||||
$error_message .= "CORRECT:\n";
|
||||
$error_message .= " class My_Component extends Jqhtml_Component {\n";
|
||||
$error_message .= " class My_Component extends Component {\n";
|
||||
$error_message .= " on_create() { ... } // Correct\n";
|
||||
$error_message .= " on_load() { ... } // Correct\n";
|
||||
$error_message .= " on_ready() { ... } // Correct\n";
|
||||
|
||||
@@ -158,7 +158,7 @@ const walk = require('acorn-walk');
|
||||
|
||||
// Classes that are Jqhtml components
|
||||
const JQHTML_COMPONENTS = new Set([
|
||||
'Jqhtml_Component', '_Base_Jqhtml_Component', 'Component'
|
||||
'Component', '_Base_Jqhtml_Component', 'Component'
|
||||
]);
|
||||
|
||||
function analyzeFile(filePath) {
|
||||
@@ -182,7 +182,7 @@ function analyzeFile(filePath) {
|
||||
let currentClass = null;
|
||||
let inOnCreate = false;
|
||||
|
||||
// Helper to check if a class extends Jqhtml_Component
|
||||
// Helper to check if a class extends Component
|
||||
function isJqhtmlComponent(extendsClass) {
|
||||
if (!extendsClass) return false;
|
||||
return JQHTML_COMPONENTS.has(extendsClass) ||
|
||||
|
||||
@@ -66,7 +66,7 @@ class JqhtmlOnLoadData_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
// Check each class to see if it's a JQHTML component
|
||||
foreach ($js_classes as $class_name) {
|
||||
// Use Manifest to check inheritance (handles indirect inheritance)
|
||||
if (!Manifest::js_is_subclass_of($class_name, 'Jqhtml_Component') &&
|
||||
if (!Manifest::js_is_subclass_of($class_name, 'Component') &&
|
||||
!Manifest::js_is_subclass_of($class_name, 'Component')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class JqhtmlOnLoadDom_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for DOM access in on_load methods of Jqhtml_Component subclasses
|
||||
* Check for DOM access in on_load methods of Component subclasses
|
||||
*/
|
||||
public function check(string $file_path, string $contents, array $metadata = []): void
|
||||
{
|
||||
@@ -66,7 +66,7 @@ class JqhtmlOnLoadDom_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
// Check each class to see if it's a JQHTML component
|
||||
foreach ($js_classes as $class_name) {
|
||||
// Use Manifest to check inheritance (handles indirect inheritance)
|
||||
if (!Manifest::js_is_subclass_of($class_name, 'Jqhtml_Component') &&
|
||||
if (!Manifest::js_is_subclass_of($class_name, 'Component') &&
|
||||
!Manifest::js_is_subclass_of($class_name, 'Component')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class JqhtmlRenderOverride_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for render() method override in Jqhtml_Component subclasses
|
||||
* Check for render() method override in Component subclasses
|
||||
*/
|
||||
public function check(string $file_path, string $contents, array $metadata = []): void
|
||||
{
|
||||
@@ -66,7 +66,7 @@ class JqhtmlRenderOverride_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
// Check each class to see if it's a JQHTML component
|
||||
foreach ($js_classes as $class_name) {
|
||||
// Use Manifest to check inheritance (handles indirect inheritance)
|
||||
if (!Manifest::js_is_subclass_of($class_name, 'Jqhtml_Component') &&
|
||||
if (!Manifest::js_is_subclass_of($class_name, 'Component') &&
|
||||
!Manifest::js_is_subclass_of($class_name, 'Component')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ class LifecycleMethodsStatic_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
// Get class name
|
||||
$class_name = $metadata['class'];
|
||||
|
||||
// Only check classes that extend Jqhtml_Component
|
||||
if (!\App\RSpade\Core\Manifest\Manifest::js_is_subclass_of($class_name, 'Jqhtml_Component')) {
|
||||
// Only check classes that extend Component
|
||||
if (!\App\RSpade\Core\Manifest\Manifest::js_is_subclass_of($class_name, 'Component')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user