Skip to content

Commit

Permalink
feat(site): Substantial site redesign
Browse files Browse the repository at this point in the history
Substantially redesigned the site, most notably including:

- Introduction of a blog for release announcement and future technical
  writing.
- Improvements to the homepage.
- A completely overhauled documentation section.

Signed-off-by: Andrew Lilley Brinker <[email protected]>
  • Loading branch information
alilleybrinker committed Nov 8, 2024
1 parent c82797e commit e1788c0
Show file tree
Hide file tree
Showing 146 changed files with 4,246 additions and 1,831 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/website-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ jobs:
mv tailwindcss "${HOME}/.local/bin/tailwindcss"
echo "${HOME}/.local/bin" >> $GITHUB_PATH
# Install the latest major version of Deno.
- name: Install Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

# Setup GitHub Pages
#
# Specifically, this sets some variables we can use in later steps that
Expand All @@ -70,6 +76,8 @@ jobs:
cd site
zola build
tailwindcss -i styles/main.css -o public/main.css
cd scripts
deno task bundle
# Upload the output of the build as an Actions artifact so the deploy
# step can pick it up and use it.
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/website-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ jobs:
mv tailwindcss "${HOME}/.local/bin/tailwindcss"
echo "${HOME}/.local/bin" >> $GITHUB_PATH
# Install the latest major version of Deno.
- name: Install Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

# Build the actual site with Zola and Tailwind.
- name: Build Hipcheck Website
run: |
cd site
zola build
tailwindcss -i styles/main.css -o public/main.css
cd scripts
deno task bundle
35 changes: 35 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
"lsp": {
"deno": {
"settings": {
"deno": {
"enable": true
}
}
}
},
"languages": {
"TypeScript": {
"language_servers": [
"deno",
"!typescript-language-server",
"!vtsls",
"!eslint"
],
"formatter": "language_server"
},
"TSX": {
"language_servers": [
"deno",
"!typescript-language-server",
"!vtsls",
"!eslint"
],
"formatter": "language_server"
}
}
}
6 changes: 2 additions & 4 deletions plugins/activity/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ impl Plugin for ActivityPlugin {
log::error!("tried to access config before set by Hipcheck core!");
return Err(Error::UnspecifiedQueryState);
};
match conf.weeks {
Some(weeks) => Ok(format!("lte $ P{}w", weeks)),
None => Ok("".to_owned()),
}

Ok(format!("lte $ P{}w", conf.weeks.unwrap_or(71)))
}

