Add EditorConfig rules, fix trailing whitespaces

This commit is contained in:
Zhaofeng Li 2022-01-08 01:20:36 -08:00
parent deca292b53
commit abb74b9f49
8 changed files with 49 additions and 7 deletions

22
.editorconfig Normal file
View file

@ -0,0 +1,22 @@
# EditorConfig configuration for Colmena
# Top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file, utf-8 charset
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
# Rust
[*.rs]
indent_style = space
indent_size = 2
# Vendored
[manual/theme/highlight.js]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset

20
.github/workflows/editorconfig.yml vendored Normal file
View file

@ -0,0 +1,20 @@
name: Check EditorConfig
on:
pull_request:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: cachix/install-nix-action@v15
- name: Enable binary cache (optional)
uses: cachix/cachix-action@v10
with:
name: colmena
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix-shell --run "editorconfig-checker"

View file

@ -96,7 +96,7 @@ Here is a sample `hive.nix` with two nodes, with some common configurations appl
# If you share a hive with others, or use multiple machines, # If you share a hive with others, or use multiple machines,
# and are not careful to always commit/push/pull changes # and are not careful to always commit/push/pull changes
# you can accidentaly overwrite a remote profile so in those # you can accidentaly overwrite a remote profile so in those
# scenarios you might want to change this default to false. # scenarios you might want to change this default to false.
# deployment.replaceUnknownProfiles = true; # deployment.replaceUnknownProfiles = true;
}; };

View file

@ -52,7 +52,7 @@
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
inputsFrom = [ defaultPackage ]; inputsFrom = [ defaultPackage ];
packages = with pkgs; [ clippy mdbook python3 rust-analyzer ]; packages = with pkgs; [ clippy mdbook python3 editorconfig-checker rust-analyzer ];
shellHook = '' shellHook = ''
export NIX_PATH=nixpkgs=${pkgs.path} export NIX_PATH=nixpkgs=${pkgs.path}
''; '';

View file

@ -76,7 +76,7 @@ Here is a sample `hive.nix` with two nodes, with some common configurations appl
# If you share a hive with others, or use multiple machines, # If you share a hive with others, or use multiple machines,
# and are not careful to always commit/push/pull changes # and are not careful to always commit/push/pull changes
# you can accidentaly overwrite a remote profile so in those # you can accidentaly overwrite a remote profile so in those
# scenarios you might want to change this default to false. # scenarios you might want to change this default to false.
# deployment.replaceUnknownProfiles = true; # deployment.replaceUnknownProfiles = true;
}; };

View file

@ -316,7 +316,7 @@ let
else {}; else {};
# The final hive will always have the meta key instead of network. # The final hive will always have the meta key instead of network.
hive = let hive = let
userMeta = (lib.modules.evalModules { userMeta = (lib.modules.evalModules {
modules = [ metaOptions uncheckedUserMeta ]; modules = [ metaOptions uncheckedUserMeta ];
}).config; }).config;

View file

@ -400,7 +400,7 @@ impl<'hive> NixInstantiate<'hive> {
/// to generate Nix expressions directly or escaping a JSON string to strip /// to generate Nix expressions directly or escaping a JSON string to strip
/// off Nix interpolation. /// off Nix interpolation.
struct SerializedNixExpresssion { struct SerializedNixExpresssion {
json_file: TempPath, json_file: TempPath,
} }
impl SerializedNixExpresssion { impl SerializedNixExpresssion {

View file

@ -106,7 +106,7 @@ pub trait Host: Send + Sync + std::fmt::Debug {
/// If `require_ownership` is false, then the ownership of a key /// If `require_ownership` is false, then the ownership of a key
/// will not be applied if the specified user/group does not /// will not be applied if the specified user/group does not
/// exist. /// exist.
#[allow(unused_variables)] #[allow(unused_variables)]
async fn upload_keys(&mut self, keys: &HashMap<String, Key>, require_ownership: bool) -> ColmenaResult<()> { async fn upload_keys(&mut self, keys: &HashMap<String, Key>, require_ownership: bool) -> ColmenaResult<()> {
Err(ColmenaError::Unsupported) Err(ColmenaError::Unsupported)
} }
@ -127,7 +127,7 @@ pub trait Host: Send + Sync + std::fmt::Debug {
} }
/// Runs an arbitrary command on the host. /// Runs an arbitrary command on the host.
#[allow(unused_variables)] #[allow(unused_variables)]
async fn run_command(&mut self, command: &[&str]) -> ColmenaResult<()> { async fn run_command(&mut self, command: &[&str]) -> ColmenaResult<()> {
Err(ColmenaError::Unsupported) Err(ColmenaError::Unsupported)
} }