
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node-red-contrib-code-analyzer
Advanced tools
A Node-RED package that provides a background service to detect debugging artifacts in function nodes across Node-RED flows. Features performance monitoring (CPU, memory, event loop), queue monitoring, and Slack alerting.
A comprehensive Node-RED package that provides static code analysis, performance monitoring, queue monitoring, and IDE-like development helpers to enhance your Node-RED development experience with intelligent debugging and observability features.
The analyzer provides 3 levels of detection strictness:
Detects only the most critical debugging artifacts:
return; statements at the function's top level (not inside blocks)Includes Level 1 plus:
TODO:, FIXME:)Includes Level 2 plus:
= "test", = "debug", = "temp", = 123The analyzer includes intelligent unused variable detection that identifies variables declared but never referenced in your code. This feature helps keep your Node-RED functions clean and performant by flagging potential dead code.
msg, node, context, flow, global, env, RED)_unused) are ignored// ❌ Will be flagged as unused
let unusedVariable = "some value";
let data = fetchData();
// ✅ Will NOT be flagged (Node-RED globals)
let msg = {};
let node = RED.nodes.getNode(this);
// ✅ Will NOT be flagged (underscore prefix)
let _temp = "intentionally unused";
// ✅ Will NOT be flagged (function parameters)
function processData(input, options) {
return input.value; // 'options' is not flagged
}
// Usage example that avoids unused variable warnings
let data = fetchData();
let result = processData(data);
node.send({payload: result});
When multiple variables are declared on one line, only the unused ones are highlighted:
let used = 1, unused = 2, alsoUsed = 3;
console.log(used, alsoUsed);
// Only 'unused' will be flagged and highlighted
The analyzer provides IDE-like navigation for flow variables, allowing you to instantly jump from flow.get() calls to their corresponding flow.set() definitions within the same flow.
Navigate from any flow.get() call to its definition:
flow.get('variableName') callsflow.set('variableName', value) location// Click on 'userData' in this line:
let user = flow.get('userData');
// Automatically navigates to:
flow.set('userData', { name: 'John', id: 123 });
When multiple flow.set() calls exist for the same variable, a beautiful dropdown selector appears:
flow.set() and flow.get() calls in the same flow for best navigationThe analyzer includes a comprehensive web-based dashboard that provides real-time insights into code quality trends, technical debt accumulation, and system performance metrics.
The dashboard uses a sophisticated scoring algorithm that considers:
Access the dashboard through:
/code-analyzer/dashboard in your Node-RED instanceThe dashboard is designed for minimal performance impact:
The analyzer provides intelligent hover tooltips that display the actual runtime values of flow and environment variables directly in your code editor, similar to modern IDEs like VS Code.
Simply hover over any flow.get() or env.get() call to see its current value:
// Hover over these to see their values:
let userData = flow.get('userProfile'); // Shows: Flow variable: userProfile
let apiKey = env.get('api_secret'); // Shows: Env variable: api_secret
The tooltips intelligently format different data types:
"user@example.com"42trueFor complex objects and arrays, tooltips provide:
Flow variable: global-mappings
📦 Object{5} - Click to expand in console
brands: 🔢 Array[1]
blacklist_brands: 🔢 Array[0]
colors: 🔢 Array[5]
countries: 🔢 Array[3]
materials: 🔢 Array[1]
version: 📦 Object{3}
📋 View Full JSON
{
"brands": [...],
"colors": [...],
// ... complete JSON structure
}
Sometimes you need to intentionally use debugging code or patterns that the analyzer would normally flag. You can use comment-based ignore directives to exclude specific lines or regions from analysis:
// @nr-analyzer-ignore-start
return; // This will be ignored
node.warn("This debug statement is intentional");
const test = "test"; // This hardcoded value is ignored
// @nr-analyzer-ignore-end
return; // @nr-analyzer-ignore-line
node.warn("debug"); // This line will be flagged
// @nr-analyzer-ignore-next
return; // This line will be ignored
node.warn("debug"); // This line will be flagged
@nr-analyzer-ignore-* (required spelling)@NR-ANALYZER-IGNORE-START works the same// @nr-analyzer-ignore-start and // @nr-analyzer-ignore-start both workAll detection levels respect ignore directives:
The performance monitoring feature continuously tracks your Node-RED instance's system metrics and provides intelligent alerting based on sustained threshold violations. Unlike traditional monitoring that alerts on momentary spikes, this system only triggers alerts when metrics remain above thresholds for a configured duration (e.g., CPU above 75% for 5+ minutes), preventing false alarms from temporary load spikes. All metrics are stored in a local SQLite database with automatic data retention management, and alerts include average values over the sustained period rather than instantaneous readings for more accurate performance insights.
| Field | Description | Recommended Value |
|---|---|---|
| Performance Monitoring | Enable/disable system performance tracking | Enabled for production systems |
| Performance Check Interval | How often to collect metrics (seconds) | 10-30 seconds |
| CPU Threshold | CPU usage percentage that triggers alerts | 70-80% |
| Memory Threshold | Memory usage percentage that triggers alerts | 75-85% |
| Event Loop Lag Threshold | Event loop delay in milliseconds | 10-50ms |
| Sustained Alert Duration | Time metrics must exceed thresholds before alerting | 300 seconds (5 minutes) |
| Alert Cooldown | Wait time between repeated alerts for same issue | 1800 seconds (30 minutes) |
| Database Retention | Days to keep performance metrics in database | 7 days |
npm install node-red-contrib-code-analyzer
flow.get('variableName') call to navigate to its flow.set() definitiongit clone https://github.com/your-username/node-red-contrib-code-analyzer.git
cd node-red-contrib-code-analyzer
npm install
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
# Run linter
npm run lint
Our test suite follows the AAA pattern (Arrange, Act, Assert) and includes:
We maintain 80%+ test coverage across all modules:
lib/detector.js - Core detection logiclib/slack-notifier.js - Notification systemnodes/analyzer.js - Node-RED integrationGitHub Actions automatically runs:
git checkout -b feature/amazing-feature)npm test)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)Configure your Slack webhook URL to receive formatted alerts:
{
"slackWebhookUrl": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
}
ISC License - see the LICENSE file for details.
FAQs
A Node-RED package that provides a background service to detect debugging artifacts in function nodes across Node-RED flows. Features performance monitoring (CPU, memory, event loop), queue monitoring, and Slack alerting.
The npm package node-red-contrib-code-analyzer receives a total of 0 weekly downloads. As such, node-red-contrib-code-analyzer popularity was classified as not popular.
We found that node-red-contrib-code-analyzer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.