mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
Merge pull request #362 from philomena-dev/extra-lint-jobs
Extra lint jobs
This commit is contained in:
commit
6d459ca67d
3 changed files with 37 additions and 10 deletions
18
.github/workflows/elixir.yml
vendored
18
.github/workflows/elixir.yml
vendored
|
@ -31,6 +31,9 @@ jobs:
|
||||||
- run: docker compose pull
|
- run: docker compose pull
|
||||||
- run: docker compose build
|
- run: docker compose build
|
||||||
|
|
||||||
|
- name: mix format
|
||||||
|
run: docker compose run app mix format --check-formatted
|
||||||
|
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
run: docker compose run app run-test
|
run: docker compose run app run-test
|
||||||
|
|
||||||
|
@ -50,6 +53,21 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: crate-ci/typos@master
|
- uses: crate-ci/typos@master
|
||||||
|
|
||||||
|
cargo:
|
||||||
|
name: Rust Linting and Unit Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: cargo fmt
|
||||||
|
run: (cd native/philomena && cargo fmt --check)
|
||||||
|
|
||||||
|
- name: cargo clippy
|
||||||
|
run: (cd native/philomena && cargo clippy -- -D warnings)
|
||||||
|
|
||||||
lint-and-test:
|
lint-and-test:
|
||||||
name: 'JavaScript Linting and Unit Tests'
|
name: 'JavaScript Linting and Unit Tests'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
use base64::engine::general_purpose::URL_SAFE_NO_PAD;
|
||||||
|
use base64::Engine;
|
||||||
use ring::hmac;
|
use ring::hmac;
|
||||||
use std::env;
|
use std::env;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use base64::Engine;
|
|
||||||
use base64::engine::general_purpose::URL_SAFE_NO_PAD;
|
|
||||||
|
|
||||||
fn trusted_host(mut url: Url) -> Option<String> {
|
fn trusted_host(mut url: Url) -> Option<String> {
|
||||||
url.set_port(Some(443)).ok()?;
|
url.set_port(Some(443)).ok()?;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use comrak::ComrakOptions;
|
|
||||||
use crate::camo;
|
use crate::camo;
|
||||||
|
use comrak::ComrakOptions;
|
||||||
use rustler::{MapIterator, Term};
|
use rustler::{MapIterator, Term};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -19,19 +19,28 @@ fn common_options() -> ComrakOptions {
|
||||||
options.extension.camoifier = Some(|s| camo::image_url(s).unwrap_or_else(|| String::from("")));
|
options.extension.camoifier = Some(|s| camo::image_url(s).unwrap_or_else(|| String::from("")));
|
||||||
|
|
||||||
if let Ok(domains) = env::var("SITE_DOMAINS") {
|
if let Ok(domains) = env::var("SITE_DOMAINS") {
|
||||||
options.extension.philomena_domains = Some(domains.split(',').map(|s| s.to_string()).collect::<Vec<String>>());
|
options.extension.philomena_domains = Some(
|
||||||
|
domains
|
||||||
|
.split(',')
|
||||||
|
.map(|s| s.to_string())
|
||||||
|
.collect::<Vec<String>>(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
options
|
options
|
||||||
}
|
}
|
||||||
|
|
||||||
fn map_to_hashmap(map: Term) -> Option<HashMap<String, String>> {
|
fn map_to_hashmap(map: Term) -> Option<HashMap<String, String>> {
|
||||||
Some(MapIterator::new(map)?.map(|(key, value)| {
|
Some(
|
||||||
|
MapIterator::new(map)?
|
||||||
|
.map(|(key, value)| {
|
||||||
let key: String = key.decode().unwrap_or_else(|_| String::from(""));
|
let key: String = key.decode().unwrap_or_else(|_| String::from(""));
|
||||||
let value: String = value.decode().unwrap_or_else(|_| String::from(""));
|
let value: String = value.decode().unwrap_or_else(|_| String::from(""));
|
||||||
|
|
||||||
(key, value)
|
(key, value)
|
||||||
}).collect())
|
})
|
||||||
|
.collect(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_html(input: String, reps: Term) -> String {
|
pub fn to_html(input: String, reps: Term) -> String {
|
||||||
|
|
Loading…
Reference in a new issue