Skip to content

Commit

Permalink
feat: rename rome_analyzer -> biome_analyzer biomejs#88
Browse files Browse the repository at this point in the history
  • Loading branch information
ekusiadadus committed Sep 8, 2023
1 parent 3dceeb3 commit 1c2a6af
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ documentation = """
doc \
-p rome_*formatter \
-p rome_control_flow \
-p rome_analyze \
-p biome_analyze \
-p rome_*analyze \
-p rome_*_syntax \
-p rome_*_factory \
Expand Down
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A-Project:
- crates/rome_service/**

A-Linter:
- crates/rome_analyze/**
- crates/biome_analyze/**
- crates/rome_js_analyze/**
- crates/rome_json_analyze/**

Expand Down
32 changes: 21 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ The `"biome.lspBin"` VS Code setting will still need to be set as described abov
When the extension is running, it will connect to a daemon server - or it will bootstrap one.

When you apply changes to the binary, you need to do two things:

- compile the binary
- kill the daemon process, so you can spawn a new server session
with the new changes
with the new changes

When the daemon is running, it's possible to inspect its logs in the folder `biome-logs`, placed
in the temporary folder of the operative system.


### User files

If files specific to your local development environment should be ignored, please add these files to a global git ignore file rather than to a git ignore file within Biome.
Expand All @@ -166,15 +166,17 @@ You can find more information on this process [here](https://help.github.com/en/
## Node.js development

The npm module `npm/biome` contains Biome's Node JS API that supports different backends:

- `wasm-nodejs` (WebAssembly)
- `backend-jsonrpc` (Connection to the daemon)

For testing and developing, you need to build these packages, following the steps:

1. install [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) globally;
2. run the `build` command inside the package `backend-jsonrpc`;
3. run the `build` and `build:wasm-node-dev` commands inside the package `js-api` (folder `npm/js-api`);
4. run `pnpm i` inside the package `js-api` (folder `npm/js-api`), this will link the WebAssembly bindings and the
JSON-RPC bindings;
JSON-RPC bindings;

The tests are run against the compiled files, which means that you need to run the
`build` command after you implemented features/bug fixes.
Expand Down Expand Up @@ -202,7 +204,6 @@ The source is generated from the [`ungram` files](https:/biomejs/bio

#### `cargo codegen test`


This command will create new tests for your parser. We currently have a neat infrastructure
where tests for parser are generated com inline comments found inside
the source code. Please read [the proper chapter for more information](#write-tests-for-a-parser)
Expand All @@ -211,7 +212,7 @@ It's strongly advised to **run this command before committing new changes**.

#### `cargo codegen analyzer`

This command will detect linter rules declared in the `analyzers` and `assists` directories in `rome_analyze`, regenerate the index modules `analyzers.rs` and `assists.rs` to import these files, and update the registry builder function in `registry.rs` to include all these rules.
This command will detect linter rules declared in the `analyzers` and `assists` directories in `biome_analyze`, regenerate the index modules `analyzers.rs` and `assists.rs` to import these files, and update the registry builder function in `registry.rs` to include all these rules.
It will also regenerate the configuration of the rules.

#### `cargo coverage`
Expand All @@ -221,6 +222,7 @@ We currently target the [Official ECMAScript Conformance Test Suite](https://git
the [Typescript Test Suite](https:/microsoft/TypeScript/tree/main/tests)

The test suites are included as git submodules and can be pulled using:

```bash
git submodule update --init --recursive
```
Expand Down Expand Up @@ -268,31 +270,39 @@ Here's a sample of the headings:
## Unreleased

### Analyzer

### CLI

### Configuration

### Editors

### Formatter

### JavaScript APIs

### Linter

### Parser

### VSCode
```

When you edit a blank section:

- If your PR adds a **breaking change**, create a new heading called `#### BREAKING CHANGES` and add
bullet point that explains the breaking changes; provide a migration path if possible.
bullet point that explains the breaking changes; provide a migration path if possible.
- If your PR adds a new feature of a fix, create a new heading called `#### Other changes` and
add a bullet point that explains the fix or the new feature. Make sure that this new heading
appears after the `#### BREAKING CHANGES` heading.
add a bullet point that explains the fix or the new feature. Make sure that this new heading
appears after the `#### BREAKING CHANGES` heading.

##### Writing a changelog line

- Use the present tense, e.g. "Add new feature", "Fix edge case".
- If you fix a bug, please add the link to the issue, e.g. "Fix edge case [#4444]()".
- Whenever applicable, add a code block to show your new changes. For example, for a new
rule you might want to show an invalid case, for the formatter you might want to show
how the new formatting changes, and so on.
rule you might want to show an invalid case, for the formatter you might want to show
how the new formatting changes, and so on.

#### Documentation

Expand All @@ -308,7 +318,7 @@ When adding new features, the documentation should be part of a new PR, which wi
### Analyzers and lint rules

To know the technical details of how our analyzer works, how to create a rule and how to write tests, please check our [internal
documentation page](https://rustdocs.rome.tools/rome_analyze/index.html)
documentation page](https://rustdocs.rome.tools/biome_analyze/index.html)

### JavaScript Parser

Expand Down
48 changes: 24 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ biome_flags = { path = "./crates/biome_flags" }
biome_lsp = { path = "./crates/biome_lsp" }
biome_markup = { version = "0.0.1", path = "./crates/biome_markup" }
biome_test_utils = { path = "./crates/biome_test_utils" }
rome_analyze = { path = "./crates/rome_analyze" }
biome_analyze = { path = "./crates/biome_analyze" }
rome_cli = { path = "./crates/rome_cli" }
rome_console = { version = "0.0.1", path = "./crates/rome_console" }
rome_control_flow = { path = "./crates/rome_control_flow" }
Expand Down
2 changes: 1 addition & 1 deletion fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cargo-fuzz = true
[dependencies]
arbitrary = { version = "1.3.0", features = ["derive"] }
libfuzzer-sys = { git = "https:/rust-fuzz/libfuzzer", default-features = false }
rome_analyze = { path = "../crates/rome_analyze" }
biome_analyze = { path = "../crates/biome_analyze" }
rome_diagnostics = { path = "../crates/rome_diagnostics" }
rome_formatter = { path = "../crates/rome_formatter" }
rome_js_analyze = { path = "../crates/rome_js_analyze" }
Expand Down
18 changes: 13 additions & 5 deletions fuzz/fuzz_targets/rome_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#![allow(dead_code)]

use biome_analyze::{AnalysisFilter, AnalyzerOptions, ControlFlow, RuleFilter};
use libfuzzer_sys::Corpus;
use rome_analyze::{AnalysisFilter, AnalyzerOptions, ControlFlow, RuleFilter};
use rome_diagnostics::Diagnostic;
use rome_formatter::format_node;
use rome_js_analyze::analyze;
Expand All @@ -20,7 +20,9 @@ use similar::TextDiff;
use std::fmt::{Display, Formatter};

pub fn fuzz_js_parser_with_source_type(data: &[u8], source: JsFileSource) -> Corpus {
let Ok(code1) = std::str::from_utf8(data) else { return Corpus::Reject; };
let Ok(code1) = std::str::from_utf8(data) else {
return Corpus::Reject;
};

let parse1 = parse(code1, source);
if !parse1.has_errors() {
Expand Down Expand Up @@ -56,7 +58,9 @@ where
}

pub fn fuzz_js_formatter_with_source_type(data: &[u8], source: JsFileSource) -> Corpus {
let Ok(code1) = std::str::from_utf8(data) else { return Corpus::Reject; };
let Ok(code1) = std::str::from_utf8(data) else {
return Corpus::Reject;
};

// TODO: replace with OnceLock when upgrading to 1.70
let rule_filters = if let Some(rules) = unsafe { ANALYSIS_RULE_FILTERS.as_ref() } {
Expand Down Expand Up @@ -160,7 +164,9 @@ pub fn fuzz_js_formatter_with_source_type(data: &[u8], source: JsFileSource) ->
}

pub fn fuzz_json_parser(data: &[u8]) -> Corpus {
let Ok(code1) = std::str::from_utf8(data) else { return Corpus::Reject; };
let Ok(code1) = std::str::from_utf8(data) else {
return Corpus::Reject;
};

let parse1 = parse_json(code1);
if !parse1.has_errors() {
Expand All @@ -173,7 +179,9 @@ pub fn fuzz_json_parser(data: &[u8]) -> Corpus {
}

pub fn fuzz_json_formatter(data: &[u8]) -> Corpus {
let Ok(code1) = std::str::from_utf8(data) else { return Corpus::Reject; };
let Ok(code1) = std::str::from_utf8(data) else {
return Corpus::Reject;
};

let parse1 = parse_json(code1);
if !parse1.has_errors() {
Expand Down
2 changes: 1 addition & 1 deletion xtask/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ publish = false
version = "0.0.0"

[dependencies]
rome_analyze = { path = "../../crates/rome_analyze" }
biome_analyze = { path = "../../crates/biome_analyze" }
rome_console = { path = "../../crates/rome_console" }
rome_diagnostics = { path = "../../crates/rome_diagnostics" }
rome_formatter = { path = "../../crates/rome_formatter" }
Expand Down
2 changes: 1 addition & 1 deletion xtask/bench/src/language.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::test_case::TestCase;
use biome_analyze::{AnalysisFilter, AnalyzerOptions, ControlFlow, Never, RuleCategories};
use criterion::black_box;
use rome_analyze::{AnalysisFilter, AnalyzerOptions, ControlFlow, Never, RuleCategories};
use rome_formatter::{FormatResult, Formatted, PrintResult, Printed};
use rome_js_analyze::analyze;
use rome_js_formatter::context::{JsFormatContext, JsFormatOptions};
Expand Down
Loading

0 comments on commit 1c2a6af

Please sign in to comment.