Skip to content

Commit 7e712e0

Browse files
authored
Merge branch 'master' into docs/web-cli
2 parents 1130fe5 + 12c362e commit 7e712e0

10 files changed

+23
-11
lines changed

.typos.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# See https://github.com/crate-ci/typos/blob/master/docs/reference.md to configure typos
2+
3+
[default.extend-identifiers]
4+
5+
[default.extend-words]
6+
7+
[files]
8+
extend-exclude = [
9+
"enums/data/",
10+
"tree-sitter-*/examples/",
11+
"src/c_langs_macros/c_macros.rs",
12+
]

src/getter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ impl Getter for CppCode {
422422
// we're in a function_definition so need to get the declarator
423423
if let Some(declarator) = node.child_by_field_name("declarator") {
424424
let declarator_node = declarator;
425-
if let Some(fd) = declarator_node.first_occurence(|id| {
425+
if let Some(fd) = declarator_node.first_occurrence(|id| {
426426
Cpp::FunctionDeclarator == id
427427
|| Cpp::FunctionDeclarator2 == id
428428
|| Cpp::FunctionDeclarator3 == id

src/metrics/cognitive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::macros::implement_metric_trait;
99
use crate::*;
1010

1111
// TODO: Find a way to increment the cognitive complexity value
12-
// for recursive code. For some kind of langauges, such as C++, it is pretty
12+
// for recursive code. For some kind of languages, such as C++, it is pretty
1313
// hard to detect, just parsing the code, if a determined function is recursive
1414
// because the call graph of a function is solved at runtime.
1515
// So a possible solution could be searching for a crate which implements
@@ -1627,7 +1627,7 @@ mod tests {
16271627
return bar(foo(a))(a)",
16281628
"foo.py",
16291629
|metric| {
1630-
// 2 functions + 2 lamdas = 4
1630+
// 2 functions + 2 lambdas = 4
16311631
insta::assert_json_snapshot!(
16321632
metric.cognitive,
16331633
@r###"

src/metrics/cyclomatic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ mod tests {
416416
);
417417
}
418418

419-
/// Test to handle the case of min and max when merge happen before the final value of one module are setted.
419+
/// Test to handle the case of min and max when merge happen before the final value of one module are set.
420420
/// In this case the min value should be 3 because the unit space has 2 branches and a complexity of 3
421421
/// while the function sumOfPrimes has a complexity of 4.
422422
#[test]

src/metrics/mi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl Serialize for Stats {
2727
where
2828
S: Serializer,
2929
{
30-
let mut st = serializer.serialize_struct("maintanability_index", 3)?;
30+
let mut st = serializer.serialize_struct("maintainability_index", 3)?;
3131
st.serialize_field("mi_original", &self.mi_original())?;
3232
st.serialize_field("mi_sei", &self.mi_sei())?;
3333
st.serialize_field("mi_visual_studio", &self.mi_visual_studio())?;

src/node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl<'a> Cursor<'a> {
205205
}
206206

207207
impl<'a> Search<'a> for Node<'a> {
208-
fn first_occurence(&self, pred: fn(u16) -> bool) -> Option<Node<'a>> {
208+
fn first_occurrence(&self, pred: fn(u16) -> bool) -> Option<Node<'a>> {
209209
let mut cursor = self.cursor();
210210
let mut stack = Vec::new();
211211
let mut children = Vec::new();

src/ops.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::traits::*;
1818
pub struct Ops {
1919
/// The name of a function space.
2020
///
21-
/// If `None`, an error is occured in parsing
21+
/// If `None`, an error is occurred in parsing
2222
/// the name of a function space.
2323
pub name: Option<String>,
2424
/// The first line of a function space.
@@ -213,7 +213,7 @@ pub fn operands_and_operators<'a, T: ParserTrait>(parser: &'a T, path: &'a Path)
213213
}
214214
}
215215

216-
finalize::<T>(&mut state_stack, std::usize::MAX);
216+
finalize::<T>(&mut state_stack, usize::MAX);
217217

218218
state_stack.pop().map(|mut state| {
219219
state.ops.name = path.to_str().map(|name| name.to_string());

src/spaces.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ pub fn metrics<'a, T: ParserTrait>(parser: &'a T, path: &'a Path) -> Option<Func
348348
}
349349
}
350350

351-
finalize::<T>(&mut state_stack, std::usize::MAX);
351+
finalize::<T>(&mut state_stack, usize::MAX);
352352

353353
state_stack.pop().map(|mut state| {
354354
state.space.name = path.to_str().map(|name| name.to_string());

src/tools.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ pub(crate) fn guess_file<S: ::std::hash::BuildHasher>(
340340
new_possibilities.clear();
341341
}
342342

343-
let mut dist_min = std::usize::MAX;
343+
let mut dist_min = usize::MAX;
344344
let mut path_min = Vec::new();
345345
for p in possibilities.iter() {
346346
if current_path == p {

src/traits.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub trait ParserTrait {
6767
}
6868

6969
pub(crate) trait Search<'a> {
70-
fn first_occurence(&self, pred: fn(u16) -> bool) -> Option<Node<'a>>;
70+
fn first_occurrence(&self, pred: fn(u16) -> bool) -> Option<Node<'a>>;
7171
fn act_on_node(&self, pred: &mut dyn FnMut(&Node<'a>));
7272
fn first_child(&self, pred: fn(u16) -> bool) -> Option<Node<'a>>;
7373
fn act_on_child(&self, action: &mut dyn FnMut(&Node<'a>));

0 commit comments

Comments
 (0)