profile
viewpoint

fork cllty/v

Simple, fast, safe, compiled language for developing maintainable software. Supports translation from C and (soon) C++.

fork in 24 days

PR closed mojaloop/central-services-stream

Upgrade dependencies
  • upgraded node version to LTS
  • upgraded node-rdkafka to latest version
  • Added more test documentation
+79 -11

0 comment

4 changed files

cllty

pr closed time in a month

PR closed mojaloop/central-services-shared

Upgrade dependencies
  • Upgraded node version to LTS

  • Added test documentation

  • Fixed vulnerabilities

+80 -16

0 comment

3 changed files

cllty

pr closed time in a month

PR closed mojaloop/central-services-database

Upgrade to node v10 LTS
  • Upgraded node version to LTS

  • Audit fixed vulnerabilities

+5 -5

0 comment

2 changed files

cllty

pr closed time in a month

PR closed mojaloop/central-services-auth

Upgrade to node v10 LTS
  • Upgraded node version to LTS

  • Added test documentation

  • Fixed vulnerabilities

+16 -4

0 comment

3 changed files

cllty

pr closed time in a month

PR closed mojaloop/central-services-error-handling

Upgrade to node v10 LTS
  • Upgraded node version to LTS

  • Added test documentation

  • Audit fixed vulnerabilities

+61 -5

0 comment

3 changed files

cllty

pr closed time in a month

PR closed mojaloop/central-end-user-registry

Upgrade to node v10 lts
  • Upgraded node version to LTS

  • Audit fixed vulnerabilities

+28 -21

0 comment

3 changed files

cllty

pr closed time in a month

push eventcllty/challenge-bibl

cllty

commit sha f7acd4b111d62412a29f536e1f655a4b1bd8e3b0

minor

view details

push time in a month

create barnchcllty/challenge-bibl

branch : master

created branch time in a month

created repositorycllty/challenge-bibl

created time in a month

Pull request review commentdenoland/deno

Handle compiler diagnostics in Rust.