fn explain_default_query(&self) -> Result<Option<String>> {
Expand Down
1 change: 1 addition & 0 deletions plugins/affiliation/test/example_orgs.kdl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
strategy "independent"

orgs {
org "AT&T" country="United States" {
host "att.com"
Expand Down
7 changes: 1 addition & 6 deletions plugins/binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ mod error;
mod fs;

use crate::binary_detector::{detect_binary_files, BinaryFileDetector};

use clap::Parser;
use hipcheck_sdk::{
prelude::*,
types::{LocalGitRepo, Target},
};
use pathbuf::pathbuf;
use serde::Deserialize;

use std::{path::PathBuf, result::Result as StdResult, sync::OnceLock};

pub static DETECTOR: OnceLock<BinaryFileDetector> = OnceLock::new();
Expand Down Expand Up @@ -109,10 +107,7 @@ impl Plugin for BinaryPlugin {
fn default_policy_expr(&self) -> Result<String> {
match self.policy_conf.get() {
None => Err(Error::UnspecifiedQueryState),
// If no policy vars, we have no default expr
Some(None) => Ok("".to_owned()),
// Use policy config vars to construct a default expr
Some(Some(policy_conf)) => Ok(format!("(lte $ {})", policy_conf)),
Some(policy_conf) => Ok(format!("(lte (count $) {})", policy_conf.unwrap_or(0))),
}
}

Expand Down
32 changes: 22 additions & 10 deletions plugins/churn/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ use crate::{
metric::*,
types::{CommitChurn, CommitChurnFreq, CommitDiff},
};

use clap::Parser;
use hipcheck_sdk::{prelude::*, types::Target};
use serde::Deserialize;
use tokio::sync::Mutex;

use std::{
collections::HashMap,
path::PathBuf,
result::Result as StdResult,
sync::{Arc, OnceLock},
};
use tokio::sync::Mutex;

#[derive(Deserialize)]
struct RawConfig {
Expand Down Expand Up @@ -242,27 +240,32 @@ struct ChurnPlugin {
impl Plugin for ChurnPlugin {
const PUBLISHER: &'static str = "mitre";
const NAME: &'static str = "churn";

fn set_config(&self, config: Value) -> StdResult<(), ConfigError> {
// Deserialize and validate the config struct
let conf: Config = serde_json::from_value::<RawConfig>(config)
.map_err(|e| ConfigError::Unspecified {
message: e.to_string(),
})?
.try_into()?;

// Store the PolicyExprConf to be accessed only in the `default_policy_expr()` impl
self.policy_conf
.set(conf.opt_policy)
.map_err(|_| ConfigError::Unspecified {
message: "plugin was already configured".to_string(),
})?;

// Use the langs file to create a SourceFileDetector and init the salsa db
let sfd =
SourceFileDetector::load(conf.langs_file).map_err(|e| ConfigError::Unspecified {
message: e.to_string(),
})?;

let mut database = Linguist::new();
database.set_source_file_detector(Arc::new(sfd));
let global_db = Arc::new(Mutex::new(database));

// Make the salsa db globally accessible
DATABASE
.set(global_db)
Expand All @@ -274,13 +277,22 @@ impl Plugin for ChurnPlugin {
fn default_policy_expr(&self) -> Result<String> {
match self.policy_conf.get() {
None => Err(Error::UnspecifiedQueryState),
// If no policy vars, we have no default expr
Some(None) => Ok("".to_owned()),
// Use policy config vars to construct a default expr
Some(Some(policy_conf)) => Ok(format!(
"(lte (divz (count (filter (gt {}) $)) (count $)) {})",
policy_conf.churn_freq, policy_conf.commit_percentage
)),
Some(policy_conf) => {
let churn_freq = policy_conf
.as_ref()
.map(|conf| conf.churn_freq)
.unwrap_or(3.0);

let commit_percentage = policy_conf
.as_ref()
.map(|conf| conf.commit_percentage)
.unwrap_or(0.02);

Ok(format!(
"(lte (divz (count (filter (gt {}) $)) (count $)) {})",
churn_freq, commit_percentage
))
}
}
}

Expand Down
28 changes: 21 additions & 7 deletions plugins/entropy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,26 +154,31 @@ struct EntropyPlugin {
impl Plugin for EntropyPlugin {
const PUBLISHER: &'static str = "mitre";
const NAME: &'static str = "entropy";

fn set_config(&self, config: Value) -> StdResult<(), ConfigError> {
// Deserialize and validate the config struct
let conf: Config = serde_json::from_value::<RawConfig>(config)
.map_err(|e| ConfigError::Unspecified {
message: e.to_string(),
})?
.try_into()?;

// Store the PolicyExprConf to be accessed only in the `default_policy_expr()` impl
self.policy_conf
.set(conf.opt_policy)
.map_err(|_| ConfigError::Unspecified {
message: "plugin was already configured".to_string(),
})?;

let sfd =
SourceFileDetector::load(conf.langs_file).map_err(|e| ConfigError::Unspecified {
message: e.to_string(),
})?;

let mut database = Linguist::new();
database.set_source_file_detector(Arc::new(sfd));
let global_db = Arc::new(Mutex::new(database));

DATABASE
.set(global_db)
.map_err(|_e| ConfigError::Unspecified {
Expand All @@ -184,13 +189,22 @@ impl Plugin for EntropyPlugin {
fn default_policy_expr(&self) -> Result<String> {
match self.policy_conf.get() {
None => Err(Error::UnspecifiedQueryState),
// If no policy vars, we have no default expr
Some(None) => Ok("".to_owned()),
// Use policy config vars to construct a default expr
Some(Some(policy_conf)) => Ok(format!(
"(lte (divz (count (filter (gt {}) $)) (count $)) {})",
policy_conf.entropy_threshold, policy_conf.commit_percentage
)),
Some(policy_conf) => {
let entropy_threshold = policy_conf
.as_ref()
.map(|conf| conf.entropy_threshold)
.unwrap_or(10.0);

let commit_percentage = policy_conf
.as_ref()
.map(|conf| conf.commit_percentage)
.unwrap_or(0.0);

Ok(format!(
"(lte (divz (count (filter (gt {}) $)) (count $)) {})",
entropy_threshold, commit_percentage
))
}
}
}

Expand Down
14 changes: 7 additions & 7 deletions plugins/identity/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ impl Plugin for IdentityPlugin {
fn default_policy_expr(&self) -> Result<String> {
match self.policy_conf.get() {
None => Err(Error::UnspecifiedQueryState),
// If no policy vars, we have no default expr
Some(None) => Ok("".to_owned()),
// Use policy config vars to construct a default expr
Some(Some(percent_threshold)) => Ok(format!(
"(lte (divz (count (filter (eq #t) $)) (count $)) {})",
percent_threshold
)),
Some(config) => {
let percent_threshold = config.unwrap_or(0.2);
Ok(format!(
"(lte (divz (count (filter (eq #t) $)) (count $)) {})",
percent_threshold
))
}
}
}

Expand Down
14 changes: 7 additions & 7 deletions plugins/review/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ impl Plugin for ReviewPlugin {
log::error!("tried to access config before set by Hipcheck core!");
return Err(Error::UnspecifiedQueryState);
};
match conf.percent_threshold {
Some(threshold) => Ok(format!(
"(lte (divz (count (filter (eq #f) $)) (count $)) {})",
threshold
)),
None => Ok("".to_owned()),
}

let threshold = conf.percent_threshold.unwrap_or(0.05);

Ok(format!(
"(lte (divz (count (filter (eq #f) $)) (count $)) {})",
threshold
))
}

fn explain_default_query(&self) -> Result<Option<String>> {
Expand Down
12 changes: 3 additions & 9 deletions plugins/typo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,9 @@ impl Plugin for TypoPlugin {
}

fn default_policy_expr(&self) -> Result<String> {
match self.policy_conf.get() {
None => Err(Error::UnspecifiedQueryState),
// If no policy vars, we have no default expr
Some(None) => Ok("".to_owned()),
// Use policy config vars to construct a default expr
Some(Some(policy_conf)) => {
Ok(format!("(lte (count (filter (eq #t) $)) {})", policy_conf))
}
}
let conf = self.policy_conf.get().ok_or(Error::UnspecifiedQueryState)?;
let threshold = conf.unwrap_or(0);
Ok(format!("(lte (count (filter (eq #t) $)) {})", threshold))
}

fn explain_default_query(&self) -> Result<Option<String>> {
Expand Down
Loading

0 comments on commit e1788c0

Please sign in to comment.