Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
This package allows to use the SonarJS analyzer as a command line tool and as a JavaScript/TypeScript library.
SonarJS is a static code analyser for the JavaScript language. It will allow you to produce stable and easily supported code by helping you to find and to correct bugs, vulnerabilities and code smells in your code.
It provides ~80 rules (including ~40 bug detection), which represent the "Sonar Way" profile of the SonarJS analyzer.
> npm install -g sonarjs
> cd <directory of project to analyze>
> sonarjs
or
> sonarjs -h
for more information
MAJOR - S3923: /Users/path/to/foo/file.js [3, 6]: Remove this conditional structure or edit its code blocks so that they're not all the same.
BLOCKER - OctalNumber: /Users/path/to/foo/file.js [3, 10]: Replace the value of the octal number (056) by its decimal equivalent (46).
> npm install sonarjs
// for TypeScript
import { analyze, Issue } from "sonarjs";
// for JavaScript
const { analyze } = require("sonarjs");
async function runSonarJS() {
const issues = await analyze("/path/to/project");
issues.forEach(issue => {
// ...
});
}
analyze
function to collect logs and to add some behavior before and after analysisfunction log(message: string) {
console.log(message);
}
function onStart() {
console.log("Analysis is started");
}
function onEnd() {
console.log("Analysis is finished");
}
async function runSonarJS() {
const issues = await analyze("/path/to/project", { log, onStart, onEnd });
// ...
}
async function runSonarJS() {
const issues = await analyze("/path/to/project", { exclusions: "**/tests/**" });
// ...
}
Note that SonarJS requires a JRE, so if it's not available on your machine (Java 1.8 version) it will be downloaded during the first analysis.
FAQs
SonarJS npm module
The npm package sonarjs receives a total of 2,029 weekly downloads. As such, sonarjs popularity was classified as popular.
We found that sonarjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.