+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.+use crate::ansi;+use serde_json;+use serde_json::value::Value;+use std::fmt;++// A trait which specifies parts of a diagnostic like item needs to be able to+// generate to conform its display to other diagnostic like items+pub trait DisplayFormatter {+  fn format_category_and_code(&self) -> String;+  fn format_message(&self, level: usize) -> String;+  fn format_related_info(&self) -> String;+  fn format_source_line(&self, level: usize) -> String;+  fn format_source_name(&self, level: usize) -> String;+}++#[derive(Debug, PartialEq, Clone)]+pub struct Diagnostic {+  pub items: Vec<DiagnosticItem>,+}++impl Diagnostic {+  /// Take a JSON value and attempt to map it to a+  pub fn from_json_value(v: &serde_json::Value) -> Option<Self> {+    if !v.is_object() {+      return None;+    }+    let obj = v.as_object().unwrap();++    let mut items = Vec::<DiagnosticItem>::new();+    let items_v = &obj["items"];+    if items_v.is_array() {+      let items_values = items_v.as_array().unwrap();++      for item_v in items_values {+        items.push(DiagnosticItem::from_json_value(item_v));+      }+    }++    Some(Self { items })+  }++  pub fn from_emit_result(json_str: &str) -> Option<Self> {+    let v = serde_json::from_str::<serde_json::Value>(json_str)+      .expect("Error decoding JSON string.");+    let diagnostics_o = v.get("diagnostics");+    if let Some(diagnostics_v) = diagnostics_o {+      return Self::from_json_value(diagnostics_v);+    }++    None+  }+}++impl fmt::Display for Diagnostic {+  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {+    let mut i = 0;+    for item in &self.items {+      if i > 0 {+        writeln!(f)?;+      }+      write!(f, "{}", item.to_string())?;+      i += 1;+    }++    if i > 1 {+      write!(f, "\n\nFound {} errors.\n", i)?;+    }++    Ok(())+  }+}++#[derive(Debug, PartialEq, Clone)]+pub struct DiagnosticItem {+  pub message: String,+  pub message_chain: Option<Box<DiagnosticMessageChain>>,+  pub related_information: Option<Vec<DiagnosticItem>>,+  pub source_line: Option<String>,+  pub line_number: Option<i64>,+  pub script_resource_name: Option<String>,+  pub start_position: Option<i64>,+  pub end_position: Option<i64>,+  pub category: DiagnosticCategory,+  pub code: i64,+  pub start_column: Option<i64>,+  pub end_column: Option<i64>,+}++impl DiagnosticItem {+  pub fn from_json_value(v: &serde_json::Value) -> Self {+    let obj = v.as_object().unwrap();++    // required attributes+    let message = obj+      .get("message")+      .and_then(|v| v.as_str().map(String::from))+      .unwrap();+    let category = DiagnosticCategory::from_i64(+      obj.get("category").and_then(Value::as_i64).unwrap(),+    );+    let code = obj.get("code").and_then(Value::as_i64).unwrap();++    // optional attributes+    let source_line = obj+      .get("sourceLine")+      .and_then(|v| v.as_str().map(String::from));+    let script_resource_name = obj+      .get("scriptResourceName")+      .and_then(|v| v.as_str().map(String::from));+    let line_number = obj.get("lineNumber").and_then(Value::as_i64);+    let start_position = obj.get("startPosition").and_then(Value::as_i64);+    let end_position = obj.get("endPosition").and_then(Value::as_i64);+    let start_column = obj.get("startColumn").and_then(Value::as_i64);+    let end_column = obj.get("endColumn").and_then(Value::as_i64);++    let message_chain_v = obj.get("messageChain");+    let message_chain = match message_chain_v {+      Some(v) => DiagnosticMessageChain::from_json_value(v),+      _ => None,+    };++    let related_information_v = obj.get("relatedInformation");+    let related_information = match related_information_v {+      Some(r) => {+        let mut related_information = Vec::<DiagnosticItem>::new();+        let related_info_values = r.as_array().unwrap();++        for related_info_v in related_info_values {+          related_information+            .push(DiagnosticItem::from_json_value(related_info_v));+        }++        Some(related_information)+      }+      _ => None,+    };++    Self {+      message,+      message_chain,+      related_information,+      code,+      source_line,+      script_resource_name,+      line_number,+      start_position,+      end_position,+      category,+      start_column,+      end_column,+    }+  }+}++impl DisplayFormatter for DiagnosticItem {+  fn format_category_and_code(&self) -> String {+    let category = match self.category {+      DiagnosticCategory::Error => {+        format!("- {}", ansi::red("error".to_string()))+      }+      DiagnosticCategory::Warning => "- warn".to_string(),+      DiagnosticCategory::Debug => "- debug".to_string(),+      DiagnosticCategory::Info => "- info".to_string(),+      _ => "".to_string(),+    };++    let code = ansi::grey(format!(" TS{}:", self.code.to_string())).to_string();++    format!("{}{} ", category, code)+  }++  fn format_message(&self, level: usize) -> String {+    if self.message_chain.is_none() {+      return format!("{:indent$}{}", "", self.message, indent = level);+    }++    let mut s = String::new();+    let mut i = level / 2;+    let mut item_o = self.message_chain.clone();+    while item_o.is_some() {+      let item = item_o.unwrap();+      s.push_str(&std::iter::repeat(" ").take(i * 2).collect::<String>());+      s.push_str(&item.message);+      s.push('\n');+      item_o = item.next.clone();+      i += 1;+    }+    s.pop();++    s+  }++  fn format_related_info(&self) -> String {+    if self.related_information.is_none() {+      return "".to_string();+    }++    let mut s = String::new();+    let related_information = self.related_information.clone().unwrap();+    for related_diagnostic in related_information {+      let rd = &related_diagnostic;+      s.push_str(&format!(+        "\n{}{}{}\n",+        rd.format_source_name(2),+        rd.format_source_line(4),+        rd.format_message(4),+      ));+    }++    s+  }++  fn format_source_line(&self, level: usize) -> String {+    if self.source_line.is_none() {+      return "".to_string();+    }++    let source_line = self.source_line.as_ref().unwrap();+    // sometimes source_line gets set with an empty string, which then outputs+    // an empty source line when displayed, so need just short circuit here+    if source_line.is_empty() {+      return "".to_string();+    }++    assert!(self.line_number.is_some());+    assert!(self.start_column.is_some());+    assert!(self.end_column.is_some());+    let line = (1 + self.line_number.unwrap()).to_string();+    let line_color = ansi::black_on_white(line.to_string());+    let line_len = line.clone().len();+    let line_padding =+      ansi::black_on_white(format!("{:indent$}", "", indent = line_len))+        .to_string();+    let mut s = String::new();+    let start_column = self.start_column.unwrap();+    let end_column = self.end_column.unwrap();+    // TypeScript uses `~` always, but V8 would utilise `^` always, even when+    // doing ranges, so here, if we only have one marker (very common with V8+    // errors) we will use `^` instead.+    let underline_char = if (end_column - start_column) <= 1 {+      '^'+    } else {+      '~'+    };+    for i in 0..end_column {+      if i >= start_column {+        s.push(underline_char);+      } else {+        s.push(' ');+      }+    }+    let color_underline = match self.category {+      DiagnosticCategory::Error => ansi::red(s).to_string(),+      _ => ansi::cyan(s).to_string(),+    };++    let indent = format!("{:indent$}", "", indent = level);++    format!(+      "\n\n{}{} {}\n{}{} {}\n",+      indent, line_color, source_line, indent, line_padding, color_underline+    )+  }++  fn format_source_name(&self, level: usize) -> String {+    if self.script_resource_name.is_none() {+      return "".to_string();+    }++    let script_name = ansi::cyan(self.script_resource_name.clone().unwrap());+    assert!(self.line_number.is_some());+    assert!(self.start_column.is_some());+    let line = ansi::yellow((1 + self.line_number.unwrap()).to_string());+    let column = ansi::yellow((1 + self.start_column.unwrap()).to_string());+    format!(+      "{:indent$}{}:{}:{} ",+      "",+      script_name,+      line,+      column,+      indent = level+    )+  }+}++impl fmt::Display for DiagnosticItem {+  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {+    write!(+      f,+      "{}{}{}{}{}",+      self.format_source_name(0),+      self.format_category_and_code(),+      self.format_message(0),+      self.format_source_line(0),+      self.format_related_info(),+    )?;++    Ok(())+  }+}++#[derive(Debug, PartialEq, Clone)]+pub struct DiagnosticMessageChain {+  pub message: String,+  pub code: i64,+  pub category: DiagnosticCategory,+  pub next: Option<Box<DiagnosticMessageChain>>,+}++impl DiagnosticMessageChain {+  pub fn from_json_value(v: &serde_json::Value) -> Option<Box<Self>> {+    if !v.is_object() {+      return None;+    }++    let obj = v.as_object().unwrap();+    let message = obj+      .get("message")+      .and_then(|v| v.as_str().map(String::from))+      .unwrap();+    let code = obj.get("code").and_then(Value::as_i64).unwrap();+    let category = DiagnosticCategory::from_i64(+      obj.get("category").and_then(Value::as_i64).unwrap(),+    );++    let next_v = obj.get("next");+    let next = match next_v {+      Some(n) => DiagnosticMessageChain::from_json_value(n),+      _ => None,+    };++    Some(Box::new(Self {+      message,+      code,+      category,+      next,+    }))+  }+}++#[derive(Debug, PartialEq, Clone)]+pub enum DiagnosticCategory {+  Log,        // 0+  Debug,      // 1+  Info,       // 2+  Error,      // 3+  Warning,    // 4+  Suggestion, // 5+}++impl DiagnosticCategory {+  fn from_i64(value: i64) -> Self {

