Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Fix pull diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored and Micha Reiser committed Nov 6, 2022
1 parent 3f4947a commit 49a0ad0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
23 changes: 14 additions & 9 deletions benchmark/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const TMP_DIRECTORY = path.resolve("./target");
function buildRome() {
console.log("Build Rome...");

child_process.execSync("cargo build --bin rome --release");
child_process.execSync("cargo build --bin rome --release", { stdio: "inherit" });

return path.resolve("../target/release/rome");
}
Expand Down Expand Up @@ -79,7 +79,7 @@ function benchmarkFormatter(rome) {

const romeSingleCoreCommand = withEnvVariable(
"RAYON_NUM_THREADS",
"1",
"3",
romeCommand,
);

Expand Down Expand Up @@ -107,12 +107,10 @@ function benchmarkLinter(rome) {
for (const [name, configuration] of Object.entries(BENCHMARKS.linter)) {
console.log(`[${name}]`);

let projectDirectory = cloneProject(name, configuration.repository);
let eslintIgnore = path.join(projectDirectory, ".eslintignore");
const projectDirectory = cloneProject(name, configuration.repository);

if (fs.existsSync(eslintIgnore)) {
fs.rmSync(eslintIgnore);
}
deleteFile(path.join(projectDirectory, ".eslintignore"));
deleteFile(path.join(projectDirectory, "eslint.config.js"));

// Override eslint config
const eslintConfig = fs.readFileSync("./bench.eslint.js");
Expand All @@ -131,11 +129,12 @@ function benchmarkLinter(rome) {
.map((directory) => `'${directory}'`)
.join(" ");

const romeCommand = `${rome} check ${romePaths}`;
// Don't compute the code frames for pulled diagnostics. ESLint doesn't do so as well.
const romeCommand = `${rome} check --max-diagnostics=0 ${romePaths}`;

const romeSingleCoreCommand = withEnvVariable(
"RAYON_NUM_THREADS",
"1",
"3",
romeCommand,
);

Expand Down Expand Up @@ -185,6 +184,12 @@ function withDirectory(cwd) {
};
}

function deleteFile(path) {
if (fs.existsSync(path)) {
fs.rmSync(path);
}
}

function cloneProject(name, repository) {
let projectDirectory = path.join(TMP_DIRECTORY, name);

Expand Down
7 changes: 6 additions & 1 deletion crates/rome_cli/src/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ pub(crate) fn traverse(execution: Execution, mut session: CliSession) -> Result<
let console = &mut *session.app.console;

let mut has_errors = None;
let remaining_diagnostics = Arc::new(AtomicU64::new(u64::MAX));
let remaining_diagnostics = Arc::new(AtomicU64::new(
execution
.get_max_diagnostics()
.map(u64::from)
.unwrap_or(u64::MAX),
));

let mut duration = None;
let mut report = None;
Expand Down

0 comments on commit 49a0ad0

Please sign in to comment.