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

feat: VCS support #4375

Merged
merged 7 commits into from
Apr 17, 2023
Merged

feat: VCS support #4375

merged 7 commits into from
Apr 17, 2023

Conversation

ematipico
Copy link
Contributor

@ematipico ematipico commented Apr 14, 2023

Summary

Closes #2492

This PR adds an opt-in integration of Rome with a VCS.

The integration can be set via configuration of via CLI:

Configuration of rome.json:

{
	"vcs": {
		"enabled": true,
		"clientKind": "git",
		"useIgnoreFile": true
	}
}

CLI:

rome format --write --vcs-enabled=true --vcs-client-kind=git --vcs-use-ignore-file=true --vcs-root=.

The root option in an optional flag tells Rome where to look for VCS files. The root will work as follow:

If root is passed:

  1. if rome.json is present, rome will append root to the configuration path to discover the VCS files;
  2. if rome.json is not present, rome will append root to the working directory to discover the VCS files;
  3. if rome.json is not present, and the working directory is not present, rome will use the current path to discover the VCS files;

If root is not passed:

  1. if rome.json is present, rome will use the configuration path to discover the VCS files;
  2. if rome.json is not present, rome will use the working directory to discover the VCS files;
  3. if rome.json is not present, and the working directory is not present, rome will use the current path to discover the VCS files;

As for now, the only feature that this PR does add to Rome is the possibility of ignoring files via .gitignore file. Though, there's a limitation: in this PR, multiple .gitignore files are a non-goal, and the only ignore file that is read is the one present in the root We might add this functionality later when we feel the whole architecture behind it is stable.

Test Plan

Added test cases for format, check and ci commands.

Changelog

  • The PR requires a changelog line

Documentation

  • The PR requires documentation
  • I will create a new PR to update the documentation

@netlify
Copy link

netlify bot commented Apr 14, 2023

Deploy Preview for docs-rometools canceled.

Name Link
🔨 Latest commit c36ae5b
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/643d157b3aa33500080ee640

@github-actions github-actions bot added A-CLI Area: CLI A-Core Area: core A-Diagnostic Area: errors and diagnostics A-Project Area: project configuration and loading labels Apr 14, 2023
@github-actions github-actions bot added A-Linter Area: linter and removed A-Diagnostic Area: errors and diagnostics labels Apr 14, 2023
@github-actions github-actions bot added the A-LSP Area: language server protocol label Apr 16, 2023
@ematipico ematipico marked this pull request as ready for review April 16, 2023 19:44
crates/rome_cli/src/parse_arguments.rs Show resolved Hide resolved
crates/rome_cli/src/vcs.rs Outdated Show resolved Hide resolved
crates/rome_cli/src/vcs.rs Outdated Show resolved Hide resolved
crates/rome_fs/src/fs.rs Outdated Show resolved Hide resolved
@ematipico ematipico merged commit b4bd55c into main Apr 17, 2023
@ematipico ematipico deleted the feat/gitignore-support branch April 17, 2023 14:34
@mbrevda
Copy link

mbrevda commented Apr 17, 2023

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-CLI Area: CLI A-Core Area: core A-Linter Area: linter A-LSP Area: language server protocol A-Project Area: project configuration and loading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add .gitignore support
3 participants