I agree, it would make more sense.

kitsonk

comment created time in a month

fork cllty/nix

Rust friendly bindings to *nix APIs

fork in 2 months

fork cllty/deno_std

deno standard modules

https://deno.land/x/

fork in 2 months

issue closeddenoland/deno

crypto std

Is there a crypto std for Deno? Is there one in the roadmap?

closed time in 2 months

cllty

issue openeddenoland/deno

crypto std

Is there a crypto std for Deno? Is there one in the roadmap?

created time in 2 months

fork cllty/rust

Empowering everyone to build reliable and efficient software.

https://www.rust-lang.org

fork in 2 months

fork cllty/open-location-code

Open Location Code is a library to generate short codes that can be used like street addresses, for places where street addresses don't exist.

http://www.openlocationcode.com

fork in 2 months

fork cllty/deno

A secure JavaScript/TypeScript runtime built with V8, Rust, and Tokio

https://deno.land/

fork in 2 months

fork cllty/awesome-deno

🎉A curated list of awesome things related to Deno

fork in 3 months

issue commentdenoland/deno

Deno hangs in repl osx

@ry after building the branch https://github.com/denoland/deno/pull/2158 it works fine. The error messages seem descriptive too.

cllty

comment created time in 3 months

issue commentdenoland/deno

Deno hangs in repl osx

