Fix code quality violations and rename select input components
Move small tasks from wishlist to todo, update npm packages Replace #[Auth] attributes with manual auth checks and code quality rule Remove on_jqhtml_ready lifecycle method from framework Complete ACL system with 100-based role indexing and /dev/acl tester WIP: ACL system implementation with debug instrumentation Convert rsx:check JS linting to RPC socket server Clean up docs and fix $id→$sid in man pages, remove SSR/FPC feature Reorganize wishlists: priority order, mark sublayouts complete, add email Update model_fetch docs: mark MVP complete, fix enum docs, reorganize Comprehensive documentation overhaul: clarity, compression, and critical rules Convert Contacts/Projects CRUD to Model.fetch() and add fetch_or_null() Add JS ORM relationship lazy-loading and fetch array handling Add JS ORM relationship fetching and CRUD documentation Fix ORM hydration and add IDE resolution for Base_* model stubs Rename Json_Tree_Component to JS_Tree_Debug_Component and move to framework Enhance JS ORM infrastructure and add Json_Tree class name badges 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\RSpade\CodeQuality;
|
||||
use App\RSpade\CodeQuality\CodeQuality_Violation;
|
||||
use App\RSpade\CodeQuality\Support\CacheManager;
|
||||
use App\RSpade\CodeQuality\Support\FileSanitizer;
|
||||
use App\RSpade\CodeQuality\Support\Js_CodeQuality_Rpc;
|
||||
use App\RSpade\CodeQuality\Support\ViolationCollector;
|
||||
use App\RSpade\Core\Manifest\Manifest;
|
||||
|
||||
@@ -409,7 +410,7 @@ class CodeQualityChecker
|
||||
}
|
||||
|
||||
/**
|
||||
* Lint JavaScript file (from monolith line 602)
|
||||
* Lint JavaScript file using RPC server
|
||||
* Returns true if syntax error found
|
||||
*/
|
||||
protected static function lint_javascript_file(string $file_path): bool
|
||||
@@ -428,70 +429,60 @@ class CodeQualityChecker
|
||||
if (str_contains($file_path, '/resource/vscode_extension/')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Create cache directory for lint flags
|
||||
$cache_dir = function_exists('storage_path') ? storage_path('rsx-tmp/cache/js-lint-passed') : '/var/www/html/storage/rsx-tmp/cache/js-lint-passed';
|
||||
if (!is_dir($cache_dir)) {
|
||||
mkdir($cache_dir, 0755, true);
|
||||
}
|
||||
|
||||
|
||||
// Generate flag file path (no .js extension to avoid IDE detection)
|
||||
$base_path = function_exists('base_path') ? base_path() : '/var/www/html';
|
||||
$relative_path = str_replace($base_path . '/', '', $file_path);
|
||||
$flag_path = $cache_dir . '/' . str_replace('/', '_', $relative_path) . '.lintpass';
|
||||
|
||||
|
||||
// Check if lint was already passed
|
||||
if (file_exists($flag_path)) {
|
||||
$source_mtime = filemtime($file_path);
|
||||
$flag_mtime = filemtime($flag_path);
|
||||
|
||||
|
||||
if ($flag_mtime >= $source_mtime) {
|
||||
// File hasn't changed since last successful lint
|
||||
return false; // No errors
|
||||
}
|
||||
}
|
||||
|
||||
// Run JavaScript syntax check using Node.js
|
||||
$linter_path = $base_path . '/bin/js-linter.js';
|
||||
if (!file_exists($linter_path)) {
|
||||
// Linter script not found, skip linting
|
||||
return false;
|
||||
}
|
||||
|
||||
$command = sprintf('node %s %s 2>&1', escapeshellarg($linter_path), escapeshellarg($file_path));
|
||||
$output = shell_exec($command);
|
||||
|
||||
|
||||
// Lint via RPC server (lazy starts if not running)
|
||||
$error = Js_CodeQuality_Rpc::lint($file_path);
|
||||
|
||||
// Check if there's a syntax error
|
||||
if ($output && trim($output) !== '') {
|
||||
if ($error !== null) {
|
||||
// Delete flag file if it exists (file now has errors)
|
||||
if (file_exists($flag_path)) {
|
||||
unlink($flag_path);
|
||||
}
|
||||
|
||||
// Parse error message for line number if available
|
||||
$line_number = 0;
|
||||
if (preg_match('/Line (\d+)/', $output, $matches)) {
|
||||
$line_number = (int)$matches[1];
|
||||
}
|
||||
|
||||
|
||||
$line_number = $error['line'] ?? 0;
|
||||
$message = $error['message'] ?? 'Unknown syntax error';
|
||||
|
||||
static::$collector->add(
|
||||
new CodeQuality_Violation(
|
||||
'JS-SYNTAX',
|
||||
$file_path,
|
||||
$line_number,
|
||||
trim($output),
|
||||
$message,
|
||||
'critical',
|
||||
null,
|
||||
'Fix the JavaScript syntax error before running other checks.'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
return true; // Error found
|
||||
}
|
||||
|
||||
|
||||
// Create flag file to indicate successful lint
|
||||
touch($flag_path);
|
||||
|
||||
|
||||
return false; // No errors
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user