Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tasks:
git -c advice.detachedHead=false checkout ${head_rev} &&
pip3 install --quiet pre-commit &&
pre-commit run -a --show-diff-on-failure &&
cargo test"
cargo test --all --verbose --all-features"
metadata:
name: rust-code-analysis lint and test
description: rust-code-analysis lint and test
Expand Down Expand Up @@ -80,7 +80,7 @@ tasks:
git clone --recursive --quiet ${repository} &&
cd rust-code-analysis &&
git -c advice.detachedHead=false checkout ${head_rev} &&
cargo test &&
cargo test --all --verbose --all-features &&
zip -0 ccov.zip `find . -name 'rust_code_analysis*.gc*' -print` &&
../grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore '/*' -o lcov.info &&
bash <(curl -s https://codecov.io/bash) -f lcov.info"
Expand Down Expand Up @@ -111,7 +111,7 @@ tasks:
- git clone --recursive --quiet ${repository}
- cd rust-code-analysis
- git -c advice.detachedHead=false checkout ${head_rev}
- cargo test --verbose --all-features
- cargo test --all --verbose --all-features
mounts:
- content:
url: https://win.rustup.rs/
Expand Down
10 changes: 6 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ cc = "^1.0"
phf_codegen = "^0.8"

[dependencies]
actix-rt = "^1.0"
actix-web = "^2.0"
aho-corasick = "^0.7"
bytes = "^0.5"
enum-iterator = "^0.6"
futures = "^0.3"
fxhash = "0.2"
json = "^0.12"
lazy_static = "^1.3"
num-format = "^0.4"
petgraph = "^0.5"
phf = { version = "^0.8", features = ["macros"] }
regex = "^1.1"
serde = "^1.0"
serde = { version = "^1.0", features = ["derive"] }
serde_cbor = "^0.11"
serde_json = "^1.0"
termcolor = "^1.0"
Expand Down
8 changes: 8 additions & 0 deletions rust-code-analysis-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ authors = ["Calixte Denizet <cdenizet@mozilla.com>"]
edition = "2018"

[dependencies]
actix-rt = "^1.0"
actix-web = "^2.0"
bytes = "^0.5"
clap = "^2.33"
crossbeam = "^0.7"
futures = "^0.3"
globset = "^0.4"
num_cpus = "^1.13"
rust-code-analysis = { path = ".." }
serde = "^1.0"
serde_json = "^1.0"
walkdir = "^2.2"

[dev-dependencies]
pretty_assertions = "^0.6"
7 changes: 6 additions & 1 deletion rust-code-analysis-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
extern crate clap;
extern crate crossbeam;
extern crate num_cpus;
#[macro_use]
extern crate serde;
#[cfg_attr(test, macro_use)]
extern crate serde_json;

mod web;

use clap::{App, Arg};
use crossbeam::channel::{Receiver, Sender};
use crossbeam::crossbeam_channel::unbounded;
Expand All @@ -16,8 +21,8 @@ use std::sync::{Arc, Mutex};
use std::{process, thread};
use walkdir::{DirEntry, WalkDir};

use rust_code_analysis::web::server;
use rust_code_analysis::*;
use web::server;

#[derive(Debug)]
struct Config {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use serde::{Deserialize, Serialize};

use crate::comment_rm::rm_comments;
use crate::traits::{Callback, TSParserTrait};
use rust_code_analysis::{rm_comments, Callback, TSParserTrait};

#[derive(Debug, Deserialize, Serialize)]
pub struct WebCommentPayload {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use serde::{Deserialize, Serialize};
use serde_json::{self, Value};

use crate::function::{function, FunctionSpan};
use crate::traits::{Callback, TSParserTrait};
use rust_code_analysis::{function, Callback, FunctionSpan, TSParserTrait};

#[derive(Debug, Deserialize, Serialize)]
pub struct WebFunctionPayload {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use serde::{Deserialize, Serialize};
use serde_json::{self, Value};
use std::path::PathBuf;

use crate::spaces::{metrics, FuncSpace};
use crate::traits::{Callback, TSParserTrait};
use rust_code_analysis::{metrics, Callback, FuncSpace, TSParserTrait};

#[derive(Debug, Deserialize, Serialize)]
pub struct WebMetricsPayload {
Expand Down
2 changes: 0 additions & 2 deletions src/web/mod.rs → rust-code-analysis-cli/src/web/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pub mod alterator;
pub mod ast;
pub mod comment;
pub mod function;
pub mod metrics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ use actix_web::{
use futures::StreamExt;
use std::path::PathBuf;

use super::ast::{AstCallback, AstCfg, AstPayload};
use super::comment::{WebCommentCallback, WebCommentCfg, WebCommentInfo, WebCommentPayload};
use super::function::{WebFunctionCallback, WebFunctionCfg, WebFunctionInfo, WebFunctionPayload};
use super::metrics::{WebMetricsCallback, WebMetricsCfg, WebMetricsInfo, WebMetricsPayload};
use crate::langs::action;
use crate::tools::guess_language;
use crate::LANG;

use rust_code_analysis::{action, guess_language, AstCallback, AstCfg, AstPayload, LANG};

const INVALID_LANGUAGE: &str = "The file extension doesn't correspond to a valid language";

Expand Down
3 changes: 0 additions & 3 deletions src/web/alterator.rs → src/alterator.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use tree_sitter::Node;

use crate::checker::Checker;
use crate::web::ast::{AstNode, Span};

use crate::*;

pub trait Alterator
Expand Down
3 changes: 1 addition & 2 deletions src/web/ast.rs → src/ast.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use serde::ser::{SerializeStruct, Serializer};
use serde::{Deserialize, Serialize};

use super::alterator::Alterator;
use crate::traits::{Callback, TSParserTrait};
use crate::*;

pub type Span = Option<(usize, usize, usize, usize)>;

Expand Down
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ extern crate lazy_static;
#[macro_use]
extern crate serde;
extern crate serde_cbor;
#[cfg_attr(test, macro_use)]
extern crate serde_json;
extern crate serde_yaml;
extern crate toml;

pub(crate) mod c_macro;
pub mod web;

#[macro_use]
mod asttools;
mod checker;

#[macro_use]
mod macros;
Expand All @@ -31,6 +28,9 @@ pub(crate) use metrics::*;
mod languages;
pub(crate) use languages::*;

mod checker;
pub(crate) use checker::*;

mod output;
pub use output::*;

Expand All @@ -46,6 +46,12 @@ pub use crate::find::*;
pub mod function;
pub use crate::function::*;

mod alterator;
pub(crate) use crate::alterator::*;

mod ast;
pub use crate::ast::*;

pub mod count;
pub use crate::count::*;

Expand Down
2 changes: 1 addition & 1 deletion src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::path::PathBuf;
use std::sync::Arc;
use tree_sitter::{Language, Node};

use crate::alterator::Alterator;
use crate::checker::Checker;
use crate::cyclomatic::Cyclomatic;
use crate::exit::Exit;
Expand All @@ -14,7 +15,6 @@ use crate::mi::Mi;
use crate::nom::Nom;
use crate::preproc::PreprocResults;
use crate::ts_parser::Filter;
use crate::web::alterator::Alterator;

pub trait CodeMetricsT: Cyclomatic + Exit + Halstead + NArgs + Loc + Nom + Mi {}

Expand Down
2 changes: 1 addition & 1 deletion src/ts_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use std::path::PathBuf;
use std::sync::Arc;
use tree_sitter::{Node, Parser, Tree};

use crate::alterator::Alterator;
use crate::c_macro;
use crate::checker::*;
use crate::getter::Getter;
use crate::langs::*;
use crate::preproc::{get_macros, PreprocResults};
use crate::traits::*;
use crate::web::alterator::Alterator;

pub struct TSParser<T: TSLanguage + Checker + Getter + Alterator + CodeMetricsT> {
code: Vec<u8>,
Expand Down
133 changes: 0 additions & 133 deletions src/web/ast.bak.rs

This file was deleted.