@hayd I get the same output with deno running or not.

cllty

comment created time in 3 months

fork cllty/deno_docker

Dockerfiles for deno

fork in 3 months

issue commentdenoland/deno

Deno hangs in repl osx

@kevinkassimo this is my output from deno -D

➜ deno -D
DEBUG RS - mkdir -p /Users/per/Library/Caches/deno/gen
DEBUG RS - set dir perm to 493
DEBUG RS - mkdir -p /Users/per/Library/Caches/deno/deps
DEBUG RS - set dir perm to 493
DEBUG RS - mkdir -p /Users/per/Library/Caches/deno/deps/http
DEBUG RS - set dir perm to 493
DEBUG RS - mkdir -p /Users/per/Library/Caches/deno/deps/https
DEBUG RS - set dir perm to 493
DEBUG RS - root /Users/per/Library/Caches/deno
DEBUG RS - gen /Users/per/Library/Caches/deno/gen
DEBUG RS - deps /Users/per/Library/Caches/deno/deps
DEBUG RS - deps_http /Users/per/Library/Caches/deno/deps/http
DEBUG RS - deps_https /Users/per/Library/Caches/deno/deps/https
DEBUG RS - Deno isolate init with snapshots.
DEBUG RS - msg_from_js Start sync true
DEBUG JS - cwd /Users/per/Desktop/nos/deno-exp
DEBUG JS - args []
DEBUG RS - op_repl_start deno_history.txt
DEBUG RS - Loading REPL history: "/Users/per/Library/Caches/deno/deno_history.txt"
DEBUG RS - Unable to load history file: "/Users/per/Library/Caches/deno/deno_history.txt" No such file or directory (os error 2)
DEBUG RS - msg_from_js ReplStart sync true
DEBUG RS - op_repl_readline 4 >
DEBUG RS - msg_from_js ReplReadline sync false
>
cllty

comment created time in 3 months

issue commentdenoland/deno

Deno hangs in repl osx

I have 12 cpus. I'm not 100% sure but they kinda seem to be related.

cllty

comment created time in 3 months

issue commentdenoland/deno

Deno hangs in repl osx

Just installed v0.3.8 and getting same issue.

cllty

comment created time in 3 months

issue commentdenoland/deno

Deno hangs in repl osx

I'm on v0.3.8. Could that be the reason?

cllty

comment created time in 3 months

issue openeddenoland/deno

Deno hangs in repl osx

Deno hangs in repl when the Deno.env() function is called.

➜ deno
> Deno.env()
⚠️  Deno requests access to environment variables. Grant? [a/y/n/d (a = allow always, y = allow once, n = deny once, d = deny always)] y^M[1]    66623 terminated  deno

One has to kill the process to exit deno.

➜ ps aux | grep deno
user              66623   0.0  0.1  4537064  14928 s005  S+    4:48pm   0:00.03 deno
➜ kill 66623

created time in 3 months

push eventcllty/ejabberd.cr

cllty

commit sha 7b0629cea5cd170544342d9403a97396a2215a50

Update readme

view details

push time in 3 